AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help with new menu (https://forums.alliedmods.net/showthread.php?t=105194)

alan_el_more 10-02-2009 07:49

Help with new menu
 
Simple:

PHP Code:

for(new 0;sizeof name_weapons1;j++)
        
menu_additem(menuname_all_weapons[get_weaponid(name_weapons1[j])], j

As would be the code if I want to put the item number as j?

Arkshine 10-02-2009 08:57

Re: Help with new menu
 
use num_to_str() for j.

alan_el_more 10-02-2009 09:12

Re: Help with new menu
 
Thanks arkshine, work perfect

alan_el_more 10-03-2009 07:50

Re: Help with new menu
 
Another question to not create another thread:

How do i take the page number?

SnoW 10-03-2009 08:33

Re: Help with new menu
 
Quote:

Originally Posted by alan_el_more (Post 950851)
How do i take the page number?

Explain more.

About the first one, I don't think you even need to pass the num as info since you can just use the item id. Only if you need, you should be able to do:
PHP Code:

new gMenuInfo[ ] = "0123456789";
...
gMenuInfo


larito 10-04-2009 13:31

Re: Help with new menu
 
You can use this native player_menu_info(), here is a example for check what page current some player:

PHP Code:

// Normal menu
public clcmd_test(id)
{
    new 
menu menu_create("Menu Test""menu_test")
    
    
// Items for make page 1 and 2
    
menu_additem(menu"Numero de pag""1")
    
menu_additem(menu"Nada""2")
    
menu_additem(menu"Nada""3")
    
menu_additem(menu"Nada""4")
    
menu_additem(menu"Nada""5")
    
menu_additem(menu"Nada""6")
    
menu_additem(menu"Nada""7")
    
menu_additem(menu"Nada""8")
    
menu_additem(menu"Nada""9")
    
menu_additem(menu"Numero de pag""10")

    
menu_display(idmenu0)
}

public 
menu_test(idmenuitem)
{
    if(
item == MENU_EXIT)
        return 
PLUGIN_HANDLED;
    
    new 
data[6], iname[30], callbackiaccess
    menu_item_getinfo
(menuitemiaccessdata5iname92callback)
    
    
// Variables for store player menu info
    
new oldmenunewmenupage
    
// Get player menu info
    
player_menu_info(idoldmenunewmenupage)
    
    
// Some case
    
switch(str_to_num(data))
    {    
        case 
1:    client_print(idprint_chat"Numero de pag %d"page)
        case 
2..9: return PLUGIN_HANDLED;
        case 
10client_print(idprint_chat"Numero de pag: %d"page)
    }
    return 
PLUGIN_HANDLED


Info: player_menu_info return a some number of page but is page 1 return 0 , 2 return 1....


All times are GMT -4. The time now is 22:40.

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