Hi, how do I save the on/off values in the menu after changing the map? when the map changes, the on/off menu changes
in the sounds plugin I use this
new g_hVault = INVALID_HANDLE;
new bool:g_bDisabled[MAX_PLAYERS + 1];
on/off sounds are saved but the labels themselves are not in the menu, you need to save them in the menu too after changing the map
Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <hamsandwich>
#pragma tabsize 0
#define PLUGIN "Menu"
#define VERSION "2.0"
#define AUTHOR "lol ;D"
new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_0
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
register_menu("Menu 1", keys, "func_menu")
register_clcmd("menu", "server_menu" )
}
public client_authorized(id)
{
client_cmd(id, "bind ^"F3^" ^"menu^"")
}
public server_menu(id)
{
new name[32]
get_user_name(id, name, 31)
static menu[650], iLen
iLen = 0
iLen = formatex(menu[iLen], charsmax(menu) - iLen, "\yMenu players (1\2)^n\yHello, \w%s^n^n", name)
if(Music[id])
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r1. \wsound grenade: \rOff^n")
keys |= MENU_KEY_1
}
else
{
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r1. \wsound grenade: \yOn^n")
keys |= MENU_KEY_1
}
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r2. \wfurther^n")
keys |= MENU_KEY_2
iLen += formatex(menu[iLen], charsmax(menu) - iLen, "\r0. \wexit^n^n")
keys |= MENU_KEY_0
show_menu(id, keys, menu, -1, "Menu 1")
return PLUGIN_HANDLED
}
public func_menu(id, key)
{
switch(key)
{
case 0:
{
if(!g_Disabled[id])
{
client_cmd(id, "say /gsound")
g_Disabled[id] = true
}
else
{
client_cmd(id, "say /gsound")
g_Disabled[id] = false
}
server_menu(id)
}
}
return PLUGIN_HANDLED
}
stock GetAliveCt()
{
new CountCt, i
for(i = 1; i <= get_maxplayers(); i++)
if(is_user_alive(i) && is_user_connected(i) && get_user_team(i) == 2)
CountCt++
return CountCt
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
*/