Raised This Month: $ Target: $400
 0% 

multiple players, one set_task


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
d0g F1R3
New Member
Join Date: Mar 2008
Location: Price is Right showroom.
Old 04-03-2008 , 21:09   multiple players, one set_task
Reply With Quote #1

Im wondering what exactly would happen IF I set three people to the same "set_task" statement. Would that task be performed on all three people? if not what exactly would happen? just a very trivial example shown.

Code:
for(new i = 0; i < 3; i++)
{
players1[i]
set_task(15.0, "user_noclip")
}
 
public user_noclip()
{
set_user_noclip(players1[i], 1)
}
__________________
the cake is a lie.....

Last edited by d0g F1R3; 04-03-2008 at 21:15.
d0g F1R3 is offline
Send a message via MSN to d0g F1R3
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 04-03-2008 , 21:24   Re: multiple players, one set_task
Reply With Quote #2

Code:
// ... new players[32], pnum; get_players(players, pnum); for(new i = 0; i < pnum; i++) {     set_task(15.0, "task_SetNoclip", players[i]); } // ... public task_SetNoclip(id) {     set_user_noclip(id, 1); }

or

Code:
// ... set_task(15.0, "task_SetNoclip"); // ... public task_SetNoclip() {     new players[32], pnum;     get_players(players, pnum);     for(new i = 0; i < pnum; i++)     {         set_user_noclip(players[i], 1);     } }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
d0g F1R3
New Member
Join Date: Mar 2008
Location: Price is Right showroom.
Old 04-03-2008 , 21:34   Re: multiple players, one set_task
Reply With Quote #3

Ok, thanks a lot X.
__________________
the cake is a lie.....
d0g F1R3 is offline
Send a message via MSN to d0g F1R3
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 04-03-2008 , 21:52   Re: multiple players, one set_task
Reply With Quote #4

If you're going to be using multiple tasks at once you want to add a unique task id for each one like so:

Code:
#define TID_ONE 32917 #define TID_TWO 28329 SomeFunc(id) {   set_task(1.0, "MyFunc1", (id + TID_ONE), _, _, "b");   set_task(1.0, "MyFunc2", (id + TID_TWO), _, _, "b");   // so if you're id is 1 the task id would be: 32918 for the first one } public MyFunc1(id) {   id -= TID_ONE;   // id is 32918   // 32918 - TID_ONE = 1 } public MyFunc2(id) {   id -= TID_TWO;   // id is 28330   // 28330 - TID_TWO = 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
d0g F1R3
New Member
Join Date: Mar 2008
Location: Price is Right showroom.
Old 04-03-2008 , 21:58   Re: multiple players, one set_task
Reply With Quote #5

Ok i think i see what you're saying there im gonna give it a try, thanks.
__________________
the cake is a lie.....
d0g F1R3 is offline
Send a message via MSN to d0g F1R3
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 02:08.


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