AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   What player chose on vote menu. (https://forums.alliedmods.net/showthread.php?t=218390)

Moody92 06-15-2013 09:08

What player chose on vote menu.
 
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;



akcaliberg 06-15-2013 09:33

Re: What player chose on vote menu.
 
PHP Code:

client_print(0print_chat"%s chose %s"player, !item "enable":"disable"


fysiks 06-15-2013 15:21

Re: What player chose on vote menu.
 
%s is for strings only. Use %d or %i for displaying integers.

akcaliberg 06-15-2013 16:40

Re: What player chose on vote menu.
 
... but gVotes is not the item that user selected. gVotes will be a completely different 2-digit number.

Moody92 06-16-2013 06:04

Re: What player chose on vote menu.
 
Thank you both fysiks and akcaliberg.

and ftw fysiks I didn't really want it to show an integer. I wanted it to show the string.
and thanks for the tips.

EpicMonkey 06-16-2013 07:24

Re: What player chose on vote menu.
 
Quote:

Originally Posted by Moody92 (Post 1971250)
Thank you both fysiks and akcaliberg.

and ftw fysiks I didn't really want it to show an integer. I wanted it to show the string.
and thanks for the tips.

ftw? :3

Moody92 06-16-2013 09:54

Re: What player chose on vote menu.
 
Quote:

Originally Posted by EpicMonkey (Post 1971276)
ftw? :3

for the win :),

fysiks 06-16-2013 17:33

Re: What player chose on vote menu.
 
Quote:

Originally Posted by Moody92 (Post 1971250)
I didn't really want it to show an integer. I wanted it to show the string.

That doesn't make any sense. If you want to show a string, you have to actually use a string.


All times are GMT -4. The time now is 04:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.