From 3ebdde192380a8dc167410368769afff52d0be22 Mon Sep 17 00:00:00 2001 From: Greyscale Date: Tue, 7 Jul 2009 15:53:18 -0700 Subject: [PATCH] Changed all cookies to Protected access, meaning clients can only read them, not change (via sm_cookie), replaced old usermsg hudhint with SM native. --- src/zr/playerclasses/clientoverlays.inc | 4 ++-- src/zr/spawnprotect.inc | 6 +++--- src/zr/translation.inc | 19 ++----------------- src/zr/weapons/zmarket.inc | 4 ++-- src/zr/zhp.inc | 4 ++-- 5 files changed, 11 insertions(+), 26 deletions(-) diff --git a/src/zr/playerclasses/clientoverlays.inc b/src/zr/playerclasses/clientoverlays.inc index 1485cc8..b34baec 100644 --- a/src/zr/playerclasses/clientoverlays.inc +++ b/src/zr/playerclasses/clientoverlays.inc @@ -74,7 +74,7 @@ ClassOverlayOnCommandsHook() ClassOverlayOnCookiesCreate() { // Create overlay cookie. - g_hOverlayEnabledCookie = RegClientCookie(CLASSOVERLAY_COOKIE_ENABLED, "The toggle state of the class overlay.", CookieAccess_Public); + g_hOverlayEnabledCookie = RegClientCookie(CLASSOVERLAY_COOKIE_ENABLED, "The toggle state of the class overlay.", CookieAccess_Protected); } /** @@ -137,7 +137,7 @@ ClassOverlayInitialize(client, const String:overlay[]) decl String:togglecmds[CLASSOVERLAY_TOGGLE_MAX_CMDS * CLASSOVERLAY_TOGGLE_MAX_LENGTH]; GetConVarString(g_hCvarsList[CVAR_CLASSES_OVERLAY_TOGGLECMDS], togglecmds, sizeof(togglecmds)); - TranslationPrintHUDText(client, "Classes overlay toggle", togglecmds); + TranslationPrintHintText(client, "Classes overlay toggle", togglecmds); } // Display class overlays. diff --git a/src/zr/spawnprotect.inc b/src/zr/spawnprotect.inc index 8575a4f..9815c9f 100644 --- a/src/zr/spawnprotect.inc +++ b/src/zr/spawnprotect.inc @@ -143,7 +143,7 @@ SpawnProtectStart(client) TranslationPrintToChat(client, "Spawn protection begin", protect_time); // Send time left in a hud message. - TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]); + TranslationPrintHintText(client, "Spawn Protect", pSpawnProtectTime[client]); // Start repeating timer. tSpawnProtect[client] = CreateTimer(1.0, SpawnProtectTimer, client, TIMER_FLAG_NO_MAPCHANGE|TIMER_REPEAT); @@ -177,7 +177,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client) pSpawnProtectTime[client]--; // Print time left to client. - TranslationPrintHUDText(client, "Spawn Protect", pSpawnProtectTime[client]); + TranslationPrintHintText(client, "Spawn Protect", pSpawnProtectTime[client]); // Time has expired. if (pSpawnProtectTime[client] <= 0) @@ -186,7 +186,7 @@ public Action:SpawnProtectTimer(Handle:timer, any:client) bInfectImmune[client][INFECT_TYPE_NORMAL] = false; // Tell client spawn protection is over. - TranslationPrintHUDText(client, "Spawn protection end"); + TranslationPrintHintText(client, "Spawn protection end"); // Fix attributes. ToolsSetClientAlpha(client, ClassGetAlphaInitial(client)); diff --git a/src/zr/translation.inc b/src/zr/translation.inc index 99fcb59..fad2e4c 100644 --- a/src/zr/translation.inc +++ b/src/zr/translation.inc @@ -49,11 +49,6 @@ * @endsection */ -/** - * HUD text usermsg - */ -#define TRANSLATION_USERMSG_HINTTEXT "HintText" - /** * Load translations file here. */ @@ -284,7 +279,7 @@ stock TranslationPrintCenterText(client, any:...) * @param client The client index. * @param ... Translation formatting parameters. */ -stock TranslationPrintHUDText(client, any:...) +stock TranslationPrintHintText(client, any:...) { // Set translation target SetGlobalTransTarget(client); @@ -294,17 +289,7 @@ stock TranslationPrintHUDText(client, any:...) VFormat(translation, sizeof(translation), "%t", 2); // Print translated phrase to client. - - // If hint text usermsg is invalid, then stop. - new Handle:hHintText = StartMessageOne(TRANSLATION_USERMSG_HINTTEXT, client); - if (hHintText == INVALID_HANDLE) - { - return; - } - - BfWriteByte(hHintText, -1); - BfWriteString(hHintText, translation); - EndMessage(); + PrintHintText(client, translation); } /** diff --git a/src/zr/weapons/zmarket.inc b/src/zr/weapons/zmarket.inc index 22146fe..7010be2 100644 --- a/src/zr/weapons/zmarket.inc +++ b/src/zr/weapons/zmarket.inc @@ -66,7 +66,7 @@ ZMarketOnCommandsCreate() ZMarketOnCookiesCreate() { // Create all cookies. - g_hZMarketAutoRebuyCookie = RegClientCookie(ZMARKET_COOKIE_AUTOREBUY, "The toggle state of auto-rebuy.", CookieAccess_Public); + g_hZMarketAutoRebuyCookie = RegClientCookie(ZMARKET_COOKIE_AUTOREBUY, "The toggle state of auto-rebuy.", CookieAccess_Protected); decl String:rebuycookiename[32]; decl String:rebuycookiedesc[64]; @@ -79,7 +79,7 @@ ZMarketOnCookiesCreate() Format(rebuycookiedesc, sizeof(rebuycookiedesc), "Current loadout weapon for slot %d", x); // Register client cookie. - RegClientCookie(rebuycookiename, rebuycookiedesc, CookieAccess_Public); + RegClientCookie(rebuycookiename, rebuycookiedesc, CookieAccess_Protected); } } diff --git a/src/zr/zhp.inc b/src/zr/zhp.inc index 55fba8f..a8c96f0 100644 --- a/src/zr/zhp.inc +++ b/src/zr/zhp.inc @@ -55,7 +55,7 @@ ZHPOnCommandsCreate() ZHPOnCookiesCreate() { // Create ZHP cookie. - g_hZHPEnabledCookie = RegClientCookie(ZHP_COOKIE_ENABLED, "The toggle state of ZHP.", CookieAccess_Public); + g_hZHPEnabledCookie = RegClientCookie(ZHP_COOKIE_ENABLED, "The toggle state of ZHP.", CookieAccess_Protected); } /** @@ -238,7 +238,7 @@ ZHPUpdateHUD(client) } // Display HP - TranslationPrintHUDText(client, "Display HP", health); + TranslationPrintHintText(client, "Display HP", health); } /**