Changed all cookies to Protected access, meaning clients can only read them, not change (via sm_cookie), replaced old usermsg hudhint with SM native.

This commit is contained in:
Greyscale 2009-07-07 15:53:18 -07:00
parent cf429d2e0f
commit 3ebdde1923
5 changed files with 11 additions and 26 deletions

View File

@ -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.

View File

@ -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));

View File

@ -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);
}
/**

View File

@ -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);
}
}

View File

@ -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);
}
/**