ZCookies module completed, added to the main menu, translations updated.

This commit is contained in:
Greyscale
2009-06-21 21:08:26 -07:00
parent ff7528f09f
commit b74bbe67ce
12 changed files with 301 additions and 32 deletions

View File

@ -102,6 +102,7 @@ public WeaponsMenuMainHandle(Handle:menu_weapons_main, MenuAction:action, client
if (slot == MenuCancel_ExitBack)
{
// Re-open admin menu.
ZRAdminMenu(client);
}
}
// Client hit "Exit" button.

View File

@ -331,9 +331,8 @@ public ZMarketMenuMainHandle(Handle:menu_zmarket_main, MenuAction:action, client
// Auto-rebuy.
case 3:
{
// Toggle rebuy.
new bool:autorebuyenabled = CookiesGetClientCookieBool(client, g_hZMarketAutoRebuyCookie);
CookiesSetClientCookieBool(client, g_hZMarketAutoRebuyCookie, !autorebuyenabled);
// Toggle the auto-rebuy cookie.
ZMarketToggleAutoRebuy(client);
// Resend menu.
ZMarketMenuMain(client);
@ -352,7 +351,7 @@ public ZMarketMenuMainHandle(Handle:menu_zmarket_main, MenuAction:action, client
// Client hit "Back" button.
if (slot == MenuCancel_ExitBack)
{
MenuMain(client);
ZMenuMain(client);
}
}
// Client hit "Exit" button.
@ -1042,6 +1041,38 @@ ZMarketRebuy(client, bool:autorebuy = false)
ZMarketArrayToCookies(client, rebuyweapons, WEAPONS_SLOTS_MAX, sizeof(rebuyweapons));
}
/**
* Toggle auto-rebuy on a client.
*
* @param client The client index.
*/
ZMarketToggleAutoRebuy(client)
{
// If auto-rebuy is disabled, then stop.
new bool:zmarketrebuyauto = GetConVarBool(g_hCvarsList[CVAR_WEAPONS_ZMARKET_REBUY_AUTO]);
if (!zmarketrebuyauto)
{
return;
}
// Get the cookie value.
new bool:autorebuystate = CookiesGetClientCookieBool(client, g_hZMarketAutoRebuyCookie);
// Toggle the value.
CookiesSetClientCookieBool(client, g_hZMarketAutoRebuyCookie, !autorebuystate);
// If auto-rebuy was enabled, then tell client it has been disabled.
if (autorebuystate)
{
TranslationPrintToChat(client, "Weapons zmarket auto-rebuy toggle off");
}
// If auto-rebuy was disabled, then tell client it has been enabled.
else
{
TranslationPrintToChat(client, "Weapons zmarket auto-rebuy toggle on");
}
}
/**
* Command callback (zmarket)
* Opens custom buymenu.