Jump to content
  • 0

Unlock vehicles left in safe zones


BetterDeadThanZed

Question

3 answers to this question

Recommended Posts

  • 0

Is there a script that would unlock vehicles that are left in a safe zone upon server restart? We seem to be having a problem with a lot of people leaving their vehicles in the traders, clogging up access.

 

I whipped this up really fast for you. Give it a test and see if it works. It should, but seeing as I haven't slept yet and it is 8AM I can't guarantee there is no error. If it does work for you please let me know so I can release it.

 

Save script as safeZoneVehicleUnlocker.sqf

Put it wherever you like

 

I believe it you should call it at the bottom of the if(is Server) block : [] execVM "(dir)\safeZoneVehicleUnlocker.sqf"

 

Currently set to work with default traders.

 

private ["_safeZones","_center","_radius","_vehicles"];
_safeZones = [
	[[11447.91,11364.536],100],  // Klen
	[[4064.2258,11665.938],100], // Bash
	[[6325.6772,7807.7412],100]  // Stary	
];

{
	_center = _x select 0;
	_radius = _x select 1;
	_vehicles = nearestObjects [_center,["LandVehicle","Air","Ship"],_radius];
	{
		if (_x isKindOf "LandVehicle" || _x isKindOf "Air" || _x isKindOf "Ship") then {

			{player removeAction _x} forEach s_player_lockunlock;s_player_lockunlock = [];
			s_player_lockUnlock_crtl = 1;

			PVDZE_veh_Lock = [_x,false];
			
			if (local _x) then {
				PVDZE_veh_Lock spawn local_lockUnlock
			} else {
				publicVariable "PVDZE_veh_Lock";
			};

			s_player_lockUnlock_crtl = -1;
		};
	} forEach _vehicles;
} forEach _safeZones;

Link to comment
Share on other sites

  • 0

Open up dayz_server\system\server_monitor.sqf

 

Find this block:

if (!_wsDone) then {
			if (count _worldspace >= 1) then { _dir = _worldspace select 0; };
			_pos = [getMarkerPos "center",0,4000,10,0,2000,0] call BIS_fnc_findSafePos;
			if (count _pos < 3) then { _pos = [_pos select 0,_pos select 1,0]; };
			diag_log ("MOVED OBJ: " + str(_idKey) + " of class " + _type + " to pos: " + str(_pos));
		};

After that code paste this code:

{
		if ((_pos distance _x) < 100) then {
			if (_damage > 0.1) then {
				_damage = 1;
				[_idKey,false,"SERVER"] call server_deleteObj;
				diag_log format["DELETING SAFEZONE VEHICLE: %1", [_idKey, _type]];
				};
			_ownerID = "0";
			};
		} forEach [[4361,2259],[13532.614,6355.9497],[7989.3354,2900.9946],[12060.471,12638.533],[1606.6443,7803.5156],[11447.91,11364.536],[13441.16,5429.3013],[12944.227,12766.889],[10066.4,5434.24],[2306.17,9633.46],[4065.87,10818.9],[3332.07,3923.91],[6326.4805,7809.4888],[1704.5732,12841.845]];
		

Change the safezone coords to match yours. Change the radius to be whatever you want.

 

Credits to maca for the original script: http://epochservers.com/viewtopic.php?f=14&t=17

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...