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

[FIX] BunnyHop Vote


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 02-17-2014 , 03:57   [FIX] BunnyHop Vote
Reply With Quote #1

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(PLUGINVERSIONAUTHOR)
    
    
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 
StartVoteid )
{
    if ( 
gVoting )
    {
        
client_printidprint_chat"There is already a vote going." );
        return 
PLUGIN_HANDLED;
    }
    
    
gVotes[0] = gVotes[1] = 0;
        
    
gVoteMenu menu_create"\rBhop vote!:""menu_handler" );

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

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

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

public 
menu_handleridmenuitem )
{
    if ( 
item == MENU_EXIT || !gVoting )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
gVotesitem ]++;
    
    new 
player[33]
    
get_user_name(idplayercharsmax(player))
    
client_print(0print_chat"%s chose %s"playeritem)
    
    return 
PLUGIN_HANDLED;
}

public 
EndVote()
{
    if ( 
gVotes[0] > gVotes[1] ){
    
client_print(0print_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(0print_chat"Disabling bhop recieved (%d ) of votes, It's disabled!"gVotes[1] );
    
console_cmd(0"bh_enabled 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;

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 .
5aloOod is offline
pokemonmaster
princess milk
Join Date: Nov 2010
Location: Somewhere in this world
Old 02-17-2014 , 05:42   Re: [FIX] BunnyHop Vote
Reply With Quote #2

client_print(0, print_chat, "%s chose %s", player, item)

client_print(0, print_chat, "%s chose %s", player, !item ? "Enable" : "Disable")
__________________
اَشْهَدُ اَنْ لَّآ اِلٰهَ اِلَّا اللہُ وَحْدَه لَا شَرِيْكَ لَه وَ اَشْهَدُ اَنَّ مُحَمَّدًا عَبْدُه وَرَسُوْلُه
No longer active in AMXX. Sorry.
pokemonmaster is offline
5aloOod
Senior Member
Join Date: Jun 2013
Location: hell
Old 02-17-2014 , 05:54   Re: [FIX] BunnyHop Vote
Reply With Quote #3

Thanks khalid
it will be like this
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_bhopvote""StartVote"ADMIN_RCON ); 



public 
round_start(){ 
    
rounds++; 
     
    if (
rounds == 1) { 
            
set_task(10.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"\rBhop vote!:""menu_handler" ); 

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

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

    
set_task(20.0"EndVote" ); 
    return 
PLUGIN_HANDLED


public 
menu_handleridmenuitem 

    if ( 
item == MENU_EXIT || !gVoting 
    { 
        return 
PLUGIN_HANDLED
    } 
     
    
gVotesitem ]++; 
     
    new 
player[33
    
get_user_name(idplayercharsmax(player)) 
    
client_print(0print_chat"%s chose %s"player, !item "Enable" "Disable"
     
    return 
PLUGIN_HANDLED


public 
EndVote() 

    if ( 
gVotes[0] > gVotes[1] ){ 
    
client_print(0print_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(0print_chat"Disabling bhop recieved (%d ) of votes, It's disabled!"gVotes[1] ); 
    
console_cmd(0"bh_enabled 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 5aloOod; 02-17-2014 at 05:58.
5aloOod 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 09:19.


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