AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Timed function call (https://forums.alliedmods.net/showthread.php?t=128895)

garthfield 06-06-2010 16:01

Timed function call
 
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.

Kryzu 06-06-2010 16:05

Re: Timed function call
 
set_task
http://www.amxmodx.org/funcwiki.php?...task&go=search

GXLZPGX 06-06-2010 16:10

Re: Timed function call
 
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.

garthfield 06-06-2010 16:10

Re: Timed function call
 
perfect

fysiks 06-06-2010 17:16

Re: Timed function call
 
Quote:

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

:arrow:

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).


All times are GMT -4. The time now is 05:15.

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