Raised This Month: $ Target: $400
 0% 

Delay within a function?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Des12
Senior Member
Join Date: Jan 2005
Old 01-01-2006 , 18:57   Delay within a function?
Reply With Quote #1

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.
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 01-01-2006 , 19:55  
Reply With Quote #2

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]; }
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Des12
Senior Member
Join Date: Jan 2005
Old 01-01-2006 , 20:02  
Reply With Quote #3

Wow. Stop posting here and go code for nasa.
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
Brad
AMX Mod X Team Member
Join Date: Jun 2004
Old 01-01-2006 , 20:16  
Reply With Quote #4

Yeah, because that's rocket science!
Brad is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 01-01-2006 , 20:18  
Reply With Quote #5

Quote:
Originally Posted by Des12
Wow. Stop posting here and go code for nasa.
I think I just might do that ;)
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Des12
Senior Member
Join Date: Jan 2005
Old 01-01-2006 , 21:20  
Reply With Quote #6

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?
__________________
-Dest Romano

www.JustRP.com
A TSRP Server

Quote:
Originally Posted by Brad
Don't you go be bringing reality into this.
Des12 is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 01-01-2006 , 21:31  
Reply With Quote #7

Well, you can't pass two id's that way.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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