Raised This Month: $ Target: $400
 0% 

setting a delay before next line in function is called


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Rorthic
Junior Member
Join Date: Apr 2005
Old 05-23-2005 , 02:04   setting a delay before next line in function is called
Reply With Quote #1

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?
Rorthic is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 05-23-2005 , 02:12  
Reply With Quote #2

set_task
__________________
Plugins:
none

n0obie4life is offline
Rorthic
Junior Member
Join Date: Apr 2005
Old 05-23-2005 , 21:50  
Reply With Quote #3

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
Rorthic is offline
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 05-24-2005 , 02:15  
Reply With Quote #4

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

you have to use something like

end_task . search the funcwiki.
__________________
Plugins:
none

n0obie4life is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 05-24-2005 , 13:41  
Reply With Quote #5

Code:
set_task(30.0,"my_func",56+id,_,1)
Code:
if(task_exists(56+id))     remove_task(56+id)
__________________
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
n0obie4life
Veteran Member
Join Date: Dec 2004
Old 05-25-2005 , 05:06  
Reply With Quote #6

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..
__________________
Plugins:
none

n0obie4life is offline
Reply



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:39.


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