Jump to content
Sign in to follow this  
Naiss

how to change from while {true} to false?

Recommended Posts

okey so i got a script file that run on the server but i want it to stop at some time

While {true} do {
   hint "test";
   sleep 10;
   hint "hello
i want to swich the true to false here, becuase i got an admin tool that can start it again so please help me here to make it stop there

please help me here

Share this post


Link to post
Share on other sites

I think you have to add the definition of true first like this:

_something = true;

and then you change your code to while {_something} do.

And make chack every x sec.

If you do not the loop then toy can use if - else instead of while

Share this post


Link to post
Share on other sites

okey thanks for the answer i will try this

---------- Post added at 23:12 ---------- Previous post was at 21:29 ----------

okey so when i got a script while running with while true i want a new script file that can stop that while true and make that script file stop

Share this post


Link to post
Share on other sites

Basically the same, only you need to use a global variable:

hello.sqf

myGlobalVariable = true;

While {myGlobalVariable == true} do {
   hint "test";
   sleep 10;
   hint "hello";
}

else

{
   hint "goodbye";
};

goodbye.sqf

myGlobalVariable = false;

Or something like that.

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
Sign in to follow this  

×