Jump to content
  • 0

Script to remove vehicles at traders?


MGT

Question

Trying to script something to remove dumped vehicles left at trader cities at server restart or at set times. Am trying to use the !canbuild event as a location trigger. Anyone else working on something like this?

The situation of dumped vehicles at traders has become worse since now only the driver/owner can sell the vehicle.

Link to comment
Share on other sites

Recommended Posts

  • 0

Speedy you have it in the wrong spot.

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));
		};
		{
		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]];
		
Link to comment
Share on other sites

  • 0

 

Speedy you have it in the wrong spot.

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));
		};
		{
		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]];
		

 

Are these coords for Chernarus, because this is still not working for me 

 

Thanks again Cen!

// # NOW SPAWN OBJECTS #
	_totalvehicles = 0;
	{
		_idKey = 		_x select 1;
		_type =			_x select 2;
		_ownerID = 		_x select 3;

		_worldspace = 	_x select 4;
		_intentory =	_x select 5;
		_hitPoints =	_x select 6;
		_fuel =			_x select 7;
		_damage = 		_x select 8;
		
		_dir = 0;
		_pos = [0,0,0];
		_wsDone = false;
		if (count _worldspace >= 2) then
		{
			_dir = _worldspace select 0;
			if (count (_worldspace select 1) == 3) then {
				_pos = _worldspace select 1;
				_wsDone = true;
			};
		};
		
		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));
		};
		{
		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]];
		

		if (_damage < 1) then {
			//diag_log format["OBJ: %1 - %2", _idKey,_type];
			
			//Create it
			_object = createVehicle [_type, _pos, [], 0, "CAN_COLLIDE"];
			_object setVariable ["lastUpdate",time];
			_object setVariable ["ObjectID", _idKey, true]; 
Link to comment
Share on other sites

  • 0

I think the difference is the damage check on Maca's solution.

Hi MGT, I use Maca's version as well and it worked fine up until 105 and now 1051. Is the change to get it working just to change 'for each' to 'count' like a lot of the changes in the 105 code?

Link to comment
Share on other sites

  • 0

i made this a while back:

 

 

it has a lot more functions than macas version like choose distance indiviually for each safezone/tradercity, it logs all vehicle moved/deleted with classname, gear, id and so on, you can set it to delete certain vehicles and just move other types, you can also choose to unlock them or delete the ones that has over a certain percentage of damage and you can choose if you want to move all the vehicles to a certain spot (like a special made vehicle impound lot).

 

from default i have set it up to just move vehicles outside the zones and only delete bikes, motorcycles and gyros, it will work for napf, cherno and taviana but can easily be setup to work for any map.

Link to comment
Share on other sites

  • 0

i made this a while back:

 

 

it has a lot more functions than macas version like choose distance indiviually for each safezone/tradercity, it logs all vehicle moved/deleted with classname, gear, id and so on, you can set it to delete certain vehicles and just move other types, you can also choose to unlock them or delete the ones that has over a certain percentage of damage and you can choose if you want to move all the vehicles to a certain spot (like a special made vehicle impound lot).

 

from default i have set it up to just move vehicles outside the zones and only delete bikes, motorcycles and gyros, it will work for napf, cherno and taviana but can easily be setup to work for any map.

 

 

Halvhjearne's script is an automatic insert for me whenever I work on a new build - It's easy to use and I can change if I want it moved or deleted and more. 

 

All other scripts that I have seen is probably doing some of the same things... but is the best in my opinion. 

Wow, thanks guys! 

 

I'll give it a whirl...!

 

Thanks again :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...