takeMS 0 Posted October 24, 2021 how to forbid a player to place mines such as:ATMine,APERS near object example houses or fuel stantion? Share this post Link to post Share on other sites
Ibragim A 148 Posted October 24, 2021 Start by creating an action handler that will disable the mine placement action. Here's an example: inGameUISetEventHandler ["Action", " if (_this select 3 == 'DisAssemble') then { hint 'You are not allowed to do this'; true } "]; Then turn on the processing of this handler only if the player is close to a building or gas station. 1 Share this post Link to post Share on other sites
Ibragim A 148 Posted October 25, 2021 This code in the player's init will disable the use of mines by the player near any building (if the player is within the boundingbox of that building) inGameUISetEventHandler ["Action", " if ( (_this select 3 == 'UseMagazine') && (call { _near = false; _all_buildings = nearestObjects [player, ['house','building'], 50]; if (count _all_buildings == 0) exitWith {_near}; { _box = boundingBox _x; _hypotenuse1 = sqrt (( abs ((_box select 0 select 0)^2))+( abs ((_box select 0 select 1)^2))); _hypotenuse2 = sqrt ((( _box select 1 select 0)^2)+( (_box select 1 select 1)^2)); _hypotenuse = selectMax [_hypotenuse1, _hypotenuse2]; if (player distance2d position _x < _hypotenuse) exitWith { _near = true; }; } forEach _all_buildings; _near; } ) ) then { true } " ]; 1 Share this post Link to post Share on other sites