Raised This Month: $ Target: $400
 0% 

[SOLVED]Menu problem


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 14:29   Re: Menu problem
Reply With Quote #1

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
__________________

Last edited by fysiks; 04-06-2009 at 14:39.
fysiks is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-06-2009 , 14:45   Re: Menu problem
Reply With Quote #2

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?
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 15:04   Re: Menu problem
Reply With Quote #3

PHP Code:
DisplayMenu1(id)
{
    
// ... Make Menu 1
}
HandleMenu1(idmenuitem)
{
    switch(
key)
    {
        case 
#:
        
{
            
menu_destroy(menu)
            
DisplayMenu2(id)
        }
        
// ...
    
}
}
DisplayMenu2(id)
{
    
// ... Make Menu 2
}
HandleMenu2(idmenuitem)
{
    
// ... Handle Menu 2 with option ("Back") to open menu 1
    
switch(key)
    {
        case 
#:
        
{
            
menu_destroy(menu)
            
DisplayMenu1(id)
        }
        
// ...
    
}

You could even use one handler if you want, send data "##" (first number is your menu number and second number is item number). Then you could use a single switch or a nested switch if you break apart the digits (first switch for menu number and nested switch for item number). I don't know if any of this is efficient but It may be worth a try.
__________________

Last edited by fysiks; 04-06-2009 at 15:12.
fysiks is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-06-2009 , 15:08   Re: Menu problem
Reply With Quote #4

hihi. Ty.

now the biggest problem.

code in case 1 has no effect but i tested the code & this works fine alone.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 04-06-2009 , 15:11   Re: Menu problem
Reply With Quote #5

I updated my last post while you were posting btw.

For your third problem: is it a menu problem or a problem with code within "case 1:"?
__________________
fysiks is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-06-2009 , 15:16   Re: Menu problem
Reply With Quote #6

PHP Code:
  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;
        

i can choose in the menu but the code in case1 has no effect. i can move normal.i become just client_print.

PHP Code:
 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; 
his code has no effect in case1
answer: menu works perfect. its a problem whitin case 1
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 04-06-2009 , 15:18   Re: Menu problem
Reply With Quote #7

About the code that fysiks gave you, if you're going to show the menu a lot of times and/or to a lot of players, you should create the menus at plugin_init() or plugin_cfg() with global menus variables and display them when the correct number is pressed.
This should be done to prevent creating the menu over and over and thus reducing efficiency.
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-06-2009 , 15:19   Re: Menu problem
Reply With Quote #8

Quote:
Originally Posted by Dores View Post
About the code that fysiks gave you, if you're going to show the menu a lot of times and/or to a lot of players, you should create the menus at plugin_init() or plugin_cfg() with global menus variables and display them when the correct number is pressed.
This should be done to prevent creating the menu over and over and thus reducing efficiency.
damn now its to high for me.
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
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 02:23.


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