This is part of the code that was worked on by the past arma 2 community, not 100% sure who fully created it or if everyone contributed. Please try and tell me what may be the problem as when I leave the safezones the god mode still remains but the msg saying I left the safezone works.
init.sqf
[] execVM "safezone.sqf";
Safezone.sqf
if (isNil "inSafezone") then { inSafezone = false; }; while {true} do { waitUntil { inSafeZone }; player allowDamage false; player removeAllEventhandlers "HandleDamage"; player addEventhandler ["HandleDamage", {false}]; SafezoneFiredEvent = player addEventHandler ["Fired", {titleText ["You can not fire your weapon in a safe zone.","PLAIN DOWN"]; titleFadeOut 4;}]; waitUntil { !inSafeZone }; player allowDamage true; player addeventhandler ['HandleDamage',{_this call HandleDamage;} ]; player removeEventHandler ["Fired", SafezoneFiredEvent]; };
mission.sqm
class Sensors { items=3; class Item0 { position[]={18459.535,23.616171,14277.782}; a=250; b=250; activationBy="ANY"; repeating=1; interruptable=1; age="UNKNOWN"; name="eastsafezone"; expCond = "(player distance eastsafezone) < 250;"; expActiv="hint ""You have entered A Safe Zone! Do not fire in the Safe Zones.""; inSafeZone = true;"; expDesactiv="hint ""You are leaving the Safe Zone!""; inSafeZone = false;"; class Effects { }; }; class Item1 { position[]={6195.4927,89.220779,16839.254}; a=250; b=250; activationBy="ANY"; repeating=1; interruptable=1; age="UNKNOWN"; name="westsafezone"; expCond = "(player distance westsafezone) < 250;"; expActiv="hint ""You have entered A Safe Zone! Do not fire in the Safe Zones.""; inSafeZone = true;"; expDesactiv="hint ""You are leaving the Safe Zone!""; inSafeZone = false;"; class Effects { }; }; class Item2 { position[]={13334.093,2.2350941,14517.924}; a=250; b=250; activationBy="ANY"; repeating=1; interruptable=1; age="UNKNOWN"; name="centralsafezone"; expCond = "(player distance centralsafezone) < 250;"; expActiv="hint ""You have entered A Safe Zone! Do not fire in the Safe Zones.""; inSafeZone = true;"; expDesactiv="hint ""You are leaving the Safe Zone!""; inSafeZone = false;"; class Effects { }; }; }; };