AlliedModders

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

liryck 03-10-2010 23:22

menu and random choose
 
hi there i want to know all know that if a menu appear and the player is afk latter of sometime menu gone right? well if that happend how i know that?

i mean if the player with menu dont choose any option

data = 0? or something?

Bugsy 03-10-2010 23:56

Re: menu and random choose
 
When the menu is displayed, set bool to false. When\if he selects something, set it to true.

PHP Code:

new g_bSelectedMenu;
#define CheckFlag(%1)    (g_bSelectedMenu & (1<<(%1 & 31 )))
#define SetFlag(%1)    (g_bSelectedMenu |= (1<<(%1 & 31 )))
#define RemFlag(%1)    (g_bSelectedMenu &= ~(1<<(%1 & 31 ))) 

To set the bool to false:
PHP Code:

//Set all players bool to false
g_bSelectedMenu 0;

//Set single player bool to false
RemFlagid ); 

To set the bool to true:
PHP Code:

SetFlagid ); 

Check if the bool is true:
PHP Code:

CheckFlagid ); 


liryck 03-11-2010 11:41

Re: menu and random choose
 
ok i understand i bit about the bool but you'r using something that i dont understand here is an code.

how it should be done?

PHP Code:

public menu_handler(idmenuitem)
 {
 new 
selectedct[32]
 new 
count
 
new ct_team;
 new 
flag 0;
 new 
t_team;
 new 
name[32]
    if( 
item == MENU_EXIT )
    {
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }

    new 
data[6], iName[64];
    new 
accesscallback;
    
menu_item_getinfo(menuitemaccessdata,5iName63callback);

    
//Get the id of the player that was selected
    
server_print"playerid = %s" data ); 
    new 
ptempid str_to_num(data);
     
server_print"playerid = %d" ptempid ); 
    
    
       if (
swap false && is_user_connected(ptempid))
    {
            
cs_set_user_team(ptempidCS_TEAM_CT)
            
get_user_name(ptempid,name,31)
            
client_print(0,print_chat,"%s Has Sido Elegido Por el Capitan de los CT's",name)
            
GetPlayerIndex(ptempid)
            
swap true
        
                menu_destroy
(menu);
                
set_task(5.0,"AwesomeMenu",id)
                return 
PLUGIN_HANDLED;
    }
    if(
swap true && is_user_connected(ptempid))
       {
            
cs_set_user_team(ptempidCS_TEAM_T)
            
get_user_name(ptempid,name,31)
            
client_print(0,print_chat,"%s Has Sido Elegido Por el Capitan de los CT's",name)
            
GetPlayerIndex(ptempid)
            
swap false
                        
                menu_destroy
(menu);
                
set_task(5.0,"AwesomeMenu",id)
                return 
PLUGIN_HANDLED;
      }
 
    if(
iNum == 0){
        
client_print(0,print_chat,"No Hay Mas Players")
        
menu_destroy(menu);
        return 
PLUGIN_HANDLED;
    }
    
 } 


liryck 03-12-2010 11:49

Re: menu and random choose
 
k epic fail couldn't get it

Bugsy 03-12-2010 13:58

Re: menu and random choose
 
explain exactly what you dont understand or cant do.

liryck 03-12-2010 20:05

Re: menu and random choose
 
for example Bugsy got the Captaing for the CT team and I got the Captain For T Team.

so a menu display to you first but you're AFK, so X Segs pass andthe menu leave ur screen so no player for your team was selected CT team. if that happend i want that a random player from the list go to CT. caus the CT cap is afk and no player was selected .

i dont know if u got my point

wrecked_ 03-12-2010 21:20

Re: menu and random choose
 
Sorry for the off-topic, but what exactly are you making? It seems you and flamin are both having issues concurring within a week, both of them being the same. It sounds like it'd make everyone's lives easier if myself or someone else just made whatever you two and all the others are making.

liryck 03-12-2010 22:27

Re: menu and random choose
 
im just trying to add a captain sorted mode to the YAP plugin that was made. that's all.

i already change many thing to it from myself and the help of this forum & ppl.

i already got that my menus works just that don't know how to make what i already ask in my last post

Bugsy 03-12-2010 22:29

Re: menu and random choose
 
Quote:

Originally Posted by liryck (Post 1115875)
im just trying to add a captain sorted mode to the YAP plugin that was made. that's all.

i already change many thing to it from myself and the help of this forum & ppl.

i already got that my menus works just that don't know how to make what i already ask in my last post

Post or pm me your entire plugin.


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

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