Hi,
I use maca134s "Better Safezone" script to enable player godmode in trade cities.
Is there any way to give vehicles godmode aswell?
I have DZAI (Bandit AI) and they tend to swarm trade cities and shoot in from the outside and destroying vehicles.
I tried to add
So it looks like this:
Private ["_EH_Fired"];
if (isNil "inSafezone") then {
inSafezone = false;
};
while {true} do {
waitUntil { inSafeZone };
titleText [format["Entering Safe Zone. Your weapons have been deactivated."],"PLAIN DOWN"]; titleFadeOut 4;
waitUntil { player == vehicle player };
thePlayer = vehicle player;
_EH_Fired = thePlayer addEventHandler ["Fired", {
titleText ["You can not fire your weapon in a safe zone.","PLAIN DOWN"]; titleFadeOut 4;
NearestObject [_this select 0,_this select 4] setPos[0,0,0];
}];
player_zombieCheck = {};
fnc_usec_damageHandler = {};
fnc_usec_unconscious = {};
vehicle_handleDamage ={};
vehicle_handleKilled ={};
thePlayer removeAllEventHandlers "handleDamage";
thePlayer addEventHandler ["handleDamage", {false}];
thePlayer allowDamage false;
waitUntil { !inSafeZone };
titleText [format["Exiting Safe Zone. Your weapons have been reactivated."],"PLAIN DOWN"]; titleFadeOut 4;
thePlayer removeEventHandler ["Fired", _EH_Fired];
player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
fnc_usec_damageHandler = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_damageHandler.sqf";
fnc_usec_unconscious = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\fn_unconscious.sqf";
vehicle_handleDamage = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleDamage.sqf";
vehicle_handleKilled = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\vehicle_handleKilled.sqf";
thePlayer addEventHandler ["handleDamage", {true}];
thePlayer removeAllEventHandlers "handleDamage";
thePlayer allowDamage true;
};
This only seem to work when you sit inside of the vehicle, once you go out you can damage it again. At least I think you can't damage it while inside of the car. I'm all alone testing, so I haven't been able to test it with players, but at least AIs stop attacking my car when I'm inside of it.
Anyone knows how I can give vehicles godmode inside safe zones permanently, without having players inside of them?
Edit
The above code does not work at all.

