Jump to content
Sign in to follow this  
Gonobob

start and stop script from 1 button

Recommended Posts

Hi all,

I have a problem)

I need to start and stop script executing when i bress one button on keyboard.

if (_dikCode == 0x0D) then 
{		
_nill = execvm "player_do.sqf";
};

and player_do.sqf;

while {true} do {
player playMove "";
sleep .1;
};

its working, but i need:

press button = start hint infinitely

press second time = stop player_do.sqf

Thanks))

Edited by Gonobob

Share this post


Link to post
Share on other sites

Put this anywhere BEFORE you add the displayEventHandler:

player_do_active = false;

Now you change your handler to this:

if (_dikCode == 0x0D) then 
{
   player_do_active = !player_do_active;
   if (player_do_active) then 
   {     
        execVm "player_do.sqf";
   };
};  

and finally change your sqf's content to this:

if (isNil "player_do_active") then {
   player_do_active = false;
};
while {player_do_active} do {
player playMove "";
sleep .1;
};  

Et voilà :D

Share this post


Link to post
Share on other sites

Big Thanks!!!

i did it :)

Edited by Gonobob

Share this post


Link to post
Share on other sites

i have another question )

Can i create parameter in mpmission like

units = ["1","2","3"];

and get this "units" in my addon?

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  

×