SouthSaturnDelta 1 Posted November 24, 2007 Sad tidings indeed gentlemen. These dirtbag .SQF scripts are making me go coco! I need to detect if the player has a weapon at all times and if so add an action to their menu. I have had a single run version work,but it needs to be looped and I seem to get some error about the sleep command. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">while {alive player} DO { if (player hasweapon "M16") then { MNU = player addaction ["Attach Bayonette","bayonette.sqf"]; } else { player removeaction MNU; }; sleep 0.5; }; Any ideas to help a poor man out? Share this post Link to post Share on other sites
SouthSaturnDelta 1 Posted November 25, 2007 Thanks guys. have it going now as shown below - I thought I'd post it for posperity in case anyone else has a similar problem. <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">handle = [this,"l"] execVM "wombatHandler.sqf" <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Haswombat = 0; while {alive player} DO { if (player hasweapon "wombat")then  {   if ((player hasweapon "wombat")&& (_Haswombat == 0)) then   {     _Haswombat = 1;     _UserR = PLAYER;     MNU = _UserR addaction ["Use Deadly Wombat","wombat detect.sqs"];   }   else   {       }  } else  {  PLAYER = PLAYER;  _Haswombat = 0;  player removeaction MNU;  _UserR removeaction MNU;   }; sleep 0.5; }; Share this post Link to post Share on other sites