AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to call function every second? (https://forums.alliedmods.net/showthread.php?t=154472)

KviZ 04-09-2011 05:04

How to call function every second?
 
I know it's something about set_task.
I found this, but I don't understand a few things.
set_task ( Float:time, const function[], id = 0, parameter[]="", len = 0, flags[]="", repeat = 0 )

1. Where do I need to put id if I want to make the function repeat on server and not bind on some player?
2. What is a "parameter" and "len" in set_task?

Thanks

reinert 04-09-2011 05:19

Re: How to call function every second?
 
set_task(1.0, "function",_, _, _, "b")

KviZ 04-09-2011 05:21

Re: How to call function every second?
 
Thanks

schmurgel1983 04-09-2011 09:08

Re: How to call function every second?
 
Quote:

Originally Posted by KviZ (Post 1446380)
2. What is a "parameter" and "len" in set_task?

sample:
PHP Code:

// store Parameters
static param[2]
param[0] = weapon
param
[1] = id

// Set task with params
set_task(1.0"sample"_param2)



public 
sample(param[2])
{
    
// param[0] = weapon
    // param[1] = client
    
    
new weapon param[0]
    new 
id param[1]


so u can work with multi vars stored in one set_task


All times are GMT -4. The time now is 19:47.

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