AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu Players HELP (https://forums.alliedmods.net/showthread.php?t=219952)

Podarok 07-05-2013 06:15

Menu Players HELP
 
Hello. So far i got this :
PHP Code:

stock menu_players(idCsTeams:teamskipalivecallback[], title[], any:...)
{
    static 
iname[32], num[5], menumenuname[32]
    
vformat(menunamecharsmax(menuname), title7)
    
menu menu_create(menunamecallback)
    for(
1<= g_MaxClientsi++)
    {
        if(!
is_user_connected(i) || (alive && !is_user_alive(i)) || (skip == i))
            continue

         if(!(
team == CS_TEAM_T || team == CS_TEAM_CT) || ((team == CS_TEAM_T || team == CS_TEAM_CT) && (cs_get_user_team(i) == team)))
        {
            
get_user_name(inamecharsmax(name))
            
num_to_str(inumcharsmax(num))
            
menu_additem(menunamenum0)
        }
    }
    
menu_display(idmenu)


I want to make a parameter on 8th Option. When you choose it, you change the parameter number and different command will be executed on player. Like this :
Code:
new g_Value = 1 // We add to menu on number 8 with its value menu_additem(menu, "Choose Value", 8) // In handler when we press 8 and if g_Value == 1, we change it to 2. public handled(id, menu, item) { // switch between cases case 7: /*8 PRESSED*/ { switch(g_Value): { case 1: g_Value = 2 case 2: g_Value = 3 case 3: g_Value = 1 } }
And so respectively we will do checks later in handler and do execute different cmds on clients :
Code:
public handler(id, menu, item) { // Get info blah blah blah switch(g_Value):{ case 1: // do cmd 1 case 2: // do cmd 2 case 3: // do cmd 3 }
Please help me to do that with my players menu. Please

Blizzard_87 07-05-2013 08:48

Re: Menu Players HELP
 
Code:
public menu_handler( id, menu, item ) {     if ( item == MENU_EXIT )     {         menu_destroy( menu );         return PLUGIN_HANDLED;     }         new szData[6], szName[64];     new item_access, item_callback;         menu_item_getinfo( menu, item, _access, szData,charsmax( szData ), szName,charsmax( szName ), item_callback );         new userid = str_to_num( szData );         new player = find_player( "k", userid ); // flag "k" : find player from userid         if ( !player ) // if the item selected was not a player     {         switch(g_Value) {             case 0:             case 1:             //etc...     }         menu_destroy( menu );     return PLUGIN_HANDLED; }

Podarok 07-05-2013 09:57

Re: Menu Players HELP
 
Thanks I get it. But could you also please provide corrections for this player menu stock to change value on pressing 8 please. Thats what I asked originally. Please
PHP Code:

stock menu_players(idCsTeams:teamskipalivecallback[], title[], any:...)
{
    static 
iname[32], num[5], menumenuname[32]
    
vformat(menunamecharsmax(menuname), title7)
    
menu menu_create(menunamecallback)
    for(
1<= g_MaxClientsi++)
    {
        if(!
is_user_connected(i) || (alive && !is_user_alive(i)) || (skip == i))
            continue

         if(!(
team == CS_TEAM_T || team == CS_TEAM_CT) || ((team == CS_TEAM_T || team == CS_TEAM_CT) && (cs_get_user_team(i) == team)))
        {
            
get_user_name(inamecharsmax(name))
            
num_to_str(inumcharsmax(num))
            
menu_additem(menunamenum0)
        }
    }
    
menu_display(idmenu)


I want for 8th point of the menu to be for that value and if i press that key 8, the value changes. Could you please help me? [from 1 to 7 are players , 8 is for value changing and 9 is Back/Next.]


All times are GMT -4. The time now is 06:30.

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