Raised This Month: $ Target: $400
 0% 

[menu]need help with custom menu


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
SonicSonedit
Veteran Member
Join Date: Nov 2008
Location: Silent Hill
Old 03-25-2009 , 08:20   Re: [menu]need help with custom menu
Reply With Quote #2

1) create new menu
PHP Code:
new playerlistmenu menu_create("Player list","playerlistmenu_handle"
2) add menu items (players)
PHP Code:
for (new 1i<g_maxplayersi++)
    if (
is_user_alive(i))
        
menu_additem(playerlistmenuget_user_name(i), num_to_str(i)); 
3) show menu
PHP Code:
menu_display(idplayerlistmenu0); 
Now, when player chooses any item (except for next/previous and exit) playerlistmenu_handle will be called. so:

PHP Code:
public playerlistmenu_handle(idmenuitem)
{
    
menu_destroy(playerlistmenu); //destroy old menu
    
new cmd[32]; 
    new 
accesscallback//tempvar, unused
    
menu_item_getinfo(menuitemaccesscmd,2,_,_callback); //put selected player id in cmd
    
new selectedplayerid str_to_num(cmd);
    
    if (!
is_user_alive(selectedplayerid)) return PLUGIN_HANDLED;
    
    
//do whatever now

Not tested, but should work.
__________________


Last edited by SonicSonedit; 03-25-2009 at 08:31.
SonicSonedit is offline
 



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 08:55.


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