Fix undefined error when trap is deleted

Getvariable returns undefined if the object is null.

https://community.bistudio.com/wiki/getVariable
This commit is contained in:
ebaydayz
2016-11-05 16:42:09 -04:00
parent 564144ee41
commit d97478239c

View File

@@ -373,10 +373,14 @@ publicVariable "sm_done";
}; };
{ {
if (isNull _x) then {dayz_traps = dayz_traps - [_x];}; if (isNull _x) then {
dayz_traps = dayz_traps - [_x];
_script = call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script"); _armed = false;
_armed = _x getVariable ["armed", false]; _script = {};
} else {
_armed = _x getVariable ["armed", false];
_script = call compile getText (configFile >> "CfgVehicles" >> typeOf _x >> "script");
};
if (_armed) then { if (_armed) then {
if !(_x in dayz_traps_active) then {["arm", _x] call _script;}; if !(_x in dayz_traps_active) then {["arm", _x] call _script;};