Jump to content
Cigs4

Loop and break loop in dedicated

Recommended Posts

Hello gentlemen, I hope you are having a good day.

I have a simple piece of code that I can't get to work on a dedicated server. Could you please point out to me what's wrong?
 

{

 while {true} do { 
 
  if ( vehicle player == truk1 OR currentWeapon player == "" ) then { 
 
  {_x setCaptive true} forEach units (group player) } else { 
 
  {_x setCaptive false} forEach units (group player); break; }; 
 
 }; 
 sleep 3; 

};

As you can see, the idea is that, if a player is inside the vehicle or with the weapon on his back, he is in captive condition, if he decides to use the weapon, the loop breaks and he is no longer captive. That would be it. In fact, it works in the eden editor but not in the dedicated server. I'm running it via trigger, by the way.

I don't have much knowledge of scripting, so that's why I'm asking for your help.
 

Thank you very much in advance.

Share this post


Link to post
Share on other sites

player is not defined on dedicated server

 

If you want to use a trigger make it repeatable , NOT server only, Preset condition: none , none  (so no preset)

 

condition (one working locally on each PC):

vehicle player == truck1 or currentWeapon player == ""

 

on act:

{_x setCaptive true} count units player

 

on deact:

{_x setCaptive false} count units player

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Thanks a LOT, pierremgi !!

this player thing is always tricky for me.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×