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

Timer Help


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Unreal1
AlliedModders Donor
Join Date: Dec 2010
Old 06-23-2012 , 13:06   Timer Help
Reply With Quote #1

I want to create a timer that runs every 5 min (300 sec). However, I'm confused as how to use the TIMER_FLAG_NO_MAPCHANGE flag. I basically want to execute a command every 5 minutes from when the server first starts and I don't want to ave te timer cleared because of a map change. So how would I do this?
Unreal1 is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 06-23-2012 , 13:24   Re: Timer Help
Reply With Quote #2

Quote:
Originally Posted by Unreal1 View Post
I want to create a timer that runs every 5 min (300 sec). However, I'm confused as how to use the TIMER_FLAG_NO_MAPCHANGE flag. I basically want to execute a command every 5 minutes from when the server first starts and I don't want to ave te timer cleared because of a map change. So how would I do this?
Pass just the TIMER_REPEAT flag in the flags argument.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Chiz
Junior Member
Join Date: Jun 2012
Location: United States
Old 06-23-2012 , 16:36   Re: Timer Help
Reply With Quote #3

Code:
CreateTimer(300.0, YourFunctionHere, _, TIMER_REPEAT);
Check if the timer has repeated and if it has, run the desired code. And to start the timer automatically after a map change, just stick it in OnMapStart(). You could also include a small bit of code to prehook round_end and kill the timer in order to avoid errors.

Last edited by Chiz; 06-23-2012 at 16:43.
Chiz is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 06-23-2012 , 23:17   Re: Timer Help
Reply With Quote #4

(TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE)
__________________
11530 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 06-23-2012 , 23:50   Re: Timer Help
Reply With Quote #5

Quote:
Originally Posted by 11530 View Post
(TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE)
He doesn't want TIMER_FLAG_NO_MAPCHANGE.
__________________
Dr. McKay is offline
Reply



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 14:44.


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