Jump to content
  • 0

Need a working safezone script!!


Jnizzel

Question

So i've been looking around for a few days now and i cant seem to find a safezone script that actually enables god mode i tryed AGN but for some reason it wont let me load into my server and this is the one im using now but no god mode cant anyone give me a hand

 

 

Private ["_EH_Fired"];
 
if (isNil "inSafezone") then {
    inSafezone = false;
};
 
while {true} do {
    waitUntil { inSafeZone };
    titleText [format["Entering Trader Area - God Mode Enabled"],"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 Trader City Area","PLAIN DOWN"]; titleFadeOut 4;
        NearestObject [_this select 0,_this select 4] setPos[0,0,0];
    }];
 
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer addEventHandler ["handleDamage", {false}];
    thePlayer allowDamage false;
 
    waitUntil { !inSafeZone };
 
    titleText [format["Exiting Trader Area - God Mode Disabled"],"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";
    thePlayer addEventHandler ["handleDamage", {true}];
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer allowDamage true;
};
Link to comment
Share on other sites

20 answers to this question

Recommended Posts

  • 0
Private ["_EH_Fired"];
 
if (isNil "inSafezone") then {
    inSafezone = false;
};
 
while {true} do {
    waitUntil { inSafeZone };
    titleText [format["Entering Trader Area - God Mode Enabled"],"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 Trader City Area","PLAIN DOWN"]; titleFadeOut 4;
        NearestObject [_this select 0,_this select 4] setPos[0,0,0];
    }];
 
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer addEventHandler ["handleDamage", {false}];
    thePlayer allowDamage false;
 
    waitUntil { !inSafeZone };
 
    titleText [format["Exiting Trader Area - God Mode Disabled"],"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";
    thePlayer addEventHandler ["handleDamage", {true}];
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer allowDamage true;
};

This looks like a pretty old script not to mention that at line 22 you have an improper stop.

 

you have this

thePlayer addEventHandler ["handleDamage", {false}];

See the error? Should be this.

thePlayer addEventHandler "handleDamage", {false};

And I seem to see this throughout the whole script.

 

Maybe try infiStar?

Link to comment
Share on other sites

  • 0
Private ["_EH_Fired"];
 
if (isNil "inSafezone") then {
    inSafezone = false;
};
 
while {true} do {
    waitUntil { inSafeZone };
    titleText [format["Entering Trader Area - God Mode Enabled"],"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 Trader City Area","PLAIN DOWN"]; titleFadeOut 4;
        NearestObject [_this select 0,_this select 4] setPos[0,0,0];
    }];
 
    player_zombieCheck = {};
    fnc_usec_damageHandler = {};
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer addEventHandler ["handleDamage", {false}];
    thePlayer allowDamage false;
 
    waitUntil { !inSafeZone };
 
    titleText [format["Exiting Trader Area - God Mode Disabled"],"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";
    thePlayer addEventHandler ["handleDamage", {true}];
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer allowDamage true;
};

This looks like a pretty old script not to mention that at line 22 you have an improper stop.

 

you have this

thePlayer addEventHandler ["handleDamage", {false}];

See the error? Should be this.

thePlayer addEventHandler "handleDamage", {false};

And I seem to see this throughout the whole script.

 

Maybe try infiStar?

 

 

And my bad disregard that.. you have "inSafeZone" set to false. Set it to true and try again man. but you should try infistar its well worth it.

Link to comment
Share on other sites

  • 0

I used AGN until recently when I swapped it out for inifSTAR's version. AGN Safezones saw players framerates drop by at least 30fps whenever entering a safezone. infiSTAR's has no visible frame drop and I like it better anyway. Just follow the instructions man, installation is super easy.

Link to comment
Share on other sites

  • 0

	
	USE_CANBUILD = false;           // if you don't want to define your own positions
	
	
	USE_TraderCity = false; //      if you don't want to define your own positions (Epoch 1.0.5)
	
	
	USE_POSITIONS = true;   // to use own positions and radius
	
	
	USE_AI_REMOVER = false; // use this to remove Missionbots (AI) within 100m of a player if the player is in a SafeZone
	
	
	USE_AntiSteal = true;   // use this to block opening gear if another player is within 3m!
	
	
	USE_SPEEDLIMIT = true;  // very secret function, nobody is supposed to find out what it does.
	
	
	        SPEEDLIMIT = 20;                // Only used if USE_SPEEDLIMIT is true.
	
	
	USE_SIGNS = true;               // use this to build signs around the SafeZone
	
	
	LOG_EnterLeave = true;  // This will log to your .rpt when a player enters or leaves a SafeZone! (only works with infiSTAR.de Admintools / AntiHack)
	
	
	/* You can use USE_CANBUILD or/and (works together) the custom positions below (USE_POSITIONS) [position or zone,radius] */
	
	
	_infiSZ =
	
	
	[
	
	
	        [[6325.6772,7807.7412,0],150,true],
	
	
	        [[4063.4226,11664.19,0],150,true],
	
	
	        [[11447.472,11364.504,0],150,true],
	
	
	        [[1606.6443,7803.5156,0],150,true],
	
	
	        [[12944.227,12766.889,0],150,true],
	
	
	        [[5068.6636,9723.4248,0],100,true],
	
	
	        [[12060,12640,0],200,true]
	
	
	];
	
	
	if (isServer) exitWith
	
	
	{
	
	
	        if (USE_SIGNS) then
	
	
	        {
	
	
	                {
	
	
	                        _center = _x select 0;
	
	
	                        _radius = _x select 1;
	
	
	                        _lSign = _x select 2;
	
	
	                        if (_lSign) then
	
	
	                        {
	
	
	                                for '_i' from 0 to 360 step (270 / _radius)*2 do
	
	
	                                {
	
	
	                                        _location = [(_center select 0) + ((cos _i) * _radius), (_center select 1) + ((sin_i) * _radius),0];
	
	
	                                        _dir = ((_center select 0) - (_location select 0)) atan2 ((_center select 1) -(_location select 1));
	
	
	                                        _object = createVehicle ['Sign_sphere100cm_EP1', _location, [], 0, 'CAN_COLLIDE'];
	
	
	                                        //      _object = createVehicle ['SignM_FARP_Winchester_EP1', _location, [], 0, 'CAN_COLLIDE'];
	
	
	                                        //      _object setVehicleInit 'this setObjectTexture [0,''Addons\SafeZones\sign.paa''];';
	
	
	                                        _object setDir _dir;
	
	
	                                };
	
	
	                        };
	
	
	                } forEach _infiSZ;
	
	
	        };
	
	
	};
	
	
	waitUntil {((!isNil 'dayz_animalCheck') || (!isNil 'dayz_medicalH') || (!isNil 'dayz_slowCheck') || (!isNil 'dayz_gui'))};
	
	
	if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false;}; };
	
	
	[_infiSZ] spawn {
	
	
	        _infiSZ = _this select 0;
	
	
	        _startSafeZone =
	
	
	        {
	
	
	                if (isNil 'outNow') then
	
	
	                {
	
	
	                        _msg = 'You entered a Safe Zone!';
	
	
	                        hint _msg;
	
	
	                        taskHint [_msg, [0,1,0,1], 'taskDone'];
	
	
	                        inNow = nil;
	
	
	                        outNow = true;
	
	
	                       
	
	
	                        if (LOG_EnterLeave) then
	
	
	                        {
	
	
	                                PVDZE_send = [player,'SafeZoneState',[1]];
	
	
	                                publicVariableServer 'PVDZE_send';
	
	
	                        };
	
	
	                };
	
	
	                player_fired = {
	
	
	                        deleteVehicle (nearestObject [_this select 0,_this select 4]);
	
	
	                        cutText ['You can not fire in a SafeZone!','WHITE IN'];
	
	
	                };
	
	
	                wild_spawnZombies = {};
	
	
	                zombie_generate = {};
	
	
	               
	
	
	                fnc_usec_damageHandler = {};
	
	
	                player removeAllEventHandlers 'handleDamage';
	
	
	                player addEventHandler ['handleDamage', {false}];
	
	
	                player allowDamage false;
	
	
	                _veh = vehicle player;
	
	
	                if (player != _veh) then
	
	
	                {
	
	
	                        _szs = _veh getVariable ['inSafeZone',0];
	
	
	                        if (_szs == 0) then
	
	
	                        {
	
	
	                                _veh removeAllEventHandlers 'Fired';
	
	
	                                _veh addEventHandler ['Fired', {_this call player_fired;}];
	
	
	                                {
	
	
	                                        _x removeAllEventHandlers 'Fired';
	
	
	                                        _x addEventHandler ['Fired', {_this call player_fired;}];
	
	
	                                } forEach (crew _veh);
	
	
	                                _veh setVariable ['inSafeZone',1];
	
	
	                                vehicle_handleDamage = {false};
	
	
	                                _veh removeAllEventHandlers 'HandleDamage';
	
	
	                                _veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
	
	
	                                _veh allowDamage false;
	
	
	                        };
	
	
	                };
	
	
	                _notInSafeZone =
	
	
	                [
	
	
	                        'MAAWS','RPG7V','M136','RPG18','STINGER',
	
	
	                        'MeleeHatchet_DZE','MeleeHatchet','MeleeCrowbar','MeleeMachete','MeleeFishingPole','MeleeSledge',
	
	
	                        'MeleeBaseBallBatNails','MeleeBaseBallBatBarbed','MeleeBaseBallBat'
	
	
	                ];
	
	
	                _cwep = currentWeapon player;
	
	
	                if (_cwep in _notInSafeZone) then
	
	
	                {
	
	
	                        _swep = '';
	
	
	                        {
	
	
	                                if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith
	
	
	                                {
	
	
	                                        _swep = _x;
	
	
	                                };
	
	
	                        } forEach (weapons player);
	
	
	                        if (_swep == '') then
	
	
	                        {
	
	
	                                player playActionNow 'PutDown';
	
	
	                                _iPos = getPosATL player;
	
	
	                                _radius = 1;
	
	
	                                _removed = ([player,_cwep,1] call BIS_fnc_invRemove);
	
	
	                                if (_removed == 1) then
	
	
	                                {
	
	
	                                        _item = createVehicle ['WeaponHolder', _iPos, [], _radius, 'CAN_COLLIDE'];
	
	
	                                        _item addWeaponCargoGlobal [_cwep,1];
	
	
	                                };
	
	
	                        }
	
	
	                        else
	
	
	                        {
	
	
	                                player selectweapon _swep;
	
	
	                        };
	
	
	                };
	
	
	        };
	
	
	        _endSafeZone =
	
	
	        {
	
	
	                if (isNil 'inNow') then
	
	
	                {
	
	
	                        if (str fnc_usec_damageHandler == '{}') then
	
	
	                        {
	
	
	                                _msg = 'You left the Safe Zone!';
	
	
	                                hint _msg;
	
	
	                                taskHint [_msg, [1,0,0.1,1], 'taskFailed'];
	
	
	                        };
	
	
	                        inNow = true;
	
	
	                        outNow = nil;
	
	
	                       
	
	
	                        if (LOG_EnterLeave) then
	
	
	                        {
	
	
	                                PVDZE_send = [player,'SafeZoneState',[0]];
	
	
	                                publicVariableServer 'PVDZE_send';
	
	
	                        };
	
	
	                };
	
	
	                wild_spawnZombies = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\wild_spawnZombies.sqf';
	
	
	                zombie_generate = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\zombie_generate.sqf';
	
	
	               
	
	
	                player_fired = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
	
	
	                fnc_usec_unconscious = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_unconscious.sqf';
	
	
	                object_monitorGear = compile preprocessFileLineNumbers'\z\addons\dayz_code\compile\object_monitorGear.sqf';
	
	
	                vehicle_handleDamage = compile preprocessFileLineNumbers'\z\addons\dayz_code\compile\vehicle_handleDamage.sqf';
	
	
	               
	
	
	                _veh = vehicle player;
	
	
	                if (player != _veh) then
	
	
	                {
	
	
	                        _szs = _veh getVariable ['inSafeZone',0];
	
	
	                        if (_szs == 1) then
	
	
	                        {
	
	
	                                _veh setVariable ['inSafeZone',0];
	
	
	                                _veh removeAllEventHandlers 'HandleDamage';
	
	
	                                _veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
	
	
	                                _veh allowDamage true;
	
	
	                        };
	
	
	                };
	
	
	               
	
	
	                _end = false;
	
	
	                if (isNil 'gmadmin') then
	
	
	                {
	
	
	                        _end = true;
	
	
	                }
	
	
	                else
	
	
	                {
	
	
	                        if (gmadmin == 0) then
	
	
	                        {
	
	
	                                _end = true;
	
	
	                        };
	
	
	                };
	
	
	                if (_end) then
	
	
	                {
	
	
	                        player allowDamage true;
	
	
	                        fnc_usec_damageHandler = compile preprocessFileLineNumbers'\z\addons\dayz_code\compile\fn_damageHandler.sqf';
	
	
	                        player removeAllEventHandlers 'HandleDamage';
	
	
	                        player addeventhandler ['HandleDamage',{_this call fnc_usec_damageHandler;} ];
	
	
	                };
	
	
	        };
	
	
	        while {1 == 1} do
	
	
	        {
	
	
	                if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then {inSafeZone = false; }; };
	
	
	                _state = false;
	
	
	                if (isNil 'USE_POSITIONS') then { USE_POSITIONS = false; } else { if (typename USE_POSITIONS != 'BOOL')then { USE_POSITIONS = false; }; };
	
	
	                if (USE_POSITIONS) then
	
	
	                {
	
	
	                        {
	
	
	                                _z = _x select 0;
	
	
	                                _r = _x select 1;
	
	
	                                if ((vehicle player) distance _z < _r) then {_state = true;};
	
	
	                        } forEach _infiSZ;
	
	
	                };
	
	
	                if (isNil 'USE_CANBUILD') then { USE_CANBUILD = true; } else { if (typename USE_CANBUILD != 'BOOL') then {USE_CANBUILD = true; }; };
	
	
	                if (USE_CANBUILD) then
	
	
	                {
	
	
	                        if (isNil 'canbuild') then { canbuild = true; } else { if (typename canbuild != 'BOOL') then {canbuild = true; }; };
	
	
	                        if (!canbuild) then {_state = true;};
	
	
	                };
	
	
	                if (isNil 'USE_TraderCity') then { USE_TraderCity = true; } else { if (typename USE_TraderCity != 'BOOL')then { USE_TraderCity = true; }; };
	
	
	                if (USE_TraderCity) then
	
	
	                {
	
	
	                        if (isNil 'isInTraderCity') then { isInTraderCity = false; } else { if (typename isInTraderCity !='BOOL') then { isInTraderCity = false; }; };
	
	
	                        if (isInTraderCity) then {_state = true;};
	
	
	                };
	
	
	                if (_state) then
	
	
	                {
	
	
	                        inSafeZone = true;
	
	
	                        call _startSafeZone;
	
	
	                        {
	
	
	                                if (!isNull _x) then
	
	
	                                {
	
	
	                                        if !(isPlayer _x) then
	
	
	                                        {
	
	
	                                                deletevehicle _x;
	
	
	                                        };
	
	
	                                };
	
	
	                        } forEach ((vehicle player) nearEntities ['zZombie_Base',50]);
	
	
	                       
	
	
	                        if (isNil 'USE_AI_REMOVER') then { USE_AI_REMOVER = false; } else { if (typename USE_AI_REMOVER !='BOOL') then { USE_AI_REMOVER = false; }; };
	
	
	                        if (USE_AI_REMOVER) then
	
	
	                        {
	
	
	                                {
	
	
	                                        if ((!isNull group _x) && (getPlayerUID _x == '')) then
	
	
	                                        {
	
	
	                                                deleteVehicle _x;
	
	
	                                        };
	
	
	                                } forEach (player nearEntities ['Man',100]);
	
	
	                        };
	
	
	                }
	
	
	                else
	
	
	                {
	
	
	                        inSafeZone = false;
	
	
	                };
	
	
	                uiSleep 2;
	
	
	                if (!inSafeZone) then
	
	
	                {
	
	
	                        call _endSafeZone;
	
	
	                };
	
	
	        };
	
	
	};
	
	
	if ((USE_AntiSteal) || (USE_SPEEDLIMIT)) then
	
	
	{
	
	
	        [] spawn {
	
	
	                _USE_AntiSteal = USE_AntiSteal;
	
	
	                _USE_SPEEDLIMIT = USE_SPEEDLIMIT;
	
	
	                _speedlimit = SPEEDLIMIT;
	
	
	                while {1 == 1} do
	
	
	                {
	
	
	                        if (inSafezone) then
	
	
	                        {
	
	
	                                if (_USE_AntiSteal) then
	
	
	                                {
	
	
	                                        _cnt = {isPlayer _x && _x != player} count (player nearEntities [['CAManBase'],3]);
	
	
	                                        if ((_cnt > 0) && (!isNull (findDisplay 106))) then
	
	
	                                        {
	
	
	                                                (findDisplay 106) closedisplay 0;
	
	
	                                                closeDialog 0;
	
	
	                                                _log = format['%1 You are not allowed to open Gear while near another player!',name player];
	
	
	                                                cutText [_log,'PLAIN'];
	
	
	                                                hint _log;
	
	
	                                        };
	
	
	                                };
	
	
	                                if (_USE_SPEEDLIMIT) then
	
	
	                                {
	
	
	                                        _obj = vehicle player;
	
	
	                                        if !(_obj isKindOf 'Plane') then
	
	
	                                        {
	
	
	                                                _speed = abs speed _obj;
	
	
	                                                if ((_obj != player) && (_speed > _speedlimit)) then
	
	
	                                                {
	
	
	                                                        _vel = velocity _obj;
	
	
	                                                        _x = 0.8;
	
	
	                                                        if (_speed > 50) then {_x = 0.1;};
	
	
	                                                        _velNew = [(_vel select 0) * _x, (_vel select 1) * _x,(_vel select2) * _x];
	
	
	                                                        _obj SetVelocity _velNew;
	
	
	                                                };
	
	
	                                        };
	
	
	                                };
	
	
	                        }
	
	
	                        else
	
	
	                        {
	
	
	                                uiSleep 2;
	
	
	                        };
	
	
	                        uiSleep 0.1;
	
	
	                };
	
	
	        };
	
	
	};
	

 

Link to comment
Share on other sites

  • 0

 

	
	USE_CANBUILD = false;           // if you don't want to define your own positions
	
	
	USE_TraderCity = false; //      if you don't want to define your own positions (Epoch 1.0.5)
	
	
	USE_POSITIONS = true;   // to use own positions and radius
	
	
	USE_AI_REMOVER = false; // use this to remove Missionbots (AI) within 100m of a player if the player is in a SafeZone
	
	
	USE_AntiSteal = true;   // use this to block opening gear if another player is within 3m!
	
	
	USE_SPEEDLIMIT = true;  // very secret function, nobody is supposed to find out what it does.
	
	
	        SPEEDLIMIT = 20;                // Only used if USE_SPEEDLIMIT is true.
	
	
	USE_SIGNS = true;               // use this to build signs around the SafeZone
	
	
	LOG_EnterLeave = true;  // This will log to your .rpt when a player enters or leaves a SafeZone! (only works with infiSTAR.de Admintools / AntiHack)
	
	
	/* You can use USE_CANBUILD or/and (works together) the custom positions below (USE_POSITIONS) [position or zone,radius] */
	
	
	_infiSZ =
	
	
	[
	
	
	        [[6325.6772,7807.7412,0],150,true],
	
	
	        [[4063.4226,11664.19,0],150,true],
	
	
	        [[11447.472,11364.504,0],150,true],
	
	
	        [[1606.6443,7803.5156,0],150,true],
	
	
	        [[12944.227,12766.889,0],150,true],
	
	
	        [[5068.6636,9723.4248,0],100,true],
	
	
	        [[12060,12640,0],200,true]
	
	
	];
	
	
	if (isServer) exitWith
	
	
	{
	
	
	        if (USE_SIGNS) then
	
	
	        {
	
	
	                {
	
	
	                        _center = _x select 0;
	
	
	                        _radius = _x select 1;
	
	
	                        _lSign = _x select 2;
	
	
	                        if (_lSign) then
	
	
	                        {
	
	
	                                for '_i' from 0 to 360 step (270 / _radius)*2 do
	
	
	                                {
	
	
	                                        _location = [(_center select 0) + ((cos _i) * _radius), (_center select 1) + ((sin_i) * _radius),0];
	
	
	                                        _dir = ((_center select 0) - (_location select 0)) atan2 ((_center select 1) -(_location select 1));
	
	
	                                        _object = createVehicle ['Sign_sphere100cm_EP1', _location, [], 0, 'CAN_COLLIDE'];
	
	
	                                        //      _object = createVehicle ['SignM_FARP_Winchester_EP1', _location, [], 0, 'CAN_COLLIDE'];
	
	
	                                        //      _object setVehicleInit 'this setObjectTexture [0,''Addons\SafeZones\sign.paa''];';
	
	
	                                        _object setDir _dir;
	
	
	                                };
	
	
	                        };
	
	
	                } forEach _infiSZ;
	
	
	        };
	
	
	};
	
	
	waitUntil {((!isNil 'dayz_animalCheck') || (!isNil 'dayz_medicalH') || (!isNil 'dayz_slowCheck') || (!isNil 'dayz_gui'))};
	
	
	if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false;}; };
	
	
	[_infiSZ] spawn {
	
	
	        _infiSZ = _this select 0;
	
	
	        _startSafeZone =
	
	
	        {
	
	
	                if (isNil 'outNow') then
	
	
	                {
	
	
	                        _msg = 'You entered a Safe Zone!';
	
	
	                        hint _msg;
	
	
	                        taskHint [_msg, [0,1,0,1], 'taskDone'];
	
	
	                        inNow = nil;
	
	
	                        outNow = true;
	
	
	                       
	
	
	                        if (LOG_EnterLeave) then
	
	
	                        {
	
	
	                                PVDZE_send = [player,'SafeZoneState',[1]];
	
	
	                                publicVariableServer 'PVDZE_send';
	
	
	                        };
	
	
	                };
	
	
	                player_fired = {
	
	
	                        deleteVehicle (nearestObject [_this select 0,_this select 4]);
	
	
	                        cutText ['You can not fire in a SafeZone!','WHITE IN'];
	
	
	                };
	
	
	                wild_spawnZombies = {};
	
	
	                zombie_generate = {};
	
	
	               
	
	
	                fnc_usec_damageHandler = {};
	
	
	                player removeAllEventHandlers 'handleDamage';
	
	
	                player addEventHandler ['handleDamage', {false}];
	
	
	                player allowDamage false;
	
	
	                _veh = vehicle player;
	
	
	                if (player != _veh) then
	
	
	                {
	
	
	                        _szs = _veh getVariable ['inSafeZone',0];
	
	
	                        if (_szs == 0) then
	
	
	                        {
	
	
	                                _veh removeAllEventHandlers 'Fired';
	
	
	                                _veh addEventHandler ['Fired', {_this call player_fired;}];
	
	
	                                {
	
	
	                                        _x removeAllEventHandlers 'Fired';
	
	
	                                        _x addEventHandler ['Fired', {_this call player_fired;}];
	
	
	                                } forEach (crew _veh);
	
	
	                                _veh setVariable ['inSafeZone',1];
	
	
	                                vehicle_handleDamage = {false};
	
	
	                                _veh removeAllEventHandlers 'HandleDamage';
	
	
	                                _veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
	
	
	                                _veh allowDamage false;
	
	
	                        };
	
	
	                };
	
	
	                _notInSafeZone =
	
	
	                [
	
	
	                        'MAAWS','RPG7V','M136','RPG18','STINGER',
	
	
	                        'MeleeHatchet_DZE','MeleeHatchet','MeleeCrowbar','MeleeMachete','MeleeFishingPole','MeleeSledge',
	
	
	                        'MeleeBaseBallBatNails','MeleeBaseBallBatBarbed','MeleeBaseBallBat'
	
	
	                ];
	
	
	                _cwep = currentWeapon player;
	
	
	                if (_cwep in _notInSafeZone) then
	
	
	                {
	
	
	                        _swep = '';
	
	
	                        {
	
	
	                                if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith
	
	
	                                {
	
	
	                                        _swep = _x;
	
	
	                                };
	
	
	                        } forEach (weapons player);
	
	
	                        if (_swep == '') then
	
	
	                        {
	
	
	                                player playActionNow 'PutDown';
	
	
	                                _iPos = getPosATL player;
	
	
	                                _radius = 1;
	
	
	                                _removed = ([player,_cwep,1] call BIS_fnc_invRemove);
	
	
	                                if (_removed == 1) then
	
	
	                                {
	
	
	                                        _item = createVehicle ['WeaponHolder', _iPos, [], _radius, 'CAN_COLLIDE'];
	
	
	                                        _item addWeaponCargoGlobal [_cwep,1];
	
	
	                                };
	
	
	                        }
	
	
	                        else
	
	
	                        {
	
	
	                                player selectweapon _swep;
	
	
	                        };
	
	
	                };
	
	
	        };
	
	
	        _endSafeZone =
	
	
	        {
	
	
	                if (isNil 'inNow') then
	
	
	                {
	
	
	                        if (str fnc_usec_damageHandler == '{}') then
	
	
	                        {
	
	
	                                _msg = 'You left the Safe Zone!';
	
	
	                                hint _msg;
	
	
	                                taskHint [_msg, [1,0,0.1,1], 'taskFailed'];
	
	
	                        };
	
	
	                        inNow = true;
	
	
	                        outNow = nil;
	
	
	                       
	
	
	                        if (LOG_EnterLeave) then
	
	
	                        {
	
	
	                                PVDZE_send = [player,'SafeZoneState',[0]];
	
	
	                                publicVariableServer 'PVDZE_send';
	
	
	                        };
	
	
	                };
	
	
	                wild_spawnZombies = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\wild_spawnZombies.sqf';
	
	
	                zombie_generate = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\zombie_generate.sqf';
	
	
	               
	
	
	                player_fired = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
	
	
	                fnc_usec_unconscious = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_unconscious.sqf';
	
	
	                object_monitorGear = compile preprocessFileLineNumbers'\z\addons\dayz_code\compile\object_monitorGear.sqf';
	
	
	                vehicle_handleDamage = compile preprocessFileLineNumbers'\z\addons\dayz_code\compile\vehicle_handleDamage.sqf';
	
	
	               
	
	
	                _veh = vehicle player;
	
	
	                if (player != _veh) then
	
	
	                {
	
	
	                        _szs = _veh getVariable ['inSafeZone',0];
	
	
	                        if (_szs == 1) then
	
	
	                        {
	
	
	                                _veh setVariable ['inSafeZone',0];
	
	
	                                _veh removeAllEventHandlers 'HandleDamage';
	
	
	                                _veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
	
	
	                                _veh allowDamage true;
	
	
	                        };
	
	
	                };
	
	
	               
	
	
	                _end = false;
	
	
	                if (isNil 'gmadmin') then
	
	
	                {
	
	
	                        _end = true;
	
	
	                }
	
	
	                else
	
	
	                {
	
	
	                        if (gmadmin == 0) then
	
	
	                        {
	
	
	                                _end = true;
	
	
	                        };
	
	
	                };
	
	
	                if (_end) then
	
	
	                {
	
	
	                        player allowDamage true;
	
	
	                        fnc_usec_damageHandler = compile preprocessFileLineNumbers'\z\addons\dayz_code\compile\fn_damageHandler.sqf';
	
	
	                        player removeAllEventHandlers 'HandleDamage';
	
	
	                        player addeventhandler ['HandleDamage',{_this call fnc_usec_damageHandler;} ];
	
	
	                };
	
	
	        };
	
	
	        while {1 == 1} do
	
	
	        {
	
	
	                if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then {inSafeZone = false; }; };
	
	
	                _state = false;
	
	
	                if (isNil 'USE_POSITIONS') then { USE_POSITIONS = false; } else { if (typename USE_POSITIONS != 'BOOL')then { USE_POSITIONS = false; }; };
	
	
	                if (USE_POSITIONS) then
	
	
	                {
	
	
	                        {
	
	
	                                _z = _x select 0;
	
	
	                                _r = _x select 1;
	
	
	                                if ((vehicle player) distance _z < _r) then {_state = true;};
	
	
	                        } forEach _infiSZ;
	
	
	                };
	
	
	                if (isNil 'USE_CANBUILD') then { USE_CANBUILD = true; } else { if (typename USE_CANBUILD != 'BOOL') then {USE_CANBUILD = true; }; };
	
	
	                if (USE_CANBUILD) then
	
	
	                {
	
	
	                        if (isNil 'canbuild') then { canbuild = true; } else { if (typename canbuild != 'BOOL') then {canbuild = true; }; };
	
	
	                        if (!canbuild) then {_state = true;};
	
	
	                };
	
	
	                if (isNil 'USE_TraderCity') then { USE_TraderCity = true; } else { if (typename USE_TraderCity != 'BOOL')then { USE_TraderCity = true; }; };
	
	
	                if (USE_TraderCity) then
	
	
	                {
	
	
	                        if (isNil 'isInTraderCity') then { isInTraderCity = false; } else { if (typename isInTraderCity !='BOOL') then { isInTraderCity = false; }; };
	
	
	                        if (isInTraderCity) then {_state = true;};
	
	
	                };
	
	
	                if (_state) then
	
	
	                {
	
	
	                        inSafeZone = true;
	
	
	                        call _startSafeZone;
	
	
	                        {
	
	
	                                if (!isNull _x) then
	
	
	                                {
	
	
	                                        if !(isPlayer _x) then
	
	
	                                        {
	
	
	                                                deletevehicle _x;
	
	
	                                        };
	
	
	                                };
	
	
	                        } forEach ((vehicle player) nearEntities ['zZombie_Base',50]);
	
	
	                       
	
	
	                        if (isNil 'USE_AI_REMOVER') then { USE_AI_REMOVER = false; } else { if (typename USE_AI_REMOVER !='BOOL') then { USE_AI_REMOVER = false; }; };
	
	
	                        if (USE_AI_REMOVER) then
	
	
	                        {
	
	
	                                {
	
	
	                                        if ((!isNull group _x) && (getPlayerUID _x == '')) then
	
	
	                                        {
	
	
	                                                deleteVehicle _x;
	
	
	                                        };
	
	
	                                } forEach (player nearEntities ['Man',100]);
	
	
	                        };
	
	
	                }
	
	
	                else
	
	
	                {
	
	
	                        inSafeZone = false;
	
	
	                };
	
	
	                uiSleep 2;
	
	
	                if (!inSafeZone) then
	
	
	                {
	
	
	                        call _endSafeZone;
	
	
	                };
	
	
	        };
	
	
	};
	
	
	if ((USE_AntiSteal) || (USE_SPEEDLIMIT)) then
	
	
	{
	
	
	        [] spawn {
	
	
	                _USE_AntiSteal = USE_AntiSteal;
	
	
	                _USE_SPEEDLIMIT = USE_SPEEDLIMIT;
	
	
	                _speedlimit = SPEEDLIMIT;
	
	
	                while {1 == 1} do
	
	
	                {
	
	
	                        if (inSafezone) then
	
	
	                        {
	
	
	                                if (_USE_AntiSteal) then
	
	
	                                {
	
	
	                                        _cnt = {isPlayer _x && _x != player} count (player nearEntities [['CAManBase'],3]);
	
	
	                                        if ((_cnt > 0) && (!isNull (findDisplay 106))) then
	
	
	                                        {
	
	
	                                                (findDisplay 106) closedisplay 0;
	
	
	                                                closeDialog 0;
	
	
	                                                _log = format['%1 You are not allowed to open Gear while near another player!',name player];
	
	
	                                                cutText [_log,'PLAIN'];
	
	
	                                                hint _log;
	
	
	                                        };
	
	
	                                };
	
	
	                                if (_USE_SPEEDLIMIT) then
	
	
	                                {
	
	
	                                        _obj = vehicle player;
	
	
	                                        if !(_obj isKindOf 'Plane') then
	
	
	                                        {
	
	
	                                                _speed = abs speed _obj;
	
	
	                                                if ((_obj != player) && (_speed > _speedlimit)) then
	
	
	                                                {
	
	
	                                                        _vel = velocity _obj;
	
	
	                                                        _x = 0.8;
	
	
	                                                        if (_speed > 50) then {_x = 0.1;};
	
	
	                                                        _velNew = [(_vel select 0) * _x, (_vel select 1) * _x,(_vel select2) * _x];
	
	
	                                                        _obj SetVelocity _velNew;
	
	
	                                                };
	
	
	                                        };
	
	
	                                };
	
	
	                        }
	
	
	                        else
	
	
	                        {
	
	
	                                uiSleep 2;
	
	
	                        };
	
	
	                        uiSleep 0.1;
	
	
	                };
	
	
	        };
	
	
	};
	

 

 

do it just put this in safezones.sqf the run in in init?

Link to comment
Share on other sites

  • 0
_obj SetVelocity _velN>
  Error position: <select2) * _x];


_obj SetVelocity _velN>
  Error Missing )
File mpmissions\__CUR_MP.Chernarus\SafeZone.sqf, line 845
Error in expression <ect 0) * _x, (_vel select 1) * _x,(_vel select2) * _x];


_obj SetVelocity _velN>
  Error position: <select2) * _x];


_obj SetVelocity _velN>
  Error Missing )
File mpmissions\__CUR_MP.Chernarus\SafeZone.sqf, line 845

this is what im getting in my RPT

Link to comment
Share on other sites

  • 0

Don't know what wrong with that safezone.sqf, but here is mine. Working on my overpoch chernarus server:

 

/*
   by: http://infiSTAR.de || http://DayzAntiHack.com
   *updated on 22.09.2014


Instructions:
1. Copy paste this pastebin code into a file called SafeZone.sqf - save the file.
2. Now extract your mpmission pbo and put the SafeZone.sqf into the extracted folder.
3. Open the init.sqf of the mpmission.
4. At the bottom of the file add
[] execVM 'safezone\SafeZone.sqf';
5. Save the init.sqf, repack your mpmission, upload it to your gameserver and restart your server
*/
USE_CANBUILD = false; // if you don't want to define your own positions
USE_TraderCity = false; // if you don't want to define your own positions (Epoch 1.0.5)
USE_POSITIONS = true; // to use own positions and radius
USE_AI_REMOVER = true; // use this to remove Missionbots (AI) within 300m of a player if the player is in a SafeZone
USE_AntiSteal = false; // use this to block opening gear if another player is within 3m!
USE_SPEEDLIMIT = true; // very secret function, nobody is supposed to find out what it does.
SPEEDLIMIT = 60; // Only used if USE_SPEEDLIMIT is true.
USE_SIGNS = false; // use this to build signs around the SafeZone
LOG_EnterLeave = false; // This will log to your .rpt when a player enters or leaves a SafeZone! (only works with infiSTAR.de Admintools / AntiHack)
/* You can use USE_CANBUILD or/and (works together) the custom positions below (USE_POSITIONS) [position or zone,radius] */
_infiSZ =
[
[[6325.6772,7807.7412],150,true],   //Trader City Stary
[[4063.4226,11664.19],150,true],    //Trader City Bash
[[11447.472,11364.504],150,true],   //Trader City Klen
[[1606.6443,7803.5156],100,true],   //Bandit Camp
[[12944.227,12766.889],100,true],   //Hero Camp
[[12066.9,12659.3],100,true], //Aircraft Dealer
[[4361.4937,2259.9526],50,true], //Wholesaler South
[[13532.614,6355.9497],50,true], //Wholesaler East
[[7989.3354,2900.9946],50,true], //Boat Dealer South
[[13441.16,5429.3013],50,true] //Boat Dealer East
];
if (isServer) exitWith
{
if (USE_SIGNS) then
{
{
_center = _x select 0;
_radius = _x select 1;
_lSign = _x select 2;
if (_lSign) then
{
for '_i' from 0 to 360 step (270 / _radius)*2 do
{
_location = [(_center select 0) + ((cos _i) * _radius), (_center select 1) + ((sin _i) * _radius),0];
_dir = ((_center select 0) - (_location select 0)) atan2 ((_center select 1) - (_location select 1));
_object = createVehicle ['Sign_sphere100cm_EP1', _location, [], 0, 'CAN_COLLIDE'];
// _object = createVehicle ['SignM_FARP_Winchester_EP1', _location, [], 0, 'CAN_COLLIDE'];
// _object setVehicleInit 'this setObjectTexture [0,''Addons\SafeZones\sign.paa''];';
_object setDir _dir;
};
};
} forEach _infiSZ;
};
};
waitUntil {((!isNil 'dayz_animalCheck') || (!isNil 'dayz_medicalH') || (!isNil 'dayz_slowCheck') || (!isNil 'dayz_gui'))};
if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false; }; };
[_infiSZ] spawn {
_infiSZ = _this select 0;
_startSafeZone =
{
if (isNil 'outNow') then
{
_msg = 'You entered a Safe Zone!';
hint _msg;
taskHint [_msg, [0,1,0,1], 'taskDone'];
inNow = nil;
outNow = true;


if (LOG_EnterLeave) then
{
PVDZE_send = [player,'SafeZoneState',[1]];
publicVariableServer 'PVDZE_send';
};
};
player_fired2 = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
player_fired = {
_this call player_fired2;
deleteVehicle (nearestObject [_this select 0,_this select 4]);
cutText ['You can not fire in a SafeZone!','WHITE IN'];
};
fnc_usec_damageHandler = {};
player removeAllEventHandlers 'handleDamage';
player addEventHandler ['handleDamage', {false}];
player allowDamage false;
_veh = vehicle player;
if (player != _veh) then
{
_szs = _veh getVariable ['inSafeZone',0];
if (_szs == 0) then
{
_veh removeAllEventHandlers 'Fired';
_veh addEventHandler ['Fired', {_this call player_fired;}];
{
_x removeAllEventHandlers 'Fired';
_x addEventHandler ['Fired', {_this call player_fired;}];
} forEach (crew _veh);
_veh setVariable ['inSafeZone', 1, true];
_veh removeAllEventHandlers 'HandleDamage';
_veh addEventHandler ['HandleDamage', {false}];
_veh allowDamage false;
};
};
_notInSafeZone =
[
'MAAWS','RPG7V','M136','RPG18','STINGER',
'MeleeHatchet_DZE','MeleeHatchet','MeleeCrowbar','MeleeMachete','MeleeFishingPole','MeleeSledge',
'MeleeBaseBallBatNails','MeleeBaseBallBatBarbed','MeleeBaseBallBat'
];
_cwep = currentWeapon player;
if (_cwep in _notInSafeZone) then
{
_swep = '';
{
if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith
{
_swep = _x;
};
} forEach (weapons player);
if (_swep == '') then
{
player playActionNow 'PutDown';
_iPos = getPosATL player;
_radius = 1;
_removed = ([player,_cwep,1] call BIS_fnc_invRemove);
if (_removed == 1) then
{
_item = createVehicle ['WeaponHolder', _iPos, [], _radius, 'CAN_COLLIDE'];
_item addWeaponCargoGlobal [_cwep,1];
};
}
else
{
player selectweapon _swep;
};
};
};
_endSafeZone =
{
if (isNil 'inNow') then
{
if (str fnc_usec_damageHandler == '{}') then
{
_msg = 'You left the Safe Zone!';
hint _msg;
taskHint [_msg, [1,0,0.1,1], 'taskFailed'];
};
inNow = true;
outNow = nil;


if (LOG_EnterLeave) then
{
PVDZE_send = [player,'SafeZoneState',[0]];
publicVariableServer 'PVDZE_send';
};
};
player_fired = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
player_zombieCheck = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_zombieCheck.sqf';
fnc_usec_unconscious = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_unconscious.sqf';
object_monitorGear = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\object_monitorGear.sqf';


_veh = vehicle player;
if (player != _veh) then
{
_szs = _veh getVariable ['inSafeZone',0];
if (_szs == 1) then
{
_veh setVariable ['inSafeZone', 0, true];
_veh removeAllEventHandlers 'HandleDamage';
_veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
_veh allowDamage true;
};
};


_end = false;
if (isNil 'gmadmin') then
{
_end = true;
}
else
{
if (gmadmin == 0) then
{
_end = true;
};
};
if (_end) then
{
player allowDamage true;
fnc_usec_damageHandler = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_damageHandler.sqf';
player removeAllEventHandlers 'HandleDamage';
player addeventhandler ['HandleDamage',{_this call fnc_usec_damageHandler;} ];
};
};
while {1 == 1} do
{
if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false; }; };
_state = false;
if (isNil 'USE_POSITIONS') then { USE_POSITIONS = false; } else { if (typename USE_POSITIONS != 'BOOL') then { USE_POSITIONS = false; }; };
if (USE_POSITIONS) then
{
{
_z = _x select 0;
_r = _x select 1;
if ((vehicle player) distance _z < _r) then {_state = true;};
} forEach _infiSZ;
};
if (isNil 'USE_CANBUILD') then { USE_CANBUILD = true; } else { if (typename USE_CANBUILD != 'BOOL') then { USE_CANBUILD = true; }; };
if (USE_CANBUILD) then
{
if (isNil 'canbuild') then { canbuild = true; } else { if (typename canbuild != 'BOOL') then { canbuild = true; }; };
if (!canbuild) then {_state = true;};
};
if (isNil 'USE_TraderCity') then { USE_TraderCity = true; } else { if (typename USE_TraderCity != 'BOOL') then { USE_TraderCity = true; }; };
if (USE_TraderCity) then
{
if (isNil 'isInTraderCity') then { isInTraderCity = false; } else { if (typename isInTraderCity != 'BOOL') then { isInTraderCity = false; }; };
if (isInTraderCity) then {_state = true;};
};
if (_state) then
{
inSafeZone = true;
call _startSafeZone;
{
if (!isNull _x) then
{
if !(isPlayer _x) then
{
deletevehicle _x;
};
};
} forEach ((vehicle player) nearEntities ['zZombie_Base',15]);


if (isNil 'USE_AI_REMOVER') then { USE_AI_REMOVER = false; } else { if (typename USE_AI_REMOVER != 'BOOL') then { USE_AI_REMOVER = false; }; };
if (USE_AI_REMOVER) then
{
{
if ((!isNull group _x) && (getPlayerUID _x == '')) then
{
deleteVehicle _x;
};
} forEach (player nearEntities ['Man',300]);
};
}
else
{
inSafeZone = false;
};
uiSleep 2;
if (!inSafeZone) then
{
call _endSafeZone;
};
};
};
if ((USE_AntiSteal) || (USE_SPEEDLIMIT)) then
{
[] spawn {
_USE_AntiSteal = USE_AntiSteal;
_USE_SPEEDLIMIT = USE_SPEEDLIMIT;
_speedlimit = SPEEDLIMIT;
while {1 == 1} do
{
if (inSafezone) then
{
if (_USE_AntiSteal) then
{
_cnt = {isPlayer _x && _x != player} count (player nearEntities [['CAManBase'], 3]);
if ((_cnt > 0) && (!isNull (findDisplay 106))) then
{
(findDisplay 106) closedisplay 0;
closeDialog 0;
_log = format['%1 You are not allowed to open Gear while near another player!',name player];
cutText [_log,'PLAIN'];
hint _log;
};
};
if (_USE_SPEEDLIMIT) then
{
_obj = vehicle player;
if !(_obj isKindOf 'Plane') then
{
_speed = abs speed _obj;
if ((_obj != player) && (_speed > _speedlimit)) then
{
_vel = velocity _obj;
_x = 0.8;
if (_speed > 50) then {_x = 0.1;};
_velNew = [(_vel select 0) * _x, (_vel select 1) * _x,(_vel select 2) * _x];
_obj SetVelocity _velNew;
};
};
};
}
else
{
uiSleep 2;
};
uiSleep 0.1;
};
};
};

Link to comment
Share on other sites

  • 0

Might wanna try infiSTAR's most up to date version of the safe zone scripts. Can find it right off his website here. Keep in mind it works best if you have infiSTAR antihack installed also. Not all features will work if you do not have infiSTAR antihack.

Here it is in a spolier also

/*
   by: http://infiSTAR.de || http://DayzAntiHack.com
   *updated on 30.11.2014
	
	Instructions:
	1. Copy paste this pastebin code into a file called SafeZone.sqf - save the file.
	2. Now extract your mpmission pbo and put the SafeZone.sqf into the extracted folder.
	3. Open the init.sqf of the mpmission.
	4. At the bottom of the file add
	[] execVM 'SafeZone.sqf';
	5. Save the init.sqf, repack your mpmission, upload it to your gameserver and restart your server
*/
USE_CANBUILD = false;		// if you don't want to define your own positions
USE_TraderCity = false;	//	if you don't want to define your own positions (Epoch 1.0.5)
USE_POSITIONS = true;	// to use own positions and radius
USE_AI_REMOVER = false;	// use this to remove Missionbots (AI) within 100m of a player if the player is in a SafeZone
USE_AntiSteal = true;	// use this to block opening gear if another player is within 3m!
USE_SPEEDLIMIT = true;	// very secret function, nobody is supposed to find out what it does.
	SPEEDLIMIT = 20;		// Only used if USE_SPEEDLIMIT is true.
USE_SIGNS = true;		// use this to build signs around the SafeZone
LOG_EnterLeave = true;	// This will log to your .rpt when a player enters or leaves a SafeZone! (only works with infiSTAR.de Admintools / AntiHack)
/* You can use USE_CANBUILD or/and (works together) the custom positions below (USE_POSITIONS) [position or zone,radius] */
_infiSZ =
[
	[[6325.6772,7807.7412,0],150,true],
	[[4063.4226,11664.19,0],150,true],
	[[11447.472,11364.504,0],150,true],
	[[1606.6443,7803.5156,0],150,true],
	[[12944.227,12766.889,0],150,true],
	[[5068.6636,9723.4248,0],100,true],
	[[12060,12640,0],200,true]
];
if (isServer) exitWith
{
	if (USE_SIGNS) then
	{
		{
			_center = _x select 0;
			_radius = _x select 1;
			_lSign = _x select 2;
			if (_lSign) then
			{
				for '_i' from 0 to 360 step (270 / _radius)*2 do
				{
					_location = [(_center select 0) + ((cos _i) * _radius), (_center select 1) + ((sin _i) * _radius),0];
					_dir = ((_center select 0) - (_location select 0)) atan2 ((_center select 1) - (_location select 1));
					_object = createVehicle ['Sign_sphere100cm_EP1', _location, [], 0, 'CAN_COLLIDE'];
					//	_object = createVehicle ['SignM_FARP_Winchester_EP1', _location, [], 0, 'CAN_COLLIDE'];
					//	_object setVehicleInit 'this setObjectTexture [0,''Addons\SafeZones\sign.paa''];';
					_object setDir _dir;
				};
			};
		} forEach _infiSZ;
	};
};
waitUntil {((!isNil 'dayz_animalCheck') || (!isNil 'dayz_medicalH') || (!isNil 'dayz_slowCheck') || (!isNil 'dayz_gui'))};
if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false; }; };
[_infiSZ] spawn {
	_infiSZ = _this select 0;
	_startSafeZone =
	{
		if (isNil 'outNow') then
		{
			_msg = 'You entered a Safe Zone!';
			hint _msg;
			taskHint [_msg, [0,1,0,1], 'taskDone'];
			inNow = nil;
			outNow = true;
			
			if (LOG_EnterLeave) then
			{
				PVDZE_send = [player,'SafeZoneState',[1]];
				publicVariableServer 'PVDZE_send';
			};
		};
		player_fired = {
			deleteVehicle (nearestObject [_this select 0,_this select 4]);
			cutText ['You can not fire in a SafeZone!','WHITE IN'];
		};
		wild_spawnZombies = {};
		zombie_generate = {};
		
		fnc_usec_damageHandler = {};
		player removeAllEventHandlers 'handleDamage';
		player addEventHandler ['handleDamage', {false}];
		player allowDamage false;
		_veh = vehicle player;
		if (player != _veh) then
		{
			_szs = _veh getVariable ['inSafeZone',0];
			if (_szs == 0) then
			{
				_veh removeAllEventHandlers 'Fired';
				_veh addEventHandler ['Fired', {_this call player_fired;}];
				{
					_x removeAllEventHandlers 'Fired';
					_x addEventHandler ['Fired', {_this call player_fired;}];
				} forEach (crew _veh);
				_veh setVariable ['inSafeZone',1];
				vehicle_handleDamage = {false};
				_veh removeAllEventHandlers 'HandleDamage';
				_veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
				_veh allowDamage false;
			};
		};
		_notInSafeZone =
		[
			'MAAWS','RPG7V','M136','RPG18','STINGER',
			'MeleeHatchet_DZE','MeleeHatchet','MeleeCrowbar','MeleeMachete','MeleeFishingPole','MeleeSledge',
			'MeleeBaseBallBatNails','MeleeBaseBallBatBarbed','MeleeBaseBallBat'
		];
		_cwep = currentWeapon player;
		if (_cwep in _notInSafeZone) then
		{
			_swep = '';
			{
				if ((getNumber (configFile >> 'CfgWeapons' >> _x >> 'Type')) == 2) exitWith
				{
					_swep = _x;
				};
			} forEach (weapons player);
			if (_swep == '') then
			{
				player playActionNow 'PutDown';
				_iPos = getPosATL player;
				_radius = 1;
				_removed = ([player,_cwep,1] call BIS_fnc_invRemove);
				if (_removed == 1) then
				{
					_item = createVehicle ['WeaponHolder', _iPos, [], _radius, 'CAN_COLLIDE'];
					_item addWeaponCargoGlobal [_cwep,1];
				};
			}
			else
			{
				player selectweapon _swep;
			};
		};
	};
	_endSafeZone =
	{
		if (isNil 'inNow') then
		{
			if (str fnc_usec_damageHandler == '{}') then
			{
				_msg = 'You left the Safe Zone!';
				hint _msg;
				taskHint [_msg, [1,0,0.1,1], 'taskFailed'];
			};
			inNow = true;
			outNow = nil;
			
			if (LOG_EnterLeave) then
			{
				PVDZE_send = [player,'SafeZoneState',[0]];
				publicVariableServer 'PVDZE_send';
			};
		};
		wild_spawnZombies = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\wild_spawnZombies.sqf';
		zombie_generate = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\zombie_generate.sqf';
		
		player_fired = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\player_fired.sqf';
		fnc_usec_unconscious = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_unconscious.sqf';
		object_monitorGear = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\object_monitorGear.sqf';
		vehicle_handleDamage = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\vehicle_handleDamage.sqf';
		
		_veh = vehicle player;
		if (player != _veh) then
		{
			_szs = _veh getVariable ['inSafeZone',0];
			if (_szs == 1) then
			{
				_veh setVariable ['inSafeZone',0];
				_veh removeAllEventHandlers 'HandleDamage';
				_veh addeventhandler ['HandleDamage',{ _this call vehicle_handleDamage } ];
				_veh allowDamage true;
			};
		};
		
		_end = false;
		if (isNil 'gmadmin') then
		{
			_end = true;
		}
		else
		{
			if (gmadmin == 0) then
			{
				_end = true;
			};
		};
		if (_end) then
		{
			player allowDamage true;
			fnc_usec_damageHandler = compile preprocessFileLineNumbers '\z\addons\dayz_code\compile\fn_damageHandler.sqf';
			player removeAllEventHandlers 'HandleDamage';
			player addeventhandler ['HandleDamage',{_this call fnc_usec_damageHandler;} ];
		};
	};
	while {1 == 1} do
	{
		if (isNil 'inSafeZone') then { inSafeZone = false; } else { if (typename inSafeZone != 'BOOL') then { inSafeZone = false; }; };
		_state = false;
		if (isNil 'USE_POSITIONS') then { USE_POSITIONS = false; } else { if (typename USE_POSITIONS != 'BOOL') then { USE_POSITIONS = false; }; };
		if (USE_POSITIONS) then
		{
			{
				_z = _x select 0;
				_r = _x select 1;
				if ((vehicle player) distance _z < _r) then {_state = true;};
			} forEach _infiSZ;
		};
		if (isNil 'USE_CANBUILD') then { USE_CANBUILD = true; } else { if (typename USE_CANBUILD != 'BOOL') then { USE_CANBUILD = true; }; };
		if (USE_CANBUILD) then
		{
			if (isNil 'canbuild') then { canbuild = true; } else { if (typename canbuild != 'BOOL') then { canbuild = true; }; };
			if (!canbuild) then {_state = true;};
		};
		if (isNil 'USE_TraderCity') then { USE_TraderCity = true; } else { if (typename USE_TraderCity != 'BOOL') then { USE_TraderCity = true; }; };
		if (USE_TraderCity) then
		{
			if (isNil 'isInTraderCity') then { isInTraderCity = false; } else { if (typename isInTraderCity != 'BOOL') then { isInTraderCity = false; }; };
			if (isInTraderCity) then {_state = true;};
		};
		if (_state) then
		{
			inSafeZone = true;
			call _startSafeZone;
			{
				if (!isNull _x) then
				{
					if !(isPlayer _x) then
					{
						deletevehicle _x;
					};
				};
			} forEach ((vehicle player) nearEntities ['zZombie_Base',50]);
			
			if (isNil 'USE_AI_REMOVER') then { USE_AI_REMOVER = false; } else { if (typename USE_AI_REMOVER != 'BOOL') then { USE_AI_REMOVER = false; }; };
			if (USE_AI_REMOVER) then
			{
				{
					if ((!isNull group _x) && (getPlayerUID _x == '')) then
					{
						deleteVehicle _x;
					};
				} forEach (player nearEntities ['Man',100]);
			};
		}
		else
		{
			inSafeZone = false;
		};
		uiSleep 2;
		if (!inSafeZone) then
		{
			call _endSafeZone;
		};
	};
};
if ((USE_AntiSteal) || (USE_SPEEDLIMIT)) then
{
	[] spawn {
		_USE_AntiSteal = USE_AntiSteal;
		_USE_SPEEDLIMIT = USE_SPEEDLIMIT;
		_speedlimit = SPEEDLIMIT;
		while {1 == 1} do
		{
			if (inSafezone) then
			{
				if (_USE_AntiSteal) then
				{
					_cnt = {isPlayer _x && _x != player} count (player nearEntities [['CAManBase'], 3]);
					if ((_cnt > 0) && (!isNull (findDisplay 106))) then
					{
						(findDisplay 106) closedisplay 0;
						closeDialog 0;
						_log = format['%1 You are not allowed to open Gear while near another player!',name player];
						cutText [_log,'PLAIN'];
						hint _log;
					};
				};
				if (_USE_SPEEDLIMIT) then
				{
					_obj = vehicle player;
					if !(_obj isKindOf 'Plane') then
					{
						_speed = abs speed _obj;
						if ((_obj != player) && (_speed > _speedlimit)) then
						{
							_vel = velocity _obj;
							_x = 0.8;
							if (_speed > 50) then {_x = 0.1;};
							_velNew = [(_vel select 0) * _x, (_vel select 1) * _x,(_vel select 2) * _x];
							_obj SetVelocity _velNew;
						};
					};
				};
			}
			else
			{
				uiSleep 2;
			};
			uiSleep 0.1;
		};
	};
};

Link to comment
Share on other sites

  • 0

I remember an issue on server i play on when they implemented a new safezone script that used speed limits, and when using the tp function in or out of traders, or changing clothes (which effectively is a teleport to debug and back)

inside traders caused some funk with god mode. Players would have god outside of trader and admins gods weren't working. Not sure which script, but it had something to do with speed limits.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...