AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Help please (https://forums.alliedmods.net/showthread.php?t=49923)

mihai_tdog 01-15-2007 18:27

Help please
 
Can anyone tell me how to delay the execution of an instruction in a script just for a few seconds ?Is there a command (like delay() in Borland Pascal) to do that ?I`m a newbie so ....please help.:oops:
Pls mail to [email protected]
thanks a lot

[ --<-@ ] Black Rose 01-15-2007 19:02

Re: Help please
 
Code:
set_task(Float:delay, "function to execute")

Example:
Code:
func() {     set_task(1.0, "func2") } public func2() {     // this is called after 1 second. }

Transfer data from first func:
Code:
func(id) {     new param[3]     param[0] = 'l'     param[1] = 2     param[2] = id     set_task(1.0, "func2", 0, param, 3) } public func2(param[]) {     new c = param[0]     new i = param[1]     new id = param[2] }

Simon Logic 01-16-2007 11:30

Re: Help please
 
mihai_tdog, you should forget about delay/sleep functions within amx/x because HL is a real-time application. Your plugin should work as fast as possible because they are called SEQUENTALLY.

[ --<-@ ] Black Rose 01-16-2007 16:03

Re: Help please
 
That depends on what you wanna do really...
If there were no need for set_task it wouldn't exist.


All times are GMT -4. The time now is 22:25.

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