hello everyone
there is a bug on this code
PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"
new rounds = 0;
new gVoteMenu;
new gVotes[2];
new gVoting;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
register_logevent("round_start", 2, "1=Round_Start")
register_clcmd( "amx_bhopvote", "StartVote", ADMIN_RCON );
}
public round_start(){
rounds++;
if (rounds == 1) {
set_task(10.0, "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( "\rBhop vote!:", "menu_handler" );
menu_additem( gVoteMenu, "Enable Bhop", "", 0 );
menu_additem( gVoteMenu, "Disable Bhop", "", 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(20.0, "EndVote" );
return PLUGIN_HANDLED;
}
public menu_handler( id, menu, item )
{
if ( item == MENU_EXIT || !gVoting )
{
return PLUGIN_HANDLED;
}
gVotes[ item ]++;
new player[33]
get_user_name(id, player, charsmax(player))
client_print(0, print_chat, "%s chose %s", player, item)
return PLUGIN_HANDLED;
}
public EndVote()
{
if ( gVotes[0] > gVotes[1] ){
client_print(0, print_chat, "Enabling bhop recieved (%d ) of votes, It's enabled!", gVotes[0] );
console_cmd(0, "bh_enabled 1")
}
else if ( gVotes[0] < gVotes[1] ){
client_print(0, print_chat, "Disabling bhop recieved (%d ) of votes, It's disabled!", gVotes[1] );
console_cmd(0, "bh_enabled 0")
}
else {
client_print(0, print_chat, "The vote tied at %d votes each, Vote will start again in 10 seconds", gVotes[0] );
set_task(10.0, "StartVote" );
}
menu_destroy( gVoteMenu );
gVoting = 0;
}
which is when a player chose from the vote its only show : player chose .
not like: Player chose Enable Bhop./Disable Bhop.
help please
thx
.