AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Old menu problem (https://forums.alliedmods.net/showthread.php?t=147891)

reinert 01-15-2011 11:26

Old menu problem
 
Hey, why the hell when I open menu number 1 (Keysrod1 ...), and I press any key, it opens the Pressedrod of menu number 0...

Here is my code:

PHP Code:

#define Keysrod (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9)
#define Keysrod1 (1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<5)|(1<<6)|(1<<7)|(1<<8)|(1<<9) 

PHP Code:

    register_menucmd(register_menuid("rod"), Keysrod"Pressedrod");
    
register_menucmd(register_menuid("rod1"), Keysrod1"Pressedrod1"); 

PHP Code:

public Showrod(id){
    
show_menu(idKeysrod"\wColor explanation:^n\y'n*' - normal color text ( depends on con_color )^n't*' - team color text ( depends on team )^n'g*' - green text color^n\wWelcome message example: g*Hello t*boys n*and t*girls", -1"rod");
}
public 
Pressedrod(idkey) {
    switch (
key) {
        default: 
        {
            
client_cmd(id"speak sound/confirmed0" );
            
WelmsgMenu(id);
        }
    }


PHP Code:

public Showrod1(id){
    new list[
256];
    new 
vipnames[33][33];
    new 
count;
    new 
x;
    new 
msg[256], iLen;
    
    for(
1<= 33x++){
    if(
is_user_connected(x))
        if(
iVip[id] == 1)
        
get_user_name(xvipnames[count++], 32);
    }
    
    if(
count == 0)
    {
    
formatex(list, 255"\yNo admins online");
    }
    else
    {
    for(new 
count i++) {
    
iLen += format(msg[iLen], 255-iLen"\w%s^n"vipnames[i]);
    }
    
formatex(list, 255"\wAdmins online \y[ \w%d\y ]\w:^n%s"countmsg);
    
show_menu(idKeysrod1, list, -1"rod1");
    }
}
public 
Pressedrod1(idkey) {
    switch (
key) {
        default: 
        {
        
        }
    }
    return 
PLUGIN_CONTINUE;


When I open the menu with admin list, then press any key the pressed key affects to pressedrod menu ... and it opens me WelmsgMenu...

ConnorMcLeod 01-15-2011 12:12

Re: Old menu problem
 
I don't understand what you are asking, you may have a look at plugins such as playermenu of telemenu, such menus are used.

It seems that you don't take key in account in callback, you have only default switch case.

Sylwester 01-15-2011 12:41

Re: Old menu problem
 
You registered menu in a wrong way. Try this:
PHP Code:

    register_menucmd(register_menuid("\wColor exp"), Keysrod"Pressedrod");
    
register_menucmd(register_menuid("\wAdmins online"), Keysrod1"Pressedrod1"); 


ConnorMcLeod 01-15-2011 12:42

Re: Old menu problem
 
I hadn't see this, also you don't need to put \w in the register line, just a part of the begining of menu string.
For such a menu, why don't you use new menu system ?

reinert 01-15-2011 13:12

Re: Old menu problem
 
Because I don't know how to make a list with new menu :/

Also, when I make a new style menu only with title, the menu doesn't even show up :/

GXLZPGX 01-15-2011 15:18

Re: Old menu problem
 
Quote:

Originally Posted by reinert (Post 1394231)
Because I don't know how to make a list with new menu :/

Also, when I make a new style menu only with title, the menu doesn't even show up :/

You obviously don't know how to use the OLD menu style either, and the old menu style is much more complicated.

reinert 01-15-2011 15:42

Re: Old menu problem
 
yeah, I prefer to use new, but new menu doesn't work without any items in menu and menu_addtext doesn't help :s

ConnorMcLeod 01-15-2011 15:51

Re: Old menu problem
 
Why do you want an item if no admin is online ?
Also, if no admin are online, why don't add an item with some admin access so player will only see the text and won't be able to select that item ?

Len 01-15-2011 15:56

Re: Old menu problem
 
why are you telling what to do with the plugin he wants to make, he just wants help with the menu

ConnorMcLeod 01-15-2011 16:17

Re: Old menu problem
 
Quote:

Originally Posted by Len (Post 1394362)
why are you telling what to do with the plugin he wants to make, he just wants help with the menu

Why don't you help him ?


All times are GMT -4. The time now is 01:55.

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