Raised This Month: $51 Target: $400
 12% 

What player chose on vote menu.


Post New Thread Reply   
 
Thread Tools Display Modes
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
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 06-15-2013 , 09:33   Re: What player chose on vote menu.
Reply With Quote #2

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

Last edited by akcaliberg; 06-15-2013 at 09:36.
akcaliberg is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-15-2013 , 15:21   Re: What player chose on vote menu.
Reply With Quote #3

%s is for strings only. Use %d or %i for displaying integers.
__________________
fysiks is offline
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 06-15-2013 , 16:40   Re: What player chose on vote menu.
Reply With Quote #4

... but gVotes is not the item that user selected. gVotes will be a completely different 2-digit number.
akcaliberg is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-16-2013 , 06:04   Re: What player chose on vote menu.
Reply With Quote #5

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.

Last edited by Moody92; 06-16-2013 at 06:28.
Moody92 is offline
EpicMonkey
buttmonkey
Join Date: Feb 2012
Old 06-16-2013 , 07:24   Re: What player chose on vote menu.
Reply With Quote #6

Quote:
Originally Posted by Moody92 View Post
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?
EpicMonkey is offline
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 06-16-2013 , 09:54   Re: What player chose on vote menu.
Reply With Quote #7

Quote:
Originally Posted by EpicMonkey View Post
ftw?
for the win ,

Last edited by Moody92; 06-16-2013 at 09:55.
Moody92 is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-16-2013 , 17:33   Re: What player chose on vote menu.
Reply With Quote #8

Quote:
Originally Posted by Moody92 View Post
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.
__________________
fysiks is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:05.


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