AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [SOLVED]Menu problem (https://forums.alliedmods.net/showthread.php?t=89437)

One 04-06-2009 09:40

[SOLVED]Menu problem
 
Hi.

first : how can i add a space between menu options? like :
PHP Code:

1. hi
2. bye
3. anything

5. lol
?

9. exit 

2. how can i have a menu in menu?

PHP Code:

1.lol menu
2. haha menu

9. 
exit

>> 
by 1 :

ur now in lol menu

1. bluh
2.bluh

9. back 

3. i added a menu to my code but when i choose 1, happend nothing.
i just become the say but the code in case 1 has no effect :

PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta_const>


#define PLUGIN "Creazy Mazy"
#define VERSION "1.0"
#define AUTHOR "One"

#define TASK_MENU_DISLPAY_TIME 3.0

new bool:moving[512] = true
new const gMovementlevel1[8][1024] =     // Dont change 1024!!
{
    
"+back;wait;wait;wait;wait-back",
    
"+moveleft;wait;wait;wait;wait;-moveleft",
    
"+moveright;wait;wait;wait;wait;-moveright",
    
"+forward;wait;wait;wait;wait;-forward",
    
"-forward",
    
"-back",
    
"-moveleft",
    
"-moveright"
};
new const 
gMousecmds[6][1024] =
{
    
"+lookdown;wait;+right;wait;-right;-lookdown",
    
"+lookup;wait;+left;wait;-lookup;wait;+lookdown;wait;wait;-left;wait;-lookdown",
    
"-lookup",
    
"-lookdown",
    
"-left",
    
"-right"
}
public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_clcmd"CM_Menu","Level_menu")
    
RegisterHam(Ham_Spawn"player""fwHamPlayerSpawnPost"1);
    
register_forwardFM_PlayerPreThink"client_prethink" )
}
public 
Level_menu(id)
{
    new 
menu menu_create("\rChoose you´r Level!:""menu_handler")
    
menu_additem(menu"\wNormal""1"0)
    
menu_additem(menu"\wMedium""2"0)
    
menu_additem(menu"\whigh""3"0)
    
menu_additem(menu"\whelp""4"0)
    
menu_additem(menu"\wExit""5"MEXIT_ALL)
    
//menu_setprop(menu, MPROP_EXIT, MEXIT_ALL)
    
menu_display(idmenu0)
 }
 public 
fwHamPlayerSpawnPost(id)
{
    
set_task(TASK_MENU_DISLPAY_TIME"Level_menu"id);
    return 
HAM_IGNORED;
}
public 
menu_handler(idmenuitem)
{
    if (
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        
//return PLUGIN_HANDLED
    
}
    new 
data[6], iName[64]
    new 
accesscallback
    menu_item_getinfo
(menuitemaccessdata,5iName63callback)
    new 
key str_to_num(data)
    switch(
key)
    {
        case 
1:
        {
            if (
moving[id]) return PLUGIN_HANDLED;
            new 
button pev(id,pev_button)
    
            if (
button == IN_FORWARD)
            {
                
client_cmd(id,"%s"gMovementlevel1random_num1charsmaxgMovementlevel1 ) ) ]);
            }
            if (
button == IN_BACK)
            {
                
client_cmd(id,"%s"gMovementlevel1random_num1charsmaxgMovementlevel1 ) ) ]);
            }
            if (
button == IN_MOVELEFT)
            {
                
client_cmd(id,"%s"gMovementlevel1random_num1charsmaxgMovementlevel1 ) ) ]);
            }
            if (
button == IN_MOVERIGHT)
            {
                
client_cmd(id,"%s"gMovementlevel1random_num1charsmaxgMovementlevel1 ) ) ]);
            }
            if ( 
button == IN_RIGHT)
            {
                
client_cmd(id"%s"gMousecmdsrandom_num1charsmaxgMousecmds ) ) ]);
            }
            if ( 
button == IN_LEFT)
            {
                
client_cmd(id"%s"gMousecmdsrandom_num1charsmaxgMousecmds ) ) ]);
            }
        
            
moving[id] = true;
            
set_task(0.4,"reset",id,"",0,"ab"1)  // Never change this. if change = Channel flood!
            //set_task(0.4,"reset",id,"",0,"ab", 1) 
            
client_print(idprint_chat"Ok level 1")
            
menu_destroy(menu)
            
//return PLUGIN_HANDLED;
        
}
        case 
2:
        {
            
client_print(idprint_chat"22222222")
        }
        case 
3:
        { 
            
client_print(idprint_chat"333333!")
            
menu_destroy(menu)
            
//return PLUGIN_HANDLED
        
}
    }
    
menu_destroy(menu)
    
//return PLUGIN_HANDLED
}
public 
reset(id)
{
    
moving[id] = false;



Dores 04-06-2009 09:57

Re: Menu problem
 
For the first one you should use the old menu system, unless you don't mind something like this:

Code:

1. kadjf
2. kajv
3. kdafvnm
4.
5. fadlsam
...

Which can be done(maybe) by using menu_additem(menu, "").

One 04-06-2009 09:59

Re: Menu problem
 
Quote:

Originally Posted by Dores (Post 798786)
For the first one you should use the old menu system, unless you don't mind something like this:

Code:

1. kadjf
2. kajv
3. kdafvnm
4.
5. fadlsam
...

Which can be done(maybe) by using menu_additem(menu, "").

ty, but is this poss to hide this 4. ?

padilha007 04-06-2009 10:18

Re: Menu problem
 
PHP Code:

put ^n

menu_additem
(menu"\wNormal""1"0)
    
menu_additem(menu"\wMedium""2"0)
    
menu_additem(menu"\whigh""3"0)
    
menu_additem(menu"\whelp^n""4"0)
    
menu_additem(menu"\wExit""5"MEXIT_ALL


One 04-06-2009 10:19

Re: Menu problem
 
Quote:

Originally Posted by padilha007 (Post 798804)
put ^n

menu_additem(menu, "\wNormal", "1", 0)
menu_additem(menu, "\wMedium", "2", 0)
menu_additem(menu, "\whigh", "3", 0)
menu_additem(menu, "\whelp^n", "4", 0)
menu_additem(menu, "\wExit", "5", MEXIT_ALL)

Yop. ty

Dores 04-06-2009 11:49

Re: Menu problem
 
Quote:

Originally Posted by padilha007 (Post 798804)
PHP Code:

put ^n

menu_additem
(menu"\wNormal""1"0)
    
menu_additem(menu"\wMedium""2"0)
    
menu_additem(menu"\whigh""3"0)
    
menu_additem(menu"\whelp^n""4"0)
    
menu_additem(menu"\wExit""5"MEXIT_ALL


This won't hide the 4., to hide it, you need to use the old menu system.

PHP Code:

new szMenu[150];

format(szMenu149"LOL MENU!^n^n1. Normal^n2. Medium^n3. High^n^n5. Help^n^n^n9. Exit 


One 04-06-2009 11:57

Re: Menu problem
 
damn. :-( ok ill use old system. & whats with the case 1? know anyone why this not works?

SnoW 04-06-2009 12:43

Re: Menu problem
 
Quote:

Originally Posted by Dores (Post 798886)
This won't hide the 4., to hide it, you need to use the old menu system.

But it doesn't matter if this is okay:
Quote:

1. hi
2. bye
3. anything

4. lol
?

5.
exit

Just depends is it.

fysiks 04-06-2009 14:29

Re: Menu problem
 
Use this to add a blank line to the "new menu" system.

PHP Code:

/**
 * Adds a blank line to a menu.
 *
 * @param menu            Menu resource identifier.
 * @param slot            1 (default) if the line should shift the numbering down.
 *                         0 if the line should be a visual shift only.
 * @noreturn
 * @error                Invalid menu resource.
 */
native menu_addblank(menuslot=1); 

PHP Code:

    new menu menu_create("Menu Title:""menu_handler")
    
menu_additem(menu"hi""1"0)
    
menu_additem(menu"bye""2"0)
    
menu_additem(menu"anything""3"0)
    
menu_addblank(menu)
    
menu_additem(menu"lol?""5"0)
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0


One 04-06-2009 14:45

Re: Menu problem
 
TY, TY! & how to menu in menu ?


PHP Code:

register_clcmd"CM_Menu_hi","Level_menu2")


menu_additem(menu"\whi""3"0)


 case 
3:
        { 
            
client_cmd(id"CM_Menu_hi")
            
//return PLUGIN_HANDLED
        


is there a better way?


All times are GMT -4. The time now is 02:23.

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