Raised This Month: $ Target: $400
 0% 

[HELP] auto votemenu with time


Post New Thread Reply   
 
Thread Tools Display Modes
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
Snitch
Veteran Member
Join Date: Sep 2013
Location: Kazakhstan
Old 11-23-2013 , 10:43   Re: [HELP] auto votemenu with time
Reply With Quote #2

bump?

just make that menu start every 15min .
Snitch is offline
Send a message via Skype™ to Snitch
Gasa
Senior Member
Join Date: Sep 2013
Old 11-23-2013 , 11:02   Re: [HELP] auto votemenu with time
Reply With Quote #3

public plugin_init()
{
register_clcmd( "start_vote","StartVote");
register_clcmd( "say /test","StartVote");
set_task(900.0, "StartVote")
}
Gasa is offline
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 11-23-2013 , 11:23   Re: [HELP] auto votemenu with time
Reply With Quote #4

No Tested:
sorry i dont know how to set gVote with colorchat.

PHP Code:
#include <amxmodx>
#include <ColorChat>

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

public 
plugin_init()
{
    
register_clcmd"say /test","StartVote");
    
set_task(900.0"StartVote",_,_,_"b");
}
public 
StartVote(id)
{

       
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]++;
       
       
ColorChat0GREEN"%s^x01 has voted."GetUserNameid ) );
       
       return 
1;
}
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
}

stock GetUserName( const index )
{
    static 
szName32 ];
    
    
get_user_nameindexszNamecharsmaxszName ) );
    
    return 
szName;

Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun
Reply


Thread Tools
Display Modes

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