AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Delay within a function? (https://forums.alliedmods.net/showthread.php?t=22686)

Des12 01-01-2006 18:57

Delay within a function?
 
I am trying to do a three second delay, but I do not want to use set_task because I am handling two id's...

So I tried

Code:
for(i = 0; i < 30000; i++) {         if(i == 29999}             break; }

I don't think I need the break code, but anyways I think that will give me a 3 second delay, but the question is will it lag the server much? In my experiance, 10000 counts is approximate to 1 second.

v3x 01-01-2006 19:55

Why not do this?
Code:
new pstr[2]; pstr[0] = firstid; pstr[1] = secondid; set_task(3.0, "myfunc", _, pstr, 2);
Code:
public myfunc( pstr[] ) {   new id1 = pstr[0];   new id2 = pstr[1]; }

Des12 01-01-2006 20:02

Wow. Stop posting here and go code for nasa.

Brad 01-01-2006 20:16

:lol: Yeah, because that's rocket science! :lol:

v3x 01-01-2006 20:18

Quote:

Originally Posted by Des12
Wow. Stop posting here and go code for nasa.

I think I just might do that ;)

Des12 01-01-2006 21:20

Quote:

Originally Posted by v3x
Why not do this?
Code:
new pstr[2]; pstr[0] = firstid; pstr[1] = secondid; set_task(3.0, "myfunc", _, pstr, 2);
Code:
public myfunc( pstr[] ) {   new id1 = pstr[0];   new id2 = pstr[1]; }

\

but wouldnt it be

set_task(3.0, "myfunc", pstr, _ , 2);

because pstr is the id? and the _ means skip right?

and in this:
set_task(3.0, "myfunc", _, pstr, 2)
the pstr is just the data being sent?

v3x 01-01-2006 21:31

Well, you can't pass two id's that way.


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

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