AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Menu special id? (https://forums.alliedmods.net/showthread.php?t=209369)

Unkolix 02-24-2013 15:52

Menu special id?
 
Is it possible to add a special menu id or something, so later I could destroy and hide it with this command?
PHP Code:

show_menu(id0"^n"1); 

Or maybe it's possible to check if menu is displayed?

I have this menu:
PHP Code:

new newmenu[64], choise_1[64], choise_2[64], choise_3[64]
format(newmenu64"%L"id"NEW_MENU");
g_iMenu menu_create(newmenu"Pressedrod");
format(choise_164"%L"id"MENU_CHOISE_1");
menu_additem(g_iMenuchoise_1"1"0);
format(choise_264"%L"id"MENU_CHOISE_2");
menu_additem(g_iMenuchoise_2"2"0); 

And I want to destroy and hide it on player death
PHP Code:

RegisterHam(Ham_Killed"player""PlayerDies"1)
/***/
public PlayerDies(id)
{
    if(
get_user_flags(id) & ADMIN_LEVEL_H)
    {
        
show_menu(id0"^n"1);
    }


The problem is that show_menu(id, 0, "^n", 1); destoys all menus...

YamiKaitou 02-24-2013 16:21

Re: Menu special id?
 
You can see if a player is viewing a menu with player_menu_info

Unkolix 02-24-2013 16:42

Re: Menu special id?
 
How should I use that? I can't find out...

ConnorMcLeod 02-24-2013 18:54

Re: Menu special id?
 
PHP Code:

    new iOldMenuIdiNewMenuId
    player_menu_info
(idiOldMenuIdiNewMenuId)
    if( 
iOldMenuId|| iNewMenuId!= -)
    {
    } 


Emp` 02-24-2013 20:20

Re: Menu special id?
 
But because you save g_iMenu, just compare iNewMenuId to g_iMenu.

Unkolix 02-28-2013 16:19

Re: Menu special id?
 
I am using it like this:
PHP Code:

public PlayerDies(id)
{
    
player_menu_info(idg_iMenuiNewMenuId
    if( 
g_iMenu|| iNewMenuId!= -
    { 
        
show_menu(id0"^n"1);
    }


But it still destroys all the menus...

ConnorMcLeod 02-28-2013 17:46

Re: Menu special id?
 
Why The Fuck is g_iMenu a global variable ?

Unkolix 03-01-2013 00:49

Re: Menu special id?
 
Quote:

Originally Posted by ConnorMcLeod (Post 1904098)
Why The Fuck is g_iMenu a global variable ?

I don't know :( Can someone explain me how to do this?

Unkolix 03-15-2013 08:16

Re: Menu special id?
 
Could someone explain me how to do it?

didoWEE 03-15-2013 08:28

Re: Menu special id?
 
show the whole code


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

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