This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[HELP]Vote for player connected.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
twiister
Senior Member
Join Date: Mar 2013
Location: Argentina
Old 02-26-2014 , 14:50   [HELP]Vote for player connected.
Reply With Quote #1

Hello, I in my sv have: gg_autovote_mode 2

and I would like to put something:

* If there is less than 7 players connected: order the voting.

* If there is more than 7 players connected: do not order the voting.

DOES ANYBODY HELP ME?? PLEASE!! THANK YOU!!

PHP Code:
public autovote_start()
{
    
// vote in progress
    
if(autovotes[0] || autovotes[1] || autovotes[2] || task_exists(TASK_AUTOVOTE_RESULT)) return 0;
    
    
// if autovote_mode < 0, we haven't actually checked it yet
    
if(autovote_mode 0)
    {
        new 
info[6];
        
get_localinfo("gg_av_iter",info,5);
        new 
iter str_to_num(info);
        
        new 
rotation[32];
        
get_pcvar_string(gg_autovote_mode,rotation,31);
        new 
amount str_count(rotation,',')+1;
        
        if(
iter <= || iter amount)
        {
            
iter 1;
            
set_localinfo("gg_av_iter","1");
        }
        
        
// no rotation, just use the given value
        
if(amount <= 1)
        {
            if(
iter != 1set_localinfo("gg_av_iter","1");
            
autovote_mode str_to_num(rotation);
        }
        else
        {
            for(new 
i=1;i<=amount;i++)
            {
                if(
contain(rotation,",") != -1)
                {
                    
strtok(rotation,info,5,rotation,31,',');
                    if(
== iter// this is the one we're looking for
                    
{
                        
autovote_mode str_to_num(info);
                        break;
                    }
                }
                else 
// we've stripped away everything else and are left with the last one, so use it
                
{
                    
autovote_mode str_to_num(rotation);
                    break;
                }
            }
            
            
iter++;
            if(
iter amountiter 1;
            
num_to_str(iter,info,5);
            
set_localinfo("gg_av_iter",info);
        }
    }
    
    
// turns out it's disabled
    
if(autovote_mode 0) return 0;

    new 
Float:autovote_time get_pcvar_float(gg_autovote_time);

    new 
i;
    for(
i=1;i<=maxPlayers;i++)
    {
        if(!
is_user_connected(i)) continue;

        switch(
autovote_mode)
        {
            case 
1:
            {
                
formatex(menuText,511,"\y%L^n^n\w1. %L^n2. %L^n^n0. %L",i,"PLAY_GUNGAME",i,"YES",i,"NO",i,"CANCEL");
                
show_menu(i,MENU_KEY_1|MENU_KEY_2|MENU_KEY_0,menuText,floatround(autovote_time),"autovote_menu");
            }
            case 
2:
            {
                
formatex(menuText,511,"\y%L^n^n\w1. %L^n2. %L^n^n0. %L",i,"PLAY_GUNGAME",i,"YES_TEAMPLAY",i,"YES_REGULAR",i,"CANCEL");
                
show_menu(i,MENU_KEY_1|MENU_KEY_2|MENU_KEY_0,menuText,floatround(autovote_time),"autovote_menu");
            }
            default:
            {
                
formatex(menuText,511,"\y%L^n^n\w1. %L^n2. %L^n3. %L^n^n0. %L",i,"PLAY_GUNGAME",i,"YES_TEAMPLAY",i,"YES_REGULAR",i,"NO",i,"CANCEL");
                
show_menu(i,MENU_KEY_1|MENU_KEY_2|MENU_KEY_3|MENU_KEY_0,menuText,floatround(autovote_time),"autovote_menu");
            }
        }
    }

    
gungame_print(0,0,1,"%L",LANG_PLAYER_C,"VOTING_STARTED");
    
set_task(autovote_time,"autovote_result",TASK_AUTOVOTE_RESULT);

    return 
1;

twiister 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 13:52.


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