Strip vehicles for parts

I'm having an issue on 1.7.7.1 too!
Im getting kicked with message : Public variable Restriction #0
does anybody have a fix for it?
 
I m running Namalsk. dayz 1.7.7

here is my code in the fn_selfActions:

// ---------------------------------------Remove Parts from Vehicles Start--------------------------------------

// Remove Parts from Vehicles - By SilverShot.
if( !_isMan and _canDo and _hasToolbox and (silver_myCursorTarget != cursorTarget) and cursorTarget isKindOf "AllVehicles" and (getDammage cursorTarget < 0.95) ) then {
_vehicle = cursorTarget;
_invalidVehicle = (_vehicle isKindOf "Motorcycle") or (_vehicle isKindOf "Tractor"); //or (_vehicle isKindOf "ATV_US_EP1") or (_vehicle isKindOf "ATV_CZ_EP1");
if( !_invalidVehicle ) then {
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
s_player_removeActions = [];
silver_myCursorTarget = _vehicle;

_hitpoints = _vehicle call vehicle_getHitpoints;

{
_damage = [_vehicle,_x] call object_getHit;

if( _damage < 0.15 ) then {

//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;

_skip = true;
if( _skip and _x == "HitFuel" ) then { _skip = false; _part = "PartFueltank"; _cmpt = _cmpt + "tank"};
if( _skip and _x == "HitEngine" ) then { _skip = false; _part = "PartEngine"; };
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 {
_string = format["<t color='#0096ff'>Remove%1</t>",_cmpt,_color]; //Remove - Part
_handle = silver_myCursorTarget addAction [_string, "compile\ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_removeActions set [count s_player_removeActions,_handle];
};
};

} forEach _hitpoints;
};
};
// ---------------------------------------Remove Parts from Vehicles End--------------------------------------

and

//----------------------------------------Repairing Vehicles Start---------------------------------------------
if ((dayz_myCursorTarget != cursorTarget) and _isVehicle and !_isMan and _hasToolbox and (damage cursorTarget < 1)) then {
_vehicle = cursorTarget;
{dayz_myCursorTarget removeAction _x} forEach 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
_string = format["<t %2>Repair%1</t>",_cmpt,_color]; //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];
};

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

and

// ---------------------------------------Remove Parts from Vehicles - By SilverShot. Dupingpatch by NeverUsedID Start--------------------------------------

//Extras Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;

// ---------------------------------------Remove Parts from Vehicles - By SilverShot. Dupingpatch by NeverUsedID End--------------------------------------

i have all scripts on one file named 'compile', i have the menu for repairing véhicle and remove parts, but the remove part doesn't work i have the animation but never remove and no part on my backpack.

Can someone help me
 
I'm having an issue on 1.7.7.1 too!
Im getting kicked with message : Public variable Restriction #0
does anybody have a fix for it?

Go inside Publicvariable.txt and edit the top line, it starts with the number 5 and just change that number to 1, restart your server and its fixed
 
Have the same problem with being kicked for "Public variable Restriction #0" on both Strip vehicle and heli vehicle lift i seemed to fix the strip vehicle using the post above Thanks for that Sup3rn0va but no fix as of yet for the heli tow lift :( if anyone has an answer to this please elt me know :D
 
I have a problem here, when i take of a part its not removed from the vehicle, like if you crash a car and destroy front wheels you can just take the backwheels and repair the front wheels and be on your way... :eek:
 
I've noticed a thing here.. Appearently the fn_selfActions has a //repair part written into it.
So appearently you can add parts to damaged vehicles from default.
However, you can not remove parts (salvage) by default.

The default menu only shows damaged parts and not removeable parts.
It doesn't seem like people have noticed this, cuz we're being told to add the repair/salvage script just before the default repairscript in fn_selfActions.


I can't get the salvage script to work at all.. help?
 
Did anyone find a solution? i have the problem too, that i can remove parts, but it wont be sign as damage on the vehicle!
 
I KNOW the taking parts of infinately has recently been fixed on a lot of servers, just watch frankies latest DAYZ videos he also comments about it, so can someone get the proper script for us PLEASE!!!!!
 
If you want something done, you have got to do it yourself, started working on this 8:30am this morning, 13 hours later non stop, I EMERGE VICTORIOUS!!!!

The fix is NOT simple though, but it makes it impossible to dupe parts on removal, and forces the player to get into the vehicle first to do an "inspection" (Which just helps to set the vehicle to "local" ownership) before he can start stripping it!! EFFING EPIC!!!

I'm way to tired to explain the entire process now, and since the fix consists of a mix and match of different scripts
i'll do an explanation later IF anyone is still interested in a PROPER salvage script. let me know!
 
Manatee hunter, follow this tutorial and it will work perfectly:

1. Using the PBO tool of your choice (cPBO, PBOView, PBOManager etc.) extract the "dayz_code.pbo" from the "@dayz" folder.
2. Copy the "compiles.sqf" from "dayz_code\init" into your mission.pbo.
3. In the init.sqf in the mission.pbo edit:

Code:
call compile preprocessFileLineNumbers "\z\addons\dayz_code\init\compiles.sqf";

to

Code:
call compile preprocessFileLineNumbers "compiles.sqf";

You can use the compiles.sqf to override majority of the files in "dayz_code\compile" folder. We are going to use it to override the function "fn_selfAction.sqf" so:

4. Copy the "fn_selfAction.sqf" in "dayz_code\compile" to your mission.pbo

5. Open the compiles.sqf and find:

Code:
    fnc_usec_selfActions =        compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_selfActions.sqf";        //Checks which actions for self

(Should be on line 17)

and edit it so it looks like this

Code:
    fnc_usec_selfActions =        compile preprocessFileLineNumbers "fn_selfActions.sqf";        //Checks which actions for self

Now we can edit the fn_selfActions.sqf and the changes will work in our server!

6. Now open the "fn_SelfActions" in the mission.pbo and find
Code:
//Sleep
if(cursorTarget isKindOf "TentStorage" and _canDo and _ownerID == dayz_characterID) then {
if ((s_player_sleep < 0) and (player distance cursorTarget < 3)) then {
s_player_sleep = player addAction [localize "str_actions_self_sleep", "\z\addons\dayz_code\actions\player_sleep.sqf",cursorTarget, 0, false, true, "",""];
};
} else {
player removeAction s_player_sleep;
s_player_sleep = -1;
};

And right underneath it, we add

Code:
// Remove Parts from Vehicles - By SilverShot.
if( !_isMan and _canDo and _hasToolbox and (silver_myCursorTarget != cursorTarget) and cursorTarget isKindOf "AllVehicles" and (getDammage cursorTarget < 0.95) ) then {
_vehicle = cursorTarget;
_invalidVehicle = (_vehicle isKindOf "Motorcycle") or (_vehicle isKindOf "Tractor"); //or (_vehicle isKindOf "ATV_US_EP1") or (_vehicle isKindOf "ATV_CZ_EP1");
if( !_invalidVehicle ) then {
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
s_player_removeActions = [];
silver_myCursorTarget = _vehicle;
 
_hitpoints = _vehicle call vehicle_getHitpoints;
 
{
_damage = [_vehicle,_x] call object_getHit;
 
if( _damage < 0.15 ) then {
 
//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;
 
_skip = true;
if( _skip and _x == "HitFuel" ) then { _skip = false; _part = "PartFueltank"; _cmpt = _cmpt + "tank"};
if( _skip and _x == "HitEngine" ) then { _skip = false; _part = "PartEngine"; };
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 {
_string = format["<t color='#0096ff'>Remove%1</t>",_cmpt,_color]; //Remove - Part
_handle = silver_myCursorTarget addAction [_string, "ss_remove.sqf",[_vehicle,_part,_x], 0, false, true, "",""];
s_player_removeActions set [count s_player_removeActions,_handle];
};
};
 
} forEach _hitpoints;
};
};

This gives us the options on the scroll wheel menu when looking at vehicles!

7. Now find

Code:
 //Engineering
{dayz_myCursorTarget removeAction _x} forEach s_player_repairActions;s_player_repairActions = [];
dayz_myCursorTarget = objNull;
//Others
player removeAction s_player_forceSave;
s_player_forceSave = -1;
player removeAction s_player_flipveh;
s_player_flipveh = -1;
player removeAction s_player_sleep;
s_player_sleep = -1;
player removeAction s_player_deleteBuild;
s_player_deleteBuild = -1;
player removeAction s_player_butcher;
s_player_butcher = -1;
player removeAction s_player_cook;
s_player_cook = -1;
player removeAction s_player_boil;
s_player_boil = -1;
player removeAction s_player_fireout;
s_player_fireout = -1;
player removeAction s_player_packtent;
s_player_packtent = -1;
player removeAction s_player_fillfuel;
s_player_fillfuel = -1;
player removeAction s_player_studybody;
s_player_studybody = -1;
//Dog
player removeAction s_player_tamedog;
s_player_tamedog = -1;
player removeAction s_player_feeddog;
s_player_feeddog = -1;
player removeAction s_player_waterdog;
s_player_waterdog = -1;
player removeAction s_player_staydog;
s_player_staydog = -1;
player removeAction s_player_trackdog;
s_player_trackdog = -1;
player removeAction s_player_barkdog;
s_player_barkdog = -1;
player removeAction s_player_warndog;
s_player_warndog = -1;
player removeAction s_player_followdog;
s_player_followdog = -1;
};

And right above it add
Code:
//Extras
//Remove Parts
{silver_myCursorTarget removeAction _x} forEach s_player_removeActions;s_player_removeActions = [];
silver_myCursorTarget = objNull;

This makes sure we don't have the option unless we are looking at vehicles!

8. Last but CERTAINLY not least, download the attached ss_remove.sqf and place it into your mission!

Job done!!!


Hi. I do everything what what is in this instruction and i see this blue text but when i click i get kicked by BattlEye: PublicVariable Restriction #0. I need some help with this.

Sorry for my not english.
 
has anyone tried using this on epoch cherno? i've added this and i get the scroll wheel options and all that good stuff.....but when i try to remove the part it says i dont have enough invo space even if i removed every single item from it.

so my question is has anyone tried and have a fix for this? also i know epoch has their own salvage and repair and i've removed both and added in the normal repair which works fine but the removal has that invo issue
 
If you want something done, you have got to do it yourself, started working on this 8:30am this morning, 13 hours later non stop, I EMERGE VICTORIOUS!!!!

The fix is NOT simple though, but it makes it impossible to dupe parts on removal, and forces the player to get into the vehicle first to do an "inspection" (Which just helps to set the vehicle to "local" ownership) before he can start stripping it!! EFFING EPIC!!!

I'm way to tired to explain the entire process now, and since the fix consists of a mix and match of different scripts
i'll do an explanation later IF anyone is still interested in a PROPER salvage script. let me know!

Ive added mine to taviana 2.0 and I just aint working, getting the words repair in different colors but not parts after the words REPAIR and no blue remove parts either.
 
ye, i have an idea ;)
the fix is...you have already an implemented vehicle strip in your 1.8 update ;)

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 "//" for _menu1 and "s_player_repairActions".
Now you get the option to "Salvage Vehicle"......

have fun ! ;)
 
that vehicle salvage script is broken
it lets you strip 8 wheels of a bicycle to give you 1 example!
 
i have a almost working script for 1.8.0.3 showing only parts damaged less then 20 percent. So far it works except that you need to get in once. if you don´t it can be used for duping by getting the same part over and over again.
I´ve tried to see a reason for this and couldn´t find any variable indicating that the car was "owned" by a player before.

Does anyone know how to fix this ?
 
Last edited:
Back
Top