Raised This Month: $ Target: $400
 0% 

Timed function call


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
garthfield
Junior Member
Join Date: Apr 2010
Location: London
Old 06-06-2010 , 16:01   Timed function call
Reply With Quote #1

Is it possible to have a function executed at a given time interval ? I want to execute some code every 20 seconds, it's non event stuff.
garthfield is offline
Kryzu
Senior Member
Join Date: Feb 2009
Old 06-06-2010 , 16:05   Re: Timed function call
Reply With Quote #2

set_task
http://www.amxmodx.org/funcwiki.php?...task&go=search
__________________
Kryzu is offline
garthfield
Junior Member
Join Date: Apr 2010
Location: London
Old 06-06-2010 , 16:10   Re: Timed function call
Reply With Quote #3

perfect
garthfield is offline
GXLZPGX
Veteran Member
Join Date: Sep 2009
Old 06-06-2010 , 16:10   Re: Timed function call
Reply With Quote #4

in plugin_init()

add:

set_task(20.0, "functiontoexecute", 0, _, 1 , "b");

Change functiontoexecute to whatever the function is that you want to execute every 20 seconds.
__________________
Currently accepting payment US DOLLARS ONLY for custom plugins, contact me through PM.
GXLZPGX is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 06-06-2010 , 17:16   Re: Timed function call
Reply With Quote #5

Quote:
Originally Posted by GXLZPGX View Post
set_task(20.0, "functiontoexecute", 0, _, 1 , "b");


Code:
set_task(20.0, "functiontoexecute", _, _, _, "b");
Also, if you ever need to stop the task you will need to define the third paramter (a unique identifier; integer).
__________________
fysiks is offline
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 05:15.


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