Remove Parts From Vehicles (Simplified)

What BE filter is giving a kick when removing parts? I've tried object_setFixServer in every file I've found with it but still kicking :(
 
EDIT: small bugfix

okay here is the 1.7.7 version.
ss_remove.sqf:

Code:
// Remove Parts from Vehicles - By SilverShot.
// added anti dupingcode, dayz 1.7.7 compatibility and some description by NeverUsedID - www.die-philosoffen.com
 
private["_vehicle","_part","_hitpoint","_type","_selection","_array"];
_id = _this select 2;
_array =    _this select 3;
_vehicle =    _array select 0;
_part =        _array select 1;
_hitpoint = _array select 2;
_type = typeOf _vehicle;
 
 
_hasToolbox =    "ItemToolbox" in items player;
 
_nameType =        getText(configFile >> "cfgVehicles" >> _type >> "displayName");
_namePart =        getText(configFile >> "cfgMagazines" >> _part >> "displayName");
 
if (_hasToolbox) then {
    if (getDammage _vehicle < 2) then {
 
        _damage = [_vehicle,_hitpoint] call object_getHit;
        //check if part is not damaged and remove it
        if( _damage < 0.20 ) then {
                {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
                s_player_removeActions = [];
                silver_myCursorTarget = objNull;
 
                _selection = getText(configFile >> "cfgVehicles" >> _type >> "HitPoints" >> _hitpoint >> "name");
                //check if part is engine or fueltank, otherwise vehicle will explode if damage is set to 1.
                if( _hitpoint == "HitEngine" or _hitpoint == "HitFuel" ) then {
                    _total = [_vehicle,  _selection, 0.89,  _array, "zombie", true] call fnc_veh_handleDam;
                } else {
                    // set damage to 1
                    _total = [_vehicle,  _selection, 1,  _array, "zombie", true] call fnc_veh_handleDam;
                };
                //play animation
                player playActionNow "Medic";
                sleep 1;
 
                [player,"repair",0,false] call dayz_zombieSpeak;
                null = [player,10,true,(getPosATL player)] spawn player_alertZombies;
                sleep 5;
                _vehicle setvelocity [0,0,1];
 
            //recheck damage to be sure that part is removed from vehicle
                _damage = [_vehicle,_hitpoint] call object_getHit;
                if( _damage > 0.20 ) then {
                        _result = [player,_part] call BIS_fnc_invAdd;
                        //check if there is enough space in inventar
                        if (_result) then {
                            cutText [format["You have successfully taken %1 from the %2",_namePart,_nameType], "PLAIN DOWN"];
                        } else {
                            //if not enought space say "not enough space"
                            cutText [localize "str_player_24", "PLAIN DOWN"];
                            //and add the part back to the vehicle.
                            [_vehicle, _selection, 0, true] call fnc_veh_handleRepair;
                        };             
                };
            } else {
            cutText [format["Cannot remove %1 from %2, the part has been damaged.",_namePart,_nameType], "PLAIN DOWN"];
        };
    } else {
        {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
        s_player_removeActions = [];
        silver_myCursorTarget = objNull;
    };
};
 
if( silver_myCursorTarget != objNull ) then {
    {silver_myCursorTarget removeAction _x} forEach s_player_removeActions;
    s_player_removeActions = [];
    silver_myCursorTarget = objNull;
};
//update vehicle in database
[_vehicle,_type] spawn server_updateObject;


The bug fix partially works since when parts need to be repaired they now can be removed and then and repair the same vehicle.

Edit: It seems to happen if it is yellow under scrollmenu, but others that are yellow are not shown aswell. Could I make it have to be green?
 
The bug fix partially works since when parts need to be repaired they now can be removed and then and repair the same vehicle.

Edit: It seems to happen if it is yellow under scrollmenu, but others that are yellow are not shown aswell. Could I make it have to be green?


strange:

(getDammage cursorTarget < 0.95) in selfaction should prevent this. I dont have seen this on our servers ...
 
I added this to my server and I'm pretty sure it works. It's just that when I try to remove a part, it kicks me with restriction #0. Any help on this?
 
To all with script restriction:
This is a BE filter problem. Just look in LOGFILE for specific error causing this and then write a exception for this function.

But why I am writing here is another very weird bug I have on my server when running the script: Zoms do no DMG to players anymore!

Anyone else got that problem? I have no idea what went wront, script works but Zombs do no more DMG...

When I remove the script, it works fine.

Using 1.7.7.1, need help to get this fixed...

EDIT: so for me it looks like something in the compile.sqf or fn_selfactions.sqf is wrong. can somebody with a running script (and zombs doing dmg) email or upload this 2 files for me so i can check for any lines differ from mine?
 
Back
Top