Jump to content
  • 0

8 wheels for repair


Persei

Question

9 answers to this question

Recommended Posts

  • 0

How to implement danoe reshenie.Server OwerPoch 1.0.5.1+0.2.5.

contents repair_vehicle.sqf

private ["_part","_cancel","_color","_allFixed","_percent","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints"];

_vehicle = _this select 3;

{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
// dayz_myCursorTarget = _vehicle;

_allFixed = true;
_hitpoints = _vehicle call vehicle_getHitpoints;

{			
	_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";
	};

	// get every damaged part no matter how tiny damage is!
	if (_damage > 0) then {
	
		_allFixed = false;
		_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>Repair%1 (%3 %4)</t>",_cmpt,_color,_percent,"%"]; //Repair - Part
		_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
		s_player_repairActions set [count s_player_repairActions,_handle];
	};

} count _hitpoints;
if (_allFixed) then {
	_vehicle setDamage 0;
};

if(count _hitpoints > 0 ) then {

	_cancel = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_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;
};

Link to comment
Share on other sites

  • 0
private ["_part","_cancel","_color","_allFixed","_percent","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints"];

_vehicle = _this select 3;

{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
// dayz_myCursorTarget = _vehicle;

if (((typeof _vehicle) isKindOf  "Car") and !((typeof _vehicle) isKindOf  "Truck")) then {
    _hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitBody","HitFuel","HitEngine"];
};
   
if (((typeof _vehicle) isKindOf  "Motorcycle")) then {
    _hitpoints = ["HitGlass1","HitGlass2","HitFWheel","HitBWheel","HitBody","HitFuel","HitEngine"];
};
   
if ((typeof _vehicle) isKindOf  "Truck") then {
    _hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitLMWheel","HitRMWheel","HitBody","HitFuel","HitEngine"];
};

if ((typeof _vehicle) isKindOf  "Helicopter") then {
    _hitpoints = ["HitRGlass","HitLGlass","HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitHull","HitMissiles","HitAvionics","HitHRotor","PartVRotor","HitEngine"];
};

if ((typeof _vehicle) isKindOf  "Plane") then {
    _hitpoints = ["HitHull"];
};

//_allFixed = true;
//_hitpoints = _vehicle call vehicle_getHitpoints;

{
_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(["Body",_x,false] call fnc_inString) then {
_part = "PartGeneric";
};

if(["Hull",_x,false] call fnc_inString) then {
_part = "PartGeneric";
};

if(["Missiles",_x,false] call fnc_inString) then {
_part = "PartGeneric";
};

if(["VRotor",_x,false] call fnc_inString) then {
_part = "PartGeneric";
};

if(["Wheel",_x,false] call fnc_inString) then {
_part = "PartWheel";
};

if(["Glass",_x,false] call fnc_inString) then {
_part = "PartGlass";
};

// get every damaged part no matter how tiny damage is!
if (_damage > 0) then {

//_allFixed = false;
_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>Repair%1 (%3 %4)</t>",_cmpt,_color,_percent,"%"]; //Repair - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
};

} count _hitpoints;
//if (_allFixed) then {
//_vehicle setDamage 0;
//};

if(count _hitpoints > 0 ) then {

_cancel = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_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;
};

Little poked corrected but not all tell me where the error.

Link to comment
Share on other sites

  • 0

"HitHull" Without this option was not a body.And the parameters are stored in dayz_code/config.bin

class RepairParts : AllVehicles


{
class HitEngine {
part = "PartEngine";
};
class HitRGlass {
part = "PartGlass";
};
class HitLGlass {
part = "PartGlass";
};
class HitBody {
part = "PartGeneric";
};
class HitFuel {
part = "PartFueltank";
};
class HitLFWheel {
part = "PartWheel";
};
class HitRFWheel {
part = "PartWheel";
};
class HitLF2Wheel {
part = "PartWheel";
};
class HitRF2Wheel {
part = "PartWheel";
};
class HitLMWheel {
part = "PartWheel";
};
class HitRMWheel {
part = "PartWheel";
};
class HitLBWheel {
part = "PartWheel";
};
class HitRBWheel {
part = "PartWheel";
};
class HitFWheel {
part = "PartWheel";
};
class HitBWheel {
part = "PartWheel";
};
class wheel_1_damper {
part = "PartWheel";
};
class wheel_2_damper {
part = "PartWheel";
};
class HitGlass1 {
part = "PartGlass";
};
class HitGlass2 {
part = "PartGlass";
};
class HitGlass3 {
part = "PartGlass";
};
class HitGlass4 {
part = "PartGlass";
};
class HitGlass5 {
part = "PartGlass";
};
class HitGlass6 {
part = "PartGlass";
};
class HitVRotor {
part = "PartGeneric";
};
class HitHRotor {
part = "PartVRotor";
};
class HitAvionics {
part = "PartGeneric";
};
class HitMissiles {
part = "PartGeneric";
};
class HitHull {
part = "PartGeneric";
};
};

corrected code

private ["_part","_cancel","_color","_allFixed","_percent","_string","_handle","_damage","_cmpt","_vehicle","_hitpoints"];




_vehicle = _this select 3;

{dayz_myCursorTarget removeAction _x} count s_player_repairActions;s_player_repairActions = [];
// dayz_myCursorTarget = _vehicle;

if (((typeof _vehicle) isKindOf "Car") and !((typeof _vehicle) isKindOf "Truck")) then {
_hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitBody","HitFuel","HitEngine"];
};

if ((typeof _vehicle) isKindOf "Truck") then {
_hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitLMWheel","HitRMWheel","HitBoby","HitFuel","HitEngine"];
};

if ((typeof _vehicle) isKindOf "Motorcycle") then {
_hitpoints = ["HitGlass1","HitGlass2","HitFWheel","HitBWheel","HitBody","HitFuel","HitEngine"];
};

if ((typeof _vehicle) isKindOf "Bike") then {
_hitpoints = ["HitLFWheel","HitLBWheel"]
};

if (((typeof _vehicle) isKindOf "ATV_US_EP1") or ((typeof _vehicle) isKindOf "ATV_CZ_EP1")) then {
_hitpoints = ["HitLFWheel","HitLBWheel","HitRFWheel","HitRBWheel","HitBody","HitFuel","HitEngine"]
};

if ((typeof _vehicle) isKindOf "Helicopter") then {
_hitpoints = ["HitGlass1","HitGlass2","HitGlass3","HitGlass4","HitGlass5","HitGlass6","HitHull","HitVRotor","HitHRotor","HitAvionics","HitMissiles","HitEngine"];
};

if ((typeof _vehicle) isKindOf "Plane") then {
_hitpoints = ["HitHull"];
};

//_allFixed = true;
//_hitpoints = _vehicle call vehicle_getHitpoints;


{
_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(["Hull",_x,false] call fnc_inString) then {
_part = "PartGeneric";
};

if(["Body",_x,false] call fnc_inString) then {
_part = "PartGeneric";
};

if(["Wheel",_x,false] call fnc_inString) then {
_part = "PartWheel";
};

if(["Glass",_x,false] call fnc_inString) then {
_part = "PartGlass";
};

// get every damaged part no matter how tiny damage is!
if (_damage > 0) then {

_allFixed = false;
_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["Repair%1 (%3 %4)",_cmpt,_color,_percent,"%"]; //Repair - Part
_handle = dayz_myCursorTarget addAction [_string, "\z\addons\dayz_code\actions\repair.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_repairActions set [count s_player_repairActions,_handle];
};

} count _hitpoints;
if (_allFixed) then {
_vehicle setDamage 0;
};

if(count _hitpoints > 0 ) then {

_cancel = dayz_myCursorTarget addAction [localize "STR_EPOCH_PLAYER_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;
};

Link to comment
Share on other sites

  • 0

The fact is that I am on the server was 8 wheels and I decided it ispravit.No fully working since I did not fix nashol I had to collect all that is here in the forum . Maybe someone else has a right solution to this problem , I would be very grateful.

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...