AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu_display doesn't works good (https://forums.alliedmods.net/showthread.php?t=135526)

#8 SickneSS 08-17-2010 04:14

menu_display doesn't works good
 
Im ussing formatex to change the name of a item in a menu,and ussing menu_display() to open the menu again,but don't change the name of the item...So..how I can make it?
I tried
PHP Code:

if(is_user_connected(id))
       
ShowMenu(id

But I need to show the courrent page of the menu.

Arkshine 08-17-2010 05:16

Re: menu_display doesn't works good
 
You have to re-create the whole menu with the item changed. Anyway show your code.

#8 SickneSS 08-17-2010 12:47

Re: menu_display doesn't works good
 
PHP Code:

public ChatMenuPlayers(id)
{
    new 
menu menu_create("\r[AMXX]\y Chat Mute :","ChatMenu_Handler")
    
    static 
temp[256]
    static 
name[32]
    static 
item[32]
    
    for(new 
1;<= MaxPlayers;i++)
    {
        if(
== id || !is_user_connected(i)) continue;
        
/*|| !is_user_bot(i) || !is_user_hltv(i))*/ 
            
        
get_user_name(i,name,31)
        
num_to_str(i,item,31)
            
        
formatex(temp,255,"%s \y%s\y%s",name,vMuted[id][i] ? "(Voz)" "",cMuted[id][i] ? "(Chat)" "")
        
menu_additem(menu,temp,item)
    }
    
    
menu_display(id,menu)

}
public 
ChatMenu_Handler(id,menu,item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6]
    new 
iName[64]
    new 
Access
    
new Callback
    menu_item_getinfo
(menu,item,Access,iData,5,iName,63,Callback)
    
    new 
Target str_to_num(iData)
    
    switch(
Target)
    {
        case 
MenuPage[id]--
        case 
MenuPage[id]++
        
        default : 
cMuted[id][Target] = !cMuted[id][Target]
    }
    
menu_display(id,menu,MenuPage[id])
    return 
PLUGIN_HANDLED



#8 SickneSS 09-09-2010 23:40

Re: menu_display doesn't works good
 
bump

fysiks 09-10-2010 00:14

Re: menu_display doesn't works good
 
http://forums.alliedmods.net/showthread.php?t=46364

You don't need to do anything for pages. Destroy the menu at the end of the handler.

#8 SickneSS 09-10-2010 00:27

Re: menu_display doesn't works good
 
Yes,but I need to show the menu again when the player choice one option,just like the old mute menu.

fysiks 09-10-2010 03:33

Re: menu_display doesn't works good
 
Do this:
PHP Code:

public ChatMenu_Handler(id,menu,item)
{
    if(
item == MENU_EXIT)
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
iData[6]
    new 
iName[64]
    new 
Access
    
new Callback
    menu_item_getinfo
(menu,item,Access,iData,5,iName,63,Callback)
    
    new 
Target str_to_num(iData)
    
cMuted[id][Target] = !cMuted[id][Target]
    
    
menu_destroy(menu)
    
ChatMenuPlayers(id)
    return 
PLUGIN_HANDLED



#8 SickneSS 09-10-2010 09:17

Re: menu_display doesn't works good
 
Yes,but the menu must have more than 1 page,and when the I use menu_display in the called function,this will be show the page 1,and I want to show the current page.

tm. 09-10-2010 09:57

Re: menu_display doesn't works good
 
menu_display(id, menu, page=0) or
player_menu_info(id, &menu, &newmenu, &menupage=0) ?

#8 SickneSS 09-10-2010 10:05

Re: menu_display doesn't works good
 
Quote:

Originally Posted by tm. (Post 1296380)
menu_display(id, menu, page=0) or
player_menu_info(id, &menu, &newmenu, &menupage=0) ?

I didn't know that of player_menu_info(),but how with menu_display() I used an array to get the page.Can you explain me how to use player_menu_info() ?...Because I don't know what I can put in (,.&newmenu)


All times are GMT -4. The time now is 21:52.

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