AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu_destroy (https://forums.alliedmods.net/showthread.php?t=167890)

reinert 09-21-2011 11:27

menu_destroy
 
How to destroy menu correctly, because right now the menu is still seen by players, but if they choose something, nothing happens and menu disappears. I want the menu to disappear after 10seconds.

I've got this:
PHP Code:

new menu

PHP Code:

set_task(10.0"DestroyMenu"id 672

PHP Code:

public DestroyMenu(id)
{
    
menu_destroy(menu)


Can't destroy it via player cmd like this:

client_cmd(id, "slot10"), because I've disabled EXIT option in menu :)

r0ck 09-21-2011 11:33

Re: menu_destroy
 
menu_cancel(id)

Xellath 09-21-2011 11:38

Re: menu_destroy
 
Note that if you set id parameter in set_task to id + 672, and then just directly use the taskid in the called function; it will throw an error.

Done correctly:
Code:
set_task( 10.0, "Function", id + 672 ); public Function( taskid ) {     new id = taskid - 672;     // use id for the client }

r0ck 09-21-2011 11:47

Re: menu_destroy
 
Full Complete Code
PHP Code:

set_task(10.0"DestroyMenu"id 672

public 
DestroyMenu(id)
{
    
id -= 672
    menu_cancel
(id)



Korxu 09-21-2011 11:54

Re: menu_destroy
 
It's the same... He removes 642 from the index, and the result is the player index.

Stereo 09-21-2011 11:56

Re: menu_destroy
 
It's true xd

to close menu:


PHP Code:

show_menu(id0"^n"1


ConnorMcLeod 09-21-2011 12:16

Re: menu_destroy
 
You have to destroy the menu, aka clear memory.
Clean player hud is another thing.

Without your code, it's hard to guess where to add what...

reinert 09-21-2011 12:19

Re: menu_destroy
 
Well I think I already fixed it.

fysiks 09-21-2011 18:00

Re: menu_destroy
 
You need to read the ENTIRE tutorial (or at least be smart about what sections you do read).


All times are GMT -4. The time now is 19:41.

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