Jump to content
  • 0

zupas old vehicle god mode


theduke

Question

well im back on this subject myself.   While i thank @BigEgg for his fix.  I still wanted to get zupas old script working. Zupas script allows for gear to be in in and also locked all over the map is in god mode. As i run pve servers, its easier for us rather than sitting and watching for trolls 24/7.

Since we did the move to 1061, and havnt had locked vehicles in godmod all over the map, we've already had more than enough trolls blowing out tires on locked vehicles....

So i FINALLY got zupas old script working. But i have a RPT issue that i cant get by.

Im hoping someone can help me figure this out.

if (_allFixed && !_totalDmg) then {_object setDamage 0;};>
11:26:49   Error position: <!_totalDmg) then {_object setDamage 0;};>
11:26:49   Error Generic error in expression
11:26:49 File z\addons\dayz_server\compile\server_updateObject.sqf, line 133
11:26:49 Error in expression

 

these are zupas original files, but modified a bit for the new variables

vehicle_handleDamage.sqf

Spoiler

private["_selection","_state","_strH","_total","_unit"];


//***Zupa Config ****//


_godmodeVechilesEverywhere = true; // Godmode on all locked vehicles
_onlyLockedVehicles = false;         //Plotarea: Godmode for Only locked vehicles (true) or locked and unlocked(false)
_onlyVehicleWithoutGear = false;     // Only godmode on vehicles that hold no gear.
_safeZoneGodVehicle = true;         // Godmode vehicles in safezones. (or specific zone's)


// donator plotpole only works with PLOT FOR LIFE, set FALSE if you dont have it.
_donatorsPlots = false;             // True = only godmode vehicles for donaters in the list, False = godmode for every guy.
_plotDonators = ["0","0"];             // PUID's of poeple who donated for plotpole


// Chernarus safezone area's - change these to other coordinates for other maps. ( You can also add specific locations on the map.
_safezones = [ 
    [[5070.75,9729.54],100,"Air"],
    [[1606.6443,7803.5156],100,"Bandit"],
    [[4063.4226,11664.19],100,"Bash"],
    [[12944.227,12766.889],100,"Hero"],
    [[11447.472,11364.504],100,"Klen"],
    [[6315.88,7791.3],100,"Stary"] // [[x,y],distance,"just name"]
];


//***END Config ****//


_unit = _this select 0;
_selection = _this select 1;
_total = _this select 2;
_state = true;


_HPBefore = -1;


if (_selection != "") then {
_strH = "hit_" + _selection;
_HPBefore = [_unit,_strH] call object_getHit; 
_totalDmg = false;

} else {
_strH = "totalDmg";
_HPBefore = getDammage _unit;


};


if(_total > _HPBefore)then{


if((locked _unit && _godmodeVechilesEverywhere  && (count (crew _unit)) < 1))then{_state = false;
};


if(_state)then{
if(_safeZoneGodVehicle )then{
{if ((_unit distance (_x select 0)) < (_x select 1)) then {_state = false;
};} forEach _safezones;
};
};


_totalDmg = true;

if(_state)then{
_gearCount = 0;
if(_onlyVehicleWithoutGear)then{
//_weaps = count(getWeaponCargo _unit);
//_mags = count(getMagazineCargo _unit);
//_backs = count(getBackpackCargo _unit);
//_gearCount = _gearCount + _weaps + _mags + _backs;
};
_plots = nearestObjects [_unit, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];    
if((count(_plots) > 0))then{        
    _thePlot = _plots select 0;
    _plotOwner = _thePlot getVariable ["ownerPUID",0];
if ( (_gearCount == 0) &&(locked _unit || !(_onlyLockedVehicles) ) && (count (crew _unit)) < 1 && (  !(_donatorsPlots) || (_plotOwner in _plotDonators))) then {_state = false;

};
};
};

}; //fix
if(_state)then{


if (_total >= 0.98) then {
        _total = 1.0;
};


if (local _unit) then {
if (_total > 0) then {
        if (!_totalDmg) then {

_unit setVariable [_strH, _total, true];
        };
_unit setHit [_selection, _total];

        PVDZ_veh_Save = [_unit,"damage",false,_totalDmg];
        if (!isServer) then {
            publicVariableServer "PVDZ_veh_Save";
        } else {
            PVDZ_veh_Save call server_updateObject;
};
};
} else {
// vehicle is not local to this client, ask the client which vehicle is local to set damage
/* PVS/PVC - Skaronator */
PVDZ_send = [_unit,"VehHandleDam",_this];
publicVariableServer "PVDZ_send";
};


}else{
_total = _HPBefore;
};
// all "HandleDamage event" functions should return the effective damage that the engine will record for that part


_total

fn_damageHandlerVehicle.sqf

Spoiler

scriptName "Functions\misc\fn_damageHandler.sqf";
/***********************************************************
    PROCESS DAMAGE TO A UNIT
    - Function
    - [unit, selectionName, damage, source, projectile] call fnc_usec_damageHandler;
************************************************************/
private ["_unit","_hit","_damage","_total"];
_unit = _this select 0;
_hit = _this select 1;
_damage = _this select 2;
//_source = _this select 3;
//_ammo = _this select 4;
_total = _damage;
_state = true;

//***Zupa Config ****//

_godmodeVechilesEverywhere = false; // Godmode on all locked vehicles
_onlyLockedVehicles = true;         //Plotarea: Godmode for Only locked vehicles (true) or locked and unlocked(false)
_onlyVehicleWithoutGear = false;     // Only godmode on vehicles that hold no gear.
_safeZoneGodVehicle = false;         // Godmode vehicles in safezones. (or specific zone's)

// donator plotpole only works with PLOT FOR LIFE, set FALSE if you dont have it.
_donatorsPlots = false; // True = only godmode vehicles for donaters in the list, False = godmode for every guy.
_plotDonators = ["0","0"]; // PUID's of poeple who donated for plotpole

// Chernarus safezone area's - change these to other coordinates for other maps. ( You can also add specific locations on the map.
_safezones = [ 
    [[5070.75,9729.54],100,"Air"],
    [[1606.6443,7803.5156],100,"Bandit"],
    [[4063.4226,11664.19],100,"Bash"],
    [[12944.227,12766.889],100,"Hero"],
    [[11447.472,11364.504],100,"Klen"],
    [[6315.88,7791.3],100,"Stary"] // [[x,y],distance,"just name"]
];

//***END Config ****//


systemChat "checks";
if((locked _unit && _godmodeVechilesEverywhere  && (count (crew _unit)) < 1))then{_state = false;
};

if(_state)then{
if(_safeZoneGodVehicle )then{
{if ((_unit distance (_x select 0)) <  (_x select 1)) then {_state = false;

};} forEach _safezones;
};
};


if(_state)then{
_gearCount = 0;
if(_onlyVehicleWithoutGear)then{
//_weaps = count(getWeaponCargo _unit);
//_mags = count(getMagazineCargo _unit);
//_backs = count(getBackpackCargo _unit);
//_gearCount = _gearCount + _weaps + _mags + _backs;
};
_plots = nearestObjects [_unit, ["Plastic_Pole_EP1_DZ"], DZE_PlotPole select 0];    
if((count(_plots) > 0))then{        
    _thePlot = _plots select 0;
    _plotOwner = _thePlot getVariable ["ownerPUID",0];
if ( (_gearCount == 0) &&(locked _unit || !(_onlyLockedVehicles) ) && (count (crew _unit)) < 1 && (  !(_donatorsPlots) || (_plotOwner in _plotDonators))) then {_state = false;

};
};
};

//diag_log ("DAMAGE VEH: " + typeof(_unit) + " / " + str(_hit) + " / " + str(_damage) + " / " + str(getDammage _unit));

if (local _unit && _state) then {
    _total = [_unit,_hit,_damage] call object_setHitServer;
};
_total

and because 1061 has different calls, this needs to be added also (pulled from 1051) < this might be my issue, but above my head
also changed to suit the new variables

object_setHitServer.sqf

Spoiler

private["_unit","_selection","_damage","_strH","_dam","_total"];
_unit =            _this select 0;
_selection =    _this select 1;
_damage =        _this select 2;
if ((_selection != "") && local _unit) then {
    _strH = "hit_" + (_selection);
    _dam = _unit getVariable [_strH,0];
    _total = (_dam + _damage);
    if (_total > 1) then {
        _total = 1;
    };
    _unit setVariable [_strH,_total,true];
    
    if (_damage >= 1) then {
        //["PVDZE_veh_Update",[_unit,"damage"]] call callRpcProcedure;
        PVDZ_veh_Save = [_unit,"damage"];
        publicVariableServer "PVDZ_veh_Save";
    };
    
} else {
    _damage = 0;
};
_damage

these are called in the compiles.sqf like so around line 630

fnc_veh_handleDam = compile preprocessFileLineNumbers "custom\vehgod\vehicle_handleDamage.sqf";
object_setHitServer = compile preprocessFileLineNumbers "custom\vehgod\object_setHitServer.sqf";

and if you have trader safe zones, the call is there also

Any help would be greatly appreciated

Thanks

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...