View Single Post
Author Message
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-15-2013 , 09:08   What player chose on vote menu.
Reply With Quote #1

I have a tiny problem on my menu which is It doesn't show what the player chose

here's the line

PHP Code:
    new player[33]
    
get_user_name(idplayercharsmax(player))
    
client_print(0print_chat"%s chose %s"playergVotes)
    
    return 
PLUGIN_HANDLED
I also tried

PHP Code:
    new player[33]
    
get_user_name(idplayercharsmax(player))
    
client_print(0print_chat"%s chose %s"playeritem)
    
    return 
PLUGIN_HANDLED
Result : Player chose



Full 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(PLUGINVERSIONAUTHOR)
    
    
register_logevent("round_start"2"1=Round_Start"
    
register_clcmd"amx_ljvote""StartVote"ADMIN_RCON );

}

public 
round_start(){
    
rounds++;
    
    if (
rounds == 1) {
            
set_task(5.0"StartVote" );
    }
}

public 
StartVoteid )
{
    if ( 
gVoting )
    {
        
client_printidprint_chat"There is already a vote going." );
        return 
PLUGIN_HANDLED;
    }
    
    
gVotes[0] = gVotes[1] = 0;
        
    
gVoteMenu menu_create"\rLongjump Stats!:""menu_handler" );

    
menu_additemgVoteMenu"Enable LongJump Stats""");
    
menu_additemgVoteMenu"Disable LongJump Stats""");
    
    new 
players[32], pnumtempid;
    
get_playersplayerspnum );

    for ( new 
ipnumi++ )
    {
    
tempid players[i];
    
menu_displaytempidgVoteMenu);
    
gVoting++;
    }

    
set_task(10.0"EndVote" );
    return 
PLUGIN_HANDLED;
}

public 
menu_handleridmenuitem )
{
    if ( 
item == MENU_EXIT || !gVoting )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
gVotesitem ]++;
    
    
//Here when it sees what the player chose.
    
new player[33]
    
get_user_name(idplayercharsmax(player))
    
client_print(0print_chat"%s chose %s"playergVotes)
    
    return 
PLUGIN_HANDLED;
}

public 
EndVote()
{
    if ( 
gVotes[0] > gVotes[1] ){
    
client_print(0print_chat"Enabling lj recieved (%d ) of votes, It's enabled!"gVotes[0] );
    
console_cmd(0"lj_enable 1")
}
    else if ( 
gVotes[0] < gVotes[1] ){
    
client_print(0print_chat"Disabling lj recieved (%d ) of votes, It's disabled!"gVotes[1] );
    
console_cmd(0"lj_enable 0")
}
    else {
    
client_print(0print_chat"The vote tied at (%d) votes each, Vote will start again in 10 seconds"gVotes[0] );
    
set_task(10.0"StartVote" );
    }
    
    
menu_destroygVoteMenu );

    
gVoting 0;


Last edited by Moody92; 06-26-2013 at 10:03.
Moody92 is offline