AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   setting a delay before next line in function is called (https://forums.alliedmods.net/showthread.php?t=13618)

Rorthic 05-23-2005 02:04

setting a delay before next line in function is called
 
ok i need to set a delay before the next line is called, i tried using a loop with a high number, didnt seem to affect it. this is my code

Code:
ns_set_exp(id, (ns_get_exp(id) + 1000)) client_cmd(id, "impulse 114")   //change to gorge // need a delay here ns_set_exp(id,(ns_get_exp(id) - 1000))

without the delay the line after the comment gets executed before the client_cmd. Making the client_cmd never execute.

i tried this as a delay with no luck
Code:
for (i = 1; i <= 30000; i++) { //just a delay }

tried 300000 in there too still nothing.

any way to cause a delay?

n0obie4life 05-23-2005 02:12

set_task

Rorthic 05-23-2005 21:50

so something like this? havent tried it yet, just wondering if this is what you meant

Code:
set_task(30.0, "replaceXP") public replaceXP(id) { ns_set_exp(id,(ns_get_exp(id) - 1000)) }

so does the task only fire once or do i need to stop the task with another command? im guessing it does only fire once since the repeat flag isnt there. So to get the task to repeat you set it like this?

Code:
set_task(30.0, "xpbalance", a, 10)

if i understand it right it will repeat 10 times then stops?

*EDIT fixed typo

n0obie4life 05-24-2005 02:15

yeah, that way is correct. but public is spelt PUBLIC not PIBLIC.

you have to use something like

end_task . search the funcwiki.

v3x 05-24-2005 13:41

Code:
set_task(30.0,"my_func",56+id,_,1)
Code:
if(task_exists(56+id))     remove_task(56+id)

n0obie4life 05-25-2005 05:06

Quote:

Originally Posted by v3x
Code:
set_task(30.0,"my_func",56+id,_,1)
Code:
if(task_exists(56+id))     remove_task(56+id)

v3x is da genius..


All times are GMT -4. The time now is 16:39.

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