Raised This Month: $ Target: $400
 0% 

menu display and destroy


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
GhostMan
Senior Member
Join Date: Jun 2012
Old 04-25-2013 , 15:09   Re: menu display and destroy
Reply With Quote #1

So if it's separated by the teams (Ts see one options and CTs others) so it's dynamical?

One more common question.
Is it correct way to display same menu again after players choise (want to make multiple choises from menu)

PHP Code:
public SomeMenu(id)
{
    new 
menu menu_create("\yNAME OF MENU""menu_handler")
    
    
menu_additem(menu"\wOption 1""1"0)
    
    
menu_additem(menu"\wOption 2""2"0)
    
    
menu_setprop(menuMPROP_EXITMEXIT_ALL)
    
menu_display(idmenu0)
}

public 
menu_handler(idmenuitem)
{
    if(
item == MENU_EXIT || !is_user_alive(id))
    {
        
menu_destroy(menu)
        return 
PLUGIN_HANDLED
    
}
    
    new 
Data[7], Name[64]
    new 
AccessCallback
    menu_item_getinfo
(menuitemAccessData,5Name63Callback)
    
    new 
Key str_to_num(Data)
    
    switch (
Key)
    {
        case 
1:
        {
            
client_print(idprint_chat"Hello !")
            
menu_display(idmenu0)
        }
        
        case 
2:
        {
            
client_print(idprint_chat"Hello !!")
            
menu_display(idmenu0)
        }
        
    return 
PLUGIN_HANDLED

GhostMan is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-25-2013 , 15:18   Re: menu display and destroy
Reply With Quote #2

Code is correct, if you want to show again menu, don't destroy it.
You could add alive check in SomeMenu function though.
__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
GhostMan
Senior Member
Join Date: Jun 2012
Old 04-25-2013 , 15:36   Re: menu display and destroy
Reply With Quote #3

Quote:
Originally Posted by ConnorMcLeod View Post
You could add alive check in SomeMenu function though.
But if player types /menu and he dies when menu still open, then if i would be useing something like give_item in menu_handler i should get some errors becouse of "wrong player index" or something..

Anyways i make both alive check in SomeMenu and menu_handler just to be sure

Last edited by GhostMan; 04-25-2013 at 15:42.
GhostMan is offline
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 10:49.


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