AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   menu for x secondes (https://forums.alliedmods.net/showthread.php?t=294006)

yas17sin 02-17-2017 10:13

menu for x secondes
 
Hi all.

Can someone show me a way to make a menu show up only for x secondes then it disppear.

Example : when new round begin the menu will show up only for 20 secondes and then it will be disppear until next round.

edon1337 02-17-2017 10:15

Re: menu for x secondes
 
Set a task when menu is displayed, use menu_destroy when 20 seconds have passed.

EFFx 02-17-2017 12:00

Re: menu for x secondes
 
You should use a global variable for do it.

OciXCrom 02-17-2017 13:35

Re: menu for x secondes
 
If you're using AMXX 1.8.3, there's no need for any of that.

yas17sin 02-17-2017 13:56

Re: menu for x secondes
 
@OciXCrom, no i am using AMXX 1.8.2

EFFx 02-17-2017 14:07

Re: menu for x secondes
 
Oh god, I'm in phone but let's GO:

PHP Code:

new g_Menu

const TASK_MENU 72735292 

PHP Code:

      g_Menu menu_create("Your menu tittle""menu_handler")

      
menu_additem(g_Menu"Item 1")

      
menu_display(idg_Menu)
      
      if(!
task_exists(id+TASK_MENU))
             
set_task(20.0"menuDestroy"id+TASK_MENU

PHP Code:

public menu_handler(idmenuitem)
{
      
menu_destroy(g_Menu)
      
remove_task(id+TASK_MENU)


PHP Code:

public menuDestroy(id)
{
      
menu_destroy(g_Menu)

      
id -= TASK_MENU
      remove_task
(id+TASK_MENU)



yas17sin 02-17-2017 14:13

Re: menu for x secondes
 
i already have menu any other way to do this without update all of it.

OciXCrom 02-17-2017 15:36

Re: menu for x secondes
 
I don't see how that would work. What will happen if 2 players open the menu at once? Same global variable, menu will get destroyed when the timer for the first player is over.

klippy 02-17-2017 15:55

Re: menu for x secondes
 
You want to show an empty menu to hide the previously shown one, destroying a menu object doesn't do what you are expecting it to.

yas17sin 02-17-2017 16:01

Re: menu for x secondes
 
i just want the menu to show for only period of time from the begin of new round.:/


All times are GMT -4. The time now is 17:02.

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