Icaruk 14 Posted June 7, 2014 (edited) init.sqf null = [player] execVM "script.sqf"; script.sqf _caller = _this select 0; while {true} do { if ((_caller distance center) > 45) then { // when someone is far away from the center, he will be vulnerable _caller allowdamage true; waitUntil {((_caller distance center) < 45)}; _caller allowdamage false; }; if ((_caller distance center) < 45) then { _caller allowdamage false; waitUntil {((_caller distance center) > 45)}; // when someone is near the center, he will be immune _caller allowdamage true; }; sleep 5; }; The idea is that the script works just to the player that is near the centre, not to all players on map, but the problem is that _caller is not defined, on local it works nice, but on multiplayer doesn't... any ideas? Edited June 8, 2014 by Icaruk Share this post Link to post Share on other sites
champ-1 40 Posted June 8, 2014 (edited) It needs some time for player initialization, add this in the begining: waitUntil {!isNull _caller}; Edited June 8, 2014 by Champ-1 Share this post Link to post Share on other sites
Icaruk 14 Posted June 8, 2014 waitUntil (player == player); Could work too? Share this post Link to post Share on other sites
cuel 25 Posted June 8, 2014 It's the same thing. "player" will be a null object on JiPs until they've been loaded, so you're basically writing this: waitUntil {objNull == objNull}; Which will be false because null doesn't equal anything, not even itself. Once the "player" object has been initalized and assigned the waitUntill will continue because then you're checking if some object equals the same object. I prefer the "!isNull player" approach, it makes it easier to read. Also "script".sqf; Typo I presume Share this post Link to post Share on other sites
terox 316 Posted June 8, 2014 add and remove a handledamage eventhandler Share this post Link to post Share on other sites
Icaruk 14 Posted June 8, 2014 It's the same thing."player" will be a null object on JiPs until they've been loaded, so you're basically writing this: waitUntil {objNull == objNull}; Which will be false because null doesn't equal anything, not even itself. Once the "player" object has been initalized and assigned the waitUntill will continue because then you're checking if some object equals the same object. I prefer the "!isNull player" approach, it makes it easier to read. Also "script".sqf; Typo I presume Yeah, typo xD I'll test this, thanks. Share this post Link to post Share on other sites