This very useful script when placed in the initPlayerLocal.sqf file will protect a base from придурки who are firing into your base and destroying everything.
player addEventHandler ["FiredMan", { _p = _this select 6; if( _p distance (getMarkerPos "respawn_west") < 1000) then { deleteVehicle _p; } else { _p spawn { waitUntil { if( _this distance (getMarkerPos "respawn_west") < 1000 )then { deleteVehicle _this; }; if ( isNull _this ) exitWith { true }; false }; }; }; }]; |
This script just deletes the rounds as they get close to your base, this means that they cannot destroy your base and wreck everything.
Here is another example, place an invisible marker named “safezone” and then put this code in initPlayerLocal.sqf.
player addEventHandler ["FiredMan", { _p = _this select 6; if( _p distance (getMarkerPos "safezone") < 1100) then { deleteVehicle _p; } else { _p spawn { waitUntil { if( _this distance (getMarkerPos "safezone") < 1100 )then { deleteVehicle _this; }; if ( isNull _this ) exitWith { true }; false }; }; }; }]; |
Yet another variant. This is hardcoding the position of an object to define the center of the base, this prevents malicious players moving the marker with scripting to allow them to destroy your base again.
player addEventHandler ["FiredMan", { _p = _this select 6; if( _p distance [11931.5,2311.61] < 1100) then { deleteVehicle _p; } else { _p spawn { waitUntil { if( _this distance [11931.5,2311.61] < 1100 )then { deleteVehicle _this; }; if ( isNull _this ) exitWith { true }; false }; }; }; }]; |
This very useful script should help you out when trying to protect your base from trolls. You do not need to print a warning, just silently protect your base and stop griefing and trolling before it takes hold.