help me with this code


PHP Code:







#include <amxmodx>
 
  //This will hold the VoteMenu
 
new gVoteMenu;
 
//This will hold the votes for each option
 
new gVotes[2];
 
//This determines if a vote is already happening
 
new gVoting;

 public 
plugin_init()
 {
    
//Register a way to get to your voteClick post title for more details
    
register_clcmd"start_vote","StartVote");
 }
 public 
StartVote(id)
 {
    
//If there is already a vote, don't start another
    
if( gVoting )
    {
        
client_print(idprint_chat"There is already a vote going.");
        
//We return PLUGIN_HANDLED so the person does not get Unknown Command in console
        
return PLUGIN_HANDLED;
   & nbsp;}

    
//Store the menu in the global
    
gVoteMenu menu_create("\rLook at this Vote Menu!:""menu_handler");

    
//Add some vote options
    
menu_additem(gVoteMenu"Vote Option 1""0"0);
    
menu_additem(gVoteMenu"Vote Option 2""1"0);

    
//We will need to&nbs p;create some variables so we can loop through all the players
    
new players[32], pnumtempid;

    
//Fill players with available players
    
get_players(playerspnum);

    
//Start looping through all players to show the vote to
    
for( new ii<pnumi++ )
    {
       & nbsp;
//Save a tempid so we do not re-index
        
tempid players[i];

        
//Show the vote to this player
        
menu_display(tempidgVoteMenu0);

        
//Increase how many players are voting
        
gVoting++;
    }

    
//End the vote in 10 seconds
    
set_task(10.0"EndVote");

    return 
PLUGIN_HANDLED;
 }
 public 
menu_handler(idmenuitem)
 {
    
//If the menu was exited or if there is not a vote
    
if( item == MENU_EXIT || !gVoting )
    {
        
//Note were not destroying the menu
        
return PLUGIN_HANDLED< span>;
    }

    new 
data[6], szName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,charsmax(data), szName,charsmax(szName), callback);

    
//Get the id of the player that was selected
    
new voteid  str_to_num(data);

    
//Increase the votes for what they selected
    
gVotes[voteid]++;

    
//Note were not destroying the menu
    
return PLUGIN_HANDLED;
 }
 public 
EndVote()
 {
    
//If the first option recieved the most votes
    
if( gVotes[0] > gVotes[1] )
     &nb sp;  
client_print(0print_chat"First option recieved most votes (%d)"gVotes[0] );

    
//Else if the second option recieved the most votes
    
else if( gVotes[0] < gVotes[1] )
        
client_print(0print_chat"Second option recieved most votes (%d)"gVotes[1
] );

    
//Otherwise the vote tied
    
else
        
client_print(0print_chat"The vote tied at %d votes each."gVotes[0] );

    
//Don't forget to destroy the menu now that we are completely done with it
    
menu_destroy(gVoteMenu);

    
//Reset that no players are voting
    
gVoting =&nbs p;0;
 } 









I want to do when the vote is over

All votes will be deleted .

imean its save the votes .

For example:

I am starting the vote , 5 ppl Voted .

now , Passes three Raondim im starting the vote again .

And voting have been saved from the first vote .



THX .


Orignal From: help me with this code

No comments

Not a single link is allowed to submit in comment :o