Raised This Month: $32 Target: $400
 8% 

[INC/STOCK] menu_set_timeout


Post New Thread Reply   
 
Thread Tools Display Modes
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-20-2017 , 12:56   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #11

@Emp' That's what I was talking about.
__________________

Last edited by edon1337; 02-20-2017 at 12:56.
edon1337 is offline
addons_zz
Veteran Member
Join Date: Aug 2015
Location: Dreams, zz
Old 02-20-2017 , 13:00   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #12

Quote:
Originally Posted by edon1337 View Post
@Emp' That's what I was talking about.
@Emp' whom? @Emp' is not posting here.
__________________
Plugin: Sublime Text - ITE , Galileo
Multi-Mod: Manager / Plugin / Server

Support me on Patreon, Ko-fi, Liberapay or Open Collective
addons_zz is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 02-20-2017 , 13:03   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #13

........

https://forums.alliedmods.net/showpo...08&postcount=9

Quote:
Last edited by Emp`; Today at 11:56 AM. Reason: added example from WC3FT mod
__________________
edon1337 is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-20-2017 , 13:15   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #14

Emp, that's sneaky. Better just post next time. :p
klippy is online now
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 02-20-2017 , 14:00   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #15

@edon1337 - why would I use enum for just one number? Makes no sense at all. I don't see how this is unnecessary. If you'll want to destroy a menu after X seconds, you will do it like this anyways.

@addons_zz - thanks!
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 02-21-2017 , 00:32   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #16

Simple we don't need stock/include for this
PHP Code:
#define TASK_HIDE 1243
//set task should in menu function
set_task(15.0,"hide_the_menu",id+TASK_HIDE);

public 
hide_the_menu(id)
{
   
id -= TASK_HIDE;
   if(
is_user_connected(id))
  {
    
show_menuid0"^n")
   }
}

public 
client_disconnect(id)
{
 if(
task_exists(id+TASK_HIDE))
  
remove_task(id+TASK_HIDE);

__________________
Thanks everyone. #miss_you_all

Last edited by indraraj striker; 02-21-2017 at 06:48.
indraraj striker is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-21-2017 , 05:16   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #17

It's not that simple. If a player opens another menu in the meantime you'll hide the wrong one.
klippy is online now
indraraj striker
Veteran Member
Join Date: Mar 2014
Location: Under the water
Old 02-21-2017 , 06:46   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #18

KliPPy but set_task will call only hide the menu how its goona wrong ?
i update the code^
__________________
Thanks everyone. #miss_you_all
indraraj striker is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 02-21-2017 , 07:20   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #19

Emp's solution is correct.
https://forums.alliedmods.net/showpo...3&postcount=23
klippy is online now
PRoSToTeM@
Veteran Member
Join Date: Jan 2010
Location: Russia, Ivanovo
Old 02-21-2017 , 14:15   Re: [INC/STOCK] menu_set_timeout
Reply With Quote #20

Quote:
Originally Posted by HamletEagle View Post
Task ids are just numbers, doesn't matter how you save them. That will be decided by plugin's internal design. For example, if you want to index an array by some predefined values enum could be handy.

Example from WC3FT mod, where tasks are separated by player ids:
Code:
#define TASK_ITEMS        0        // Showing items in the HUD
#define TASK_SPAWN        32        // Respawning from revive
#define TASK_ITEM_SCROLL    64        // Respawning after death from an item
#define TASK_VENGEANCE        96        // Respawning from having vengeance (warden ultimate)
...
Can be simplified with an enum:
Code:
enum ( += 32 )
{
    TASK_ITEMS,
    TASK_SPAWN,
    TASK_ITEM_SCROLL,
    TASK_VENGEANCE,
...
Is that real code? TASK_SPAWN + MAX_PLAYERS == TASK_ITEM_SCROLL, or TASK_* is added to playerid-1?
__________________
PRoSToTeM@ is offline
Send a message via ICQ to PRoSToTeM@ Send a message via Skype™ to PRoSToTeM@
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 15:59.


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