Raised This Month: $ Target: $400
 0% 

set task doesnt want to work.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
SubStream
Veteran Member
Join Date: Aug 2005
Location: USA
Old 03-22-2006 , 15:26  
Reply With Quote #1

black rose.. can you post the correct code for getting a function to loop once every 15 seconds please... to clear things up for me... ty
SubStream is offline
akysiev
Junior Member
Join Date: Mar 2006
Location: Earth
Old 03-22-2006 , 15:34  
Reply With Quote #2

Almost exactly what he wrote.

Code:
 public plugin_init() {     set_task(15.0,"textloop", 0, "", 0, "b") } public textloop() {     client_print(0, print_chat,"If you are seeing this, then it is working.") }

Now textloop executes every 15 seconds.
akysiev is offline
Willmaker
Senior Member
Join Date: Dec 2004
Location: Sydney, Australia
Old 03-22-2006 , 19:30  
Reply With Quote #3

Quote:
Originally Posted by SubStream
Let's say I wanted to repeat something every 15 seconds... would this work?
Code:
public client_prethink () {     new players[32]     new count     get_players ( players[32], count, "ch" )         new i     new name[32]     new id     new playtime     for ( i = 0; i < count; i++ )     {         name[0] = 0         id = players[i]                 get_user_name ( id, name, 17 )         playtime = get_user_time ( id )         store_time = playtime         if(store_time == 15)      {             client_print(0, print_chat,"If you are seeing this, then it is working.")             store_time = 0         }     } }
Would this repeat client_print every 15 seconds?
Just to clear things up, this would not repeat the client_print every 15 secs. Once a player has been on for 15 secs, client_print will be executed anywhere from 5-50times, as you are using client_prethink, and after that moment, nothing will happen.
__________________
GargStudios.net - Australian SvenCoop/Ent Server with Time Based Rewards
Willmaker is offline
Send a message via ICQ to Willmaker Send a message via AIM to Willmaker Send a message via MSN to Willmaker Send a message via Yahoo to Willmaker
[ --<-@ ] Black Rose
ANNIHILATED
Join Date: Sep 2005
Location: Stockholm, Sweden.
Old 03-23-2006 , 01:17  
Reply With Quote #4

Quote:
Originally Posted by akysiev
Almost exactly what he wrote.

Code:
 public plugin_init() {     set_task(15.0,"textloop", 0, "", 0, "b") } public textloop() {     client_print(0, print_chat,"If you are seeing this, then it is working.") }

Now textloop executes every 15 seconds.
no, my WILL execute every 15 sec. _ this means it will use deafult value. wich is "nothing" and "nothing".

Code:
new param[1] param[0] = id set_task( 0.1, "something", 776655+id, param, 1, "a", 285 )
heres a way to use all of the parameters. notice the fourth is not "".
[ --<-@ ] Black Rose is offline
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 03-23-2006 , 01:27  
Reply With Quote #5

Wow, grammar ...

Anywho, this is all you need:
Code:
set_task(15.0 , "my_function" , id , _ , _ , "b");
__________________
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



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


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