\\\\\ Plugin A
...
public plugin_natives()
register_native("change_dmg_bool", "SwitchCommand_Callback", 1);
public SwitchCommand_Callback(id, change)
{
if(change == 1)
{
return g_bDmgReturn[id] = !g_bDmgReturn[id];
}
else return g_bDmgReturn[id];
}
\\\\\ Plugin B
...
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s^n^n", change_dmg_bool(id, 0) ? MENU_DMG_ON : MENU_DMG_OFF);
iKey |= MENU_KEY_1;
....
if(iKey == MENU_KEY_EXIT) return PLUGIN_HANDLED;
switch(iKey)
{
case 0:
{
change_dmg_bool(id, 1);
}
}
ClientCommand_Menu(id);
return PLUGIN_HANDLED;
}
public g_bitsDmgReturn;
#define get_bit(%1,%2) (%1 & (1 << (%2 & 31)))
#define set_bit(%1,%2) (%1 |= 1 << (%2 & 31))
#define inv_bit(%1,%2) (%1 ^= 1 << (%2 & 31))
#define clr_bit(%1,%2) (%1 &= ~(1 << (%2 & 31)))
new g_iDmgVarId;
#define get_bit(%1,%2) (%1 & (1 << (%2 & 31)))
#define set_bit(%1,%2) (%1 |= 1 << (%2 & 31))
#define inv_bit(%1,%2) (%1 ^= 1 << (%2 & 31))
#define clr_bit(%1,%2) (%1 &= ~(1 << (%2 & 31)))
public plugin_init()
{
g_iDmgVarId = get_xvar_id("g_bitsDmgReturn");
}
public ClientCommand_Menu(const id)
{
new iLen, szMenu[512], iKey = MENU_KEY_0;
new bitsDmg = get_xvar_num(g_iDmgVarId);
iLen = formatex(szMenu, charsmax(szMenu), MENU_TITLE);
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "%s^n^n", get_bit(bitsDmg, id) ? MENU_DMG_ON : MENU_DMG_OFF);
iKey |= MENU_KEY_1;
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, MENU_EXIT_NAME);
iKey |= MENU_KEY_0;
show_menu(id, iKey, szMenu, -1, "Menu");
return PLUGIN_HANDLED;
}
public Menu_Handler(id, iKey)
{
if(iKey == MENU_KEY_EXIT)
return PLUGIN_HANDLED;
switch(iKey)
{
case 0:
{
new bitsDmg = get_xvar_num(g_iDmgVarId);
inv_bit(bitsDmg, id);
set_xvar_num(g_iDmgVarId, bitsDmg);
}
}
ClientCommand_Menu(id);
return PLUGIN_HANDLED;
}