I need help to do that if you click no then it cancels that you can buy grenades but if you click yes it is possible to buy four grenades in the vote menu
---------------------------------------------------------------
Code:
#include <sourcemod>
#include <sdktools>
#pragma semicolon 1
public Plugin myinfo =
{
name = "test",
author = "me",
description = "idk",
version = "1.00",
url = ""
};
ConVar ammo_grenade_limit_total;
public void OnPluginStart()
{
ammo_grenade_limit_total = FindConVar("ammo_grenade_limit_total");
RegConsoleCmd("sm_votegrenades", Command_Vote, "test");
}
public Action Command_Vote(int client, int args)
{
Menu menu = new Menu(Menu_Callback);
menu.SetTitle("Vote Grenades: ");
menu.AddItem("yes", "Yes");
menu.AddItem("no", "No");
menu.DisplayVoteToAll(client, 15);
return Plugin_Handled;
}
public int Menu_Callback(Menu menu, MenuAction action, int param1, int param2)
{
switch (action) {
case MenuAction_Select:
{
char item[32];
menu.GetItem(param2, item, sizeof(item));
if (StrEqual(item, "yes"))
{
SetConVarInt(ammo_grenade_limit_total, 1, false, false);
PrintToChatAll("\x04[VoteGrenades]\x01 The vote is over, The result is \x07Yes\x01");
}
else if (StrEqual(item, "no"))
{
PrintToChatAll("\x04[VoteGrenades]\x01 The vote is over, The result is \x07No\x01");
}
}
case MenuAction_End:
{
delete menu;
}
}
}