AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   random pick from menu? (https://forums.alliedmods.net/showthread.php?t=121509)

liryck 03-16-2010 13:26

random pick from menu?
 
hi there again. i make a menu, this menu is for chosse players, i already have the menu charged with the players and already display it randomly to some one.

the menu is working 100% but sometimes the player that should choose is afk. so is there a form that for example.

the menu display to me but im afk so 10 segs or X segs latter is there is no choose pick an option randomly.

i try making a funtion called random_choose, and X seconds latter i called if a bool is true the think is that i got the random player but well can't close the menu as i see can't use 2 functions for 1 menu

AzcariaX 03-17-2010 17:59

Re: random pick from menu?
 
If i've understand correctly. You want to close the menu on the player who AFK?

Then this should work, I think.
PHP Code:


client_cmd
(afkplayer"slot10"


liryck 03-18-2010 00:31

Re: random pick from menu?
 
uhm lets see this is my test func, i call with a command my menu normally menu display all okay at there, when the menu display im setting a task for this random_choose of 10 segs. so i wait the 10 segs i got that random player was choosen but the menu still displaying to me, i want to close it

PHP Code:

public random_choose(id)
 {
     new 
player
     
new ran;
    new 
name[32]
     new 
selected[32]
    new 
count
     
if(rand == true)
    {
        
        
ran random(iNum);
        
selected[count++] = iPlayers[ran];
        
iPlayers[ran] = iPlayers[--iNum];
        
player iPlayers[ran];    
        
check true;
        
        if(
swap == false)
        {
            
cs_set_user_team(playerCS_TEAM_CT)
            
get_user_name(player,name,31)
            
client_print(0,print_chat,"%s Has Sido Elegido Por el Capitan de los CT's",name)
            
            
swap true
            client_cmd
(id"slot10"
            
//set_task(5.0,"AwesomeMenu",id)
            
return PLUGIN_HANDLED;
        }
        if(
swap == true)
        {
            
cs_set_user_team(playerCS_TEAM_T)
            
get_user_name(player,name,31)
            
client_print(0,print_chat,"%s Has Sido Elegido Por el Capitan de los T's",name)
            
swap false
                        
            
            client_cmd
(id"slot10"
            
//set_task(5.0,"AwesomeMenu",id)
            
return PLUGIN_HANDLED;
        }
        
    }



AzcariaX 03-18-2010 09:50

Re: random pick from menu?
 
Post full code please.


All times are GMT -4. The time now is 08:37.

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