Raised This Month: $ Target: $400
 0% 

menu_display doesn't works good


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-17-2010 , 04:14   menu_display doesn't works good
Reply With Quote #1

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.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-17-2010 , 05:16   Re: menu_display doesn't works good
Reply With Quote #2

You have to re-create the whole menu with the item changed. Anyway show your code.
__________________
Arkshine is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 08-17-2010 , 12:47   Re: menu_display doesn't works good
Reply With Quote #3

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


Last edited by #8 SickneSS; 08-17-2010 at 13:05.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-09-2010 , 23:40   Re: menu_display doesn't works good
Reply With Quote #4

bump
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-10-2010 , 00:14   Re: menu_display doesn't works good
Reply With Quote #5

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.
__________________
fysiks is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-10-2010 , 00:27   Re: menu_display doesn't works good
Reply With Quote #6

Yes,but I need to show the menu again when the player choice one option,just like the old mute menu.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-10-2010 , 03:33   Re: menu_display doesn't works good
Reply With Quote #7

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

__________________
fysiks is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-10-2010 , 09:17   Re: menu_display doesn't works good
Reply With Quote #8

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.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
tm.
Member
Join Date: Apr 2010
Old 09-10-2010 , 09:57   Re: menu_display doesn't works good
Reply With Quote #9

menu_display(id, menu, page=0) or
player_menu_info(id, &menu, &newmenu, &menupage=0) ?

Last edited by tm.; 09-10-2010 at 09:59.
tm. is offline
#8 SickneSS
BANNED
Join Date: Sep 2008
Location: Here
Old 09-10-2010 , 10:05   Re: menu_display doesn't works good
Reply With Quote #10

Quote:
Originally Posted by tm. View Post
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)

Last edited by #8 SickneSS; 09-10-2010 at 10:10.
#8 SickneSS is offline
Send a message via MSN to #8 SickneSS Send a message via Skype™ to #8 SickneSS
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 11:12.


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