Raised This Month: $12 Target: $400
 3% 

menu for x secondes


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-17-2017 , 10:13   menu for x secondes
Reply With Quote #1

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.
yas17sin is offline
Send a message via ICQ to yas17sin
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-17-2017 , 10:15   Re: menu for x secondes
Reply With Quote #2

Set a task when menu is displayed, use menu_destroy when 20 seconds have passed.
__________________
edon1337 is offline
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-17-2017 , 12:00   Re: menu for x secondes
Reply With Quote #3

You should use a global variable for do it.
__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo
EFFx is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-17-2017 , 13:35   Re: menu for x secondes
Reply With Quote #4

If you're using AMXX 1.8.3, there's no need for any of that.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-17-2017 , 13:56   Re: menu for x secondes
Reply With Quote #5

@OciXCrom, no i am using AMXX 1.8.2

Last edited by yas17sin; 02-17-2017 at 14:13. Reason: nvm
yas17sin is offline
Send a message via ICQ to yas17sin
EFFx
Veteran Member
Join Date: Feb 2016
Location: São Paulo, Brasil
Old 02-17-2017 , 14:07   Re: menu for x secondes
Reply With Quote #6

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)

__________________
• Ranking System • AutoMix 5vs5 System
• Web Ban System • Plugins for free

____________________________________________
For private works:
• Discord: EFFEXo#8850 • Steam: EFFEXo

Last edited by EFFx; 02-17-2017 at 14:11.
EFFx is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-17-2017 , 14:13   Re: menu for x secondes
Reply With Quote #7

i already have menu any other way to do this without update all of it.

Last edited by yas17sin; 02-17-2017 at 14:24. Reason: big mistake sorry.
yas17sin is offline
Send a message via ICQ to yas17sin
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-17-2017 , 15:36   Re: menu for x secondes
Reply With Quote #8

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.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-17-2017 , 15:55   Re: menu for x secondes
Reply With Quote #9

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.
klippy is offline
yas17sin
Veteran Member
Join Date: Oct 2016
Location: Morocco/Sale
Old 02-17-2017 , 16:01   Re: menu for x secondes
Reply With Quote #10

i just want the menu to show for only period of time from the begin of new round.:/
yas17sin is offline
Send a message via ICQ to yas17sin
Reply


Thread Tools
Display Modes

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 11:57.


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