Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
//Repairing Vehicles
if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
if (s_player_repair_crtl < 0) then {
dayz_myCursorTarget = _cursorTarget;
_menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
//_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
s_player_repairActions set [count s_player_repairActions,_menu];
//s_player_repairActions set [count s_player_repairActions,_menu1];
s_player_repair_crtl = 1;
} else {
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
s_player_repair_crtl = -1;
};
};
//Repairing Vehicles
if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then {
if (s_player_repair_crtl < 0) then {
dayz_myCursorTarget = _cursorTarget;
_menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""];
s_player_repairActions set [count s_player_repairActions,_menu];
s_player_repairActions set [count s_player_repairActions,_menu1];
s_player_repair_crtl = 1;
} else {
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
s_player_repair_crtl = -1;
};
};
private ["_part","_cancel","_color","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints","_damagePercent","_configVeh","_x"];
_vehicle = cursorTarget;
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = _vehicle;
_hitpoints = _vehicle call vehicle_getHitpoints;
{
_damage = [_vehicle,_x] call object_getHit;
_part = "PartGeneric";
_cmpt = toArray (_x);
_cmpt set [0,20];
_cmpt set [1,toArray ("-") select 0];
_cmpt set [2,20];
_cmpt = toString _cmpt;
_skip = true;
//restrict what parts can be taken off the vehicle
if( _skip and _x == "HitLFWheel" ) then {
_skip = false; _part = "PartWheel";
};
if( _skip and _x == "HitRFWheel" ) then{
_skip = false; _part = "PartWheel";
};
if( _skip and _x == "HitLBWheel" ) then {
_skip = false; _part = "PartWheel";
};
if( _skip and _x == "HitRBWheel" ) then {
_skip = false; _part = "PartWheel";
};
if( _skip and _x == "HitGlass1" ) then {
_skip = false; _part = "PartGlass";
};
if( _skip and _x == "HitGlass2" ) then {
_skip = false; _part = "PartGlass";
};
if( _skip and _x == "HitGlass3" ) then {
_skip = false; _part = "PartGlass";
};
if( _skip and _x == "HitGlass4" ) then {
_skip = false; _part = "PartGlass";
};
if( _skip and _x == "HitGlass5" ) then {
_skip = false; _part = "PartGlass";
};
if( _skip and _x == "HitGlass6" ) then {
_skip = false; _part = "PartGlass";
};
if( _skip and _x == "HitHRotor" ) then {
_skip = false; _part = "PartVRotor";
};
if (!_skip ) then {
//get every damaged part no matter how tiny damage is!
_damagePercent = str(round((1 - _damage) * 100))+"%";
if (_damage < 1) then {
_color = "color='#ffff00'"; //yellow
if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange
if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red
_string = format[localize "str_actions_repair_01",_cmpt,_damagePercent];
_string = format["<t %1>%2</t>",_color,_string]; //Remove - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\salvage.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
};
};
} forEach _hitpoints;
if (count _hitpoints > 0 ) then {
_cancel = dayz_myCursorTarget addAction [localize "str_actions_cancel", "\z\addons\dayz_code\actions\repair_cancel.sqf","repair", 0, true, false, "",""];
s_player_repairActions set [count s_player_repairActions,_cancel];
s_player_repair_crtl = 1;
};
_invalidVehicle = (_vehicle isKindOf "Bike");
if( !_invalidVehicle ) then {
.....};
hey dudes,
there is already a build in script to strip vehicles. just tested it on my test server and everything is fine.
so, here we go:
you need the
"fn_selfActions.sqf" from "dayz_code.pbo\compile\" if you dont have one already.
you only need to change the repair code:
Code://Repairing Vehicles if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then { if (s_player_repair_crtl < 0) then { dayz_myCursorTarget = _cursorTarget; _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; //_menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; s_player_repairActions set [count s_player_repairActions,_menu]; //s_player_repairActions set [count s_player_repairActions,_menu1]; s_player_repair_crtl = 1; } else { {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; s_player_repair_crtl = -1; }; };
to this:
Code://Repairing Vehicles if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1)) then { if (s_player_repair_crtl < 0) then { dayz_myCursorTarget = _cursorTarget; _menu = dayz_myCursorTarget addAction [localize "str_actions_rapairveh", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; _menu1 = dayz_myCursorTarget addAction [localize "str_actions_salvageveh", "\z\addons\dayz_code\actions\salvage_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; s_player_repairActions set [count s_player_repairActions,_menu]; s_player_repairActions set [count s_player_repairActions,_menu1]; s_player_repair_crtl = 1; } else { {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; s_player_repair_crtl = -1; }; };
as you can see, i only took out the "//" für _menu1 and "s_player_repairActions".
Now you get the option to "Salvage Vehicle"......
have fun !![]()
private ["_part"];
//change "HitPart" to " - Part" rather than complicated string replace
_cmpt = toArray (_x);
_cmpt set [0,20];
_cmpt set [1,toArray ("-") select 0];
_cmpt set [2,20];
_cmpt = toString _cmpt;
its glitched as hell with the new removal function (most likely why they commentet it out) however you can fix the old repair code in fn_selfActions very easily by adding this:
right above this:PHP:private ["_part"];
Code://change "HitPart" to " - Part" rather than complicated string replace _cmpt = toArray (_x); _cmpt set [0,20]; _cmpt set [1,toArray ("-") select 0]; _cmpt set [2,20]; _cmpt = toString _cmpt;