I want to add more items in menu : gVotes[2], gVotes[3], gVotes[4], gVotes[5]
how can do that?
Code:
#include <amxmodx>
new gVoteMenu,gVotes[2],gVoting;
public plugin_init()
{
register_clcmd( "say /vote","StartVote" );
}
public StartVote( id )
{
if ( gVoting )
{
client_print( id, print_chat, "There is already a vote going." );
return PLUGIN_HANDLED;
}
gVotes[0] = gVotes[1] = 0;
gVoteMenu = menu_create( "\rVote Fun Menu!:", "menu_handler" );
menu_additem( gVoteMenu, "Gravity", "", 0 );
menu_additem( gVoteMenu, "Speed", "", 0 );
new players[32], pnum, tempid;
get_players( players, pnum );
for ( new i; i < pnum; i++ )
{
tempid = players[i];
menu_display( tempid, gVoteMenu, 0 );
gVoting++;
}
set_task(10.0, "EndVote" );
return PLUGIN_HANDLED;
}
public menu_handler( id, menu, item )
{
if ( item == MENU_EXIT || !gVoting )
{
return PLUGIN_HANDLED;
}
gVotes[ item ]++;
return PLUGIN_HANDLED;
}
public EndVote()
{
if ( gVotes[0] > gVotes[1] )
client_print(0, print_chat, "Gravity recieved most votes (%d )", gVotes[0] );
else if ( gVotes[0] < gVotes[1] )
client_print(0, print_chat, "Speed recieved most votes (%d )", gVotes[1] );
else
client_print(0, print_chat, "The vote tied at %d votes each.", gVotes[0] );
menu_destroy( gVoteMenu );
gVoting = 0;
}