alexlawson
OpenDayZ Rockstar!
Nice, but is this God everywhere or just traders, just its a but OP if its god mode vehicles everywhere.ok i have fixed locked vehicle so its not possible to salvage and destroy them:
1. go inside the fn_SelfAction.sqf and replace the code on line "~1156 //Repairing Vehicles" with this:
Code://Repairing Vehicles if ((dayz_myCursorTarget != _cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage _cursorTarget < 1) and !_isDisallowRepair) then { _hasKey = _ownerID in _temp_keys; _oldOwner = (_ownerID == dayz_playerUID); if(!locked _cursorTarget) then { if (s_player_repair_crtl < 0) then { dayz_myCursorTarget = _cursorTarget; _menu = dayz_myCursorTarget addAction ["Repair Vehicle", "\z\addons\dayz_code\actions\repair_vehicle.sqf",_cursorTarget, 0, true, false, "",""]; _menu1 = dayz_myCursorTarget addAction ["Salvage Vehicle", "fixes\salvage_v.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; }; }; };
2. create now a file in the fixes folder and name it to "salvage_v.sqf" and insert this:
Code:private ["_part","_cancel","_color","_percent","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints"]; // [ _trader_id, _category, _action ]; // _activatingPlayer = _this select 1; _vehicle = _this select 3; {dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = []; // dayz_myCursorTarget = _vehicle; //_allFixed = true; _hitpoints = _vehicle call vehicle_getHitpoints; //diag_log format["DEBUG SALVAGE: %1", _hitpoints]; { _damage = [_vehicle,_x] call object_getHit; _part = "PartGeneric"; //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; if(["Engine",_x,false] call fnc_inString) then { _part = "PartEngine"; }; if(["HRotor",_x,false] call fnc_inString) then { _part = "PartVRotor"; //yes you need PartVRotor to fix HRotor LOL }; if(["Fuel",_x,false] call fnc_inString) then { _part = "PartFueltank"; }; if(["Wheel",_x,false] call fnc_inString) then { _part = "PartWheel"; }; if(["Glass",_x,false] call fnc_inString) then { _part = "PartGlass"; }; // allow removal of any lightly damaged parts if (_damage < 1 ) then { // Do not allow removal of engine or fueltanks if( _part == "PartGlass" or _part == "PartWheel" or _part == "PartEngine" or _part == "PartVRotor" or _part == "PartFueltank" or _part == "PartGeneric" ) then { _color = "color='#ffff00'"; //yellow if (_damage >= 0.5) then {_color = "color='#ff8800'";}; //orange if (_damage >= 0.9) then {_color = "color='#ff0000'";}; //red _percent = round(_damage*100); _string = format["<t %2>Remove%1 (%3 %4)</t>",_cmpt,_color,_percent,"%"]; //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 ["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; };
thats all. now you can salvage/repair ALL parts only from unlocked vehicles (engines, fuelpats etc...)
for the locked vehicle godmode follow this:
3. create a new file in fixes and name it to "local_lockUnlock.sqf" and insert this:
Code:private ["_vehicle","_status"]; _vehicle = _this select 0; _status = _this select 1; if (local _vehicle) then { if(_status) then { _vehicle setVehicleLock "LOCKED"; _vehicle setVariable ["R3F_LOG_disabled",true,true]; //<<its disable lift/tow locked veh. with R3F _vehicle allowDamage false; } else { _vehicle setVehicleLock "UNLOCKED"; _vehicle setVariable ["R3F_LOG_disabled",false,true]; //<<its disable lift/tow locked veh. with R3F _vehicle allowDamage true; }; };
4. now open the compiles.sqf and find:
Code:local_lockUnlock = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\local_lockUnlock.sqf";
and replace it with:
Code:local_lockUnlock = compile preprocessFileLineNumbers "fixes\local_lockUnlock.sqf";
DONE!! now your locked vehicles are in godmode and cant be destroyed![]()