PHP Code:
#define MAX_BUFFER_SIZE 200
new Handle:cvarCostApple;
new Handle:g_mainmenu;
new g_iAccount = -1;
public OnPluginStart()
{
g_iAccount = FindSendPropOffs("CCSPlayer", "m_iAccount");
LoadTranslations("food.phrases");
cvarCostApple = CreateConVar("sm_food_apple", "3000", "Cost apple.", FCVAR_PLUGIN, true, 1.0, true, 16000.0);
AutoExecConfig(true, "food");
decl String:buffer[MAX_BUFFER_SIZE];
g_mainmenu = CreateMenu(MainMenuHandler);
Format(buffer, sizeof(buffer), "%t", "Main Menu Title");
SetMenuTitle(g_mainmenu, buffer);
Format(buffer, sizeof(buffer), "%t ($%d)", "Main Menu Item Apple", GetConVarInt(cvarCostApple));
AddMenuItem(g_mainmenu, "_", buffer);
SetMenuExitButton(g_mainmenu, true);
}
public OnConfigsExecuted() // Recreate menu here
{
// Stupid method
decl String:buffer[MAX_BUFFER_SIZE];
g_mainmenu = CreateMenu(MainMenuHandler);
Format(buffer, sizeof(buffer), "%t", "Main Menu Title");
SetMenuTitle(g_mainmenu, buffer);
Format(buffer, sizeof(buffer), "%t ($%d)", "Main Menu Item Apple", GetConVarInt(cvarCostApple));
AddMenuItem(g_mainmenu, "_", buffer);
SetMenuExitButton(g_mainmenu, true);
}