Raised This Month: $ Target: $400
 0% 

[HELP] auto votemenu with time


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 11-20-2013 , 13:05   [HELP] auto votemenu with time
Reply With Quote #1

i tried to make this votemenu with Time can someone help me
every 15min that will show that menu + show [%] at menu + player voted

and i will edit and put my Public events

PHP Code:
#include <amxmodx>

new gVoteMenu;
new 
gVotes[2];
new 
gVoting;

public 
plugin_init()
{
    
register_clcmd"start_vote","StartVote");
    
register_clcmd"say /test","StartVote");
}
public 
StartVote(id)
{
    if( 
gVoting )
    {
        
client_print(idprint_chat"There is already a vote going.");
        return 
PLUGIN_HANDLED;
    }

       
gVoteMenu menu_create("\r[AMXX] Auto Random Event's""menu_handler");
       
menu_additem(gVoteMenu"\yMath \wContest Event #1""0"0);
       
menu_additem(gVoteMenu"\yWrite \wContest Event #2""1"0);
       
gVotes[0] = 0;
       
gVotes[1] = 0;
       new 
players[32], pnumtempid;
       
get_players(playerspnum);
       for( new 
ii<pnumi++ )
       {
           
tempid players[i];
           
menu_display(tempidgVoteMenu0);
           
gVoting++;
       }
       
set_task(10.0"EndVote");
       return 
PLUGIN_HANDLED;
}
public 
menu_handler(idgVoteMenuitem)
{

    if( 
item == MENU_EXIT || !gVoting )
    {
            return 
PLUGIN_HANDLED;
    }
       new 
data[6], iName[64];
       new 
accesscallback;
       
menu_item_getinfo(gVoteMenuitemaccessdata,5iName63callback);
       new 
voteid str_to_num(data);
       
gVotes[voteid]++;
       return 
PLUGIN_HANDLED;
}
public 
EndVote()
{
    if( 
gVotes[0] > gVotes[1] )
    {
            
client_print(0print_chat"First option recieved most votes (%d)"gVotes[0] );
    }
      else if( 
gVotes[0] < gVotes[1] )
    {
            
client_print(0print_chat"Second option recieved most votes (%d)"gVotes[1] );
    }
       else
    {
            
client_print(0print_chat"The vote tied at %d votes each."gVotes[0] );
    }
       
menu_destroy(gVoteMenu);
       
gVoting 0;
       
gVotes[0] = 0;   //set to 0
       
gVotes[1] = 0;   //set to 0

Snitch is offline
Send a message via Skype™ to Snitch
 



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 23:19.


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