No longer checks if cookie exists before creation, because RegClientCookie does that for me.

This commit is contained in:
Greyscale 2009-07-06 22:09:54 -07:00
parent 324dd1abe7
commit cf429d2e0f
3 changed files with 17 additions and 29 deletions

View File

@ -73,12 +73,8 @@ ClassOverlayOnCommandsHook()
*/ */
ClassOverlayOnCookiesCreate() ClassOverlayOnCookiesCreate()
{ {
// If cookie doesn't already exist, then create it. // Create overlay cookie.
g_hOverlayEnabledCookie = FindClientCookie(CLASSOVERLAY_COOKIE_ENABLED); g_hOverlayEnabledCookie = RegClientCookie(CLASSOVERLAY_COOKIE_ENABLED, "The toggle state of the class overlay.", CookieAccess_Public);
if (g_hOverlayEnabledCookie == INVALID_HANDLE)
{
g_hOverlayEnabledCookie = RegClientCookie(CLASSOVERLAY_COOKIE_ENABLED, "The toggle state of the class overlay.", CookieAccess_Public);
}
} }
/** /**

View File

@ -65,25 +65,21 @@ ZMarketOnCommandsCreate()
ZMarketOnCookiesCreate() ZMarketOnCookiesCreate()
{ {
// If auto-rebuy cookie doesn't already exist, then create all ZMarket cookies. // Create all cookies.
g_hZMarketAutoRebuyCookie = FindClientCookie(ZMARKET_COOKIE_AUTOREBUY); g_hZMarketAutoRebuyCookie = RegClientCookie(ZMARKET_COOKIE_AUTOREBUY, "The toggle state of auto-rebuy.", CookieAccess_Public);
if (g_hZMarketAutoRebuyCookie == INVALID_HANDLE)
decl String:rebuycookiename[32];
decl String:rebuycookiedesc[64];
// x = Weapon slot.
for (new x = 0; x < WEAPONS_SLOTS_MAX + 1; x++)
{ {
g_hZMarketAutoRebuyCookie = RegClientCookie(ZMARKET_COOKIE_AUTOREBUY, "The toggle state of auto-rebuy.", CookieAccess_Public); // Format cookie name and description.
Format(rebuycookiename, sizeof(rebuycookiename), "%s_%d", ZMARKET_COOKIE_REBUY, x);
Format(rebuycookiedesc, sizeof(rebuycookiedesc), "Current loadout weapon for slot %d", x);
decl String:rebuycookiename[32]; // Register client cookie.
decl String:rebuycookiedesc[64]; RegClientCookie(rebuycookiename, rebuycookiedesc, CookieAccess_Public);
// x = Weapon slot.
for (new x = 0; x < WEAPONS_SLOTS_MAX + 1; x++)
{
// Format cookie name and description.
Format(rebuycookiename, sizeof(rebuycookiename), "%s_%d", ZMARKET_COOKIE_REBUY, x);
Format(rebuycookiedesc, sizeof(rebuycookiedesc), "Current loadout weapon for slot %d", x);
// Register client cookie.
RegClientCookie(rebuycookiename, rebuycookiedesc, CookieAccess_Public);
}
} }
} }

View File

@ -54,12 +54,8 @@ ZHPOnCommandsCreate()
*/ */
ZHPOnCookiesCreate() ZHPOnCookiesCreate()
{ {
// If cookie doesn't already exist, then create it. // Create ZHP cookie.
g_hZHPEnabledCookie = FindClientCookie(ZHP_COOKIE_ENABLED); g_hZHPEnabledCookie = RegClientCookie(ZHP_COOKIE_ENABLED, "The toggle state of ZHP.", CookieAccess_Public);
if (g_hZHPEnabledCookie == INVALID_HANDLE)
{
g_hZHPEnabledCookie = RegClientCookie(ZHP_COOKIE_ENABLED, "The toggle state of ZHP.", CookieAccess_Public);
}
} }
/** /**