Safe Zones [Working]

Is there a way to add exceptions to the rule by via player UID? So, for example, there could be guards to protect against zombies etc inside the base?
 
Is there a way to add exceptions to the rule by via player UID? So, for example, there could be guards to protect against zombies etc inside the base?

i imagine you could change the if player statement to and if Player UID using scripts like is used in the admin tools menues just change what it does instead of works on admin menu i can see if i can make that for you.
 
Actually, I made my own version of this for a rescue HQ we have on our map.

This version removes the players zombie trigger so they are not attacked and if they attempt to fire, removes all their weapons. This gives the option to have guards or the like at your base/zone.

Code:
Private ["_EH_Fired"];
 
if (isNil "inSafezone") then {
    inSafezone = false;
};
 
while {true} do {
    _playerUID = getPlayerUID player;
    waitUntil { inSafeZone };
    // Insert player UIDs that you wish to be the guards.
    if (_playerUID in ["XXXXXXXXX","XXXXXXXXX"]) then
    {
    titleText [format["Welcome home chaps! I hope you gave the hun a good what for!"],"PLAIN DOWN"]; titleFadeOut 4;
    } else {
    titleText [format["Now approaching DayZCherno+ Special Operations & Rescue HQ. This is a safe zone and zombies will not hurt you. ATTN: IF YOU FIRE, YOUR WEAPONS WILL BE REMOVED!"],"PLAIN DOWN"]; titleFadeOut 4;
    waitUntil { player == vehicle player };
    thePlayer = vehicle player;
    _EH_Fired = thePlayer addEventHandler ["Fired", {
        titleText ["We did warn you this would happen!","PLAIN DOWN"]; titleFadeOut 4;
        removeAllWeapons player;
        NearestObject [_this select 0,_this select 4] setPos[0,0,0];
    }];
    player_zombieCheck = {};
    };
    waitUntil { !inSafeZone };
    // Again, insert player UIDs that you wish to be the guards.
    if (_playerUID in ["XXXXXXXXX","XXXXXXXXX"]) then
    {
    titleText [format["Good luck out there boys! Stay frosty!"],"PLAIN DOWN"]; titleFadeOut 4;
    } else {
    titleText [format["Now leaving DayZCherno+ Special Operations & Rescue. You can now use your gun as normal. Stay safe out there!"],"PLAIN DOWN"]; titleFadeOut 4;
    thePlayer removeEventHandler ["Fired", _EH_Fired];
    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    };
};


Enjoy!
 
Actually, I made my own version of this for a rescue HQ we have on our map.

This version removes the players zombie trigger so they are not attacked and if they attempt to fire, removes all their weapons. This gives the option to have guards or the like at your base/zone.

Code:
Private ["_EH_Fired"];
 
if (isNil "inSafezone") then {
    inSafezone = false;
};
 
while {true} do {
    _playerUID = getPlayerUID player;
    waitUntil { inSafeZone };
    // Insert player UIDs that you wish to be the guards.
    if (_playerUID in ["XXXXXXXXX","XXXXXXXXX"]) then
    {
    titleText [format["Welcome home chaps! I hope you gave the hun a good what for!"],"PLAIN DOWN"]; titleFadeOut 4;
    } else {
    titleText [format["Now approaching DayZCherno+ Special Operations & Rescue HQ. This is a safe zone and zombies will not hurt you. ATTN: IF YOU FIRE, YOUR WEAPONS WILL BE REMOVED!"],"PLAIN DOWN"]; titleFadeOut 4;
    waitUntil { player == vehicle player };
    thePlayer = vehicle player;
    _EH_Fired = thePlayer addEventHandler ["Fired", {
        titleText ["We did warn you this would happen!","PLAIN DOWN"]; titleFadeOut 4;
        removeAllWeapons player;
        NearestObject [_this select 0,_this select 4] setPos[0,0,0];
    }];
    player_zombieCheck = {};
    };
    waitUntil { !inSafeZone };
    // Again, insert player UIDs that you wish to be the guards.
    if (_playerUID in ["XXXXXXXXX","XXXXXXXXX"]) then
    {
    titleText [format["Good luck out there boys! Stay frosty!"],"PLAIN DOWN"]; titleFadeOut 4;
    } else {
    titleText [format["Now leaving DayZCherno+ Special Operations & Rescue. You can now use your gun as normal. Stay safe out there!"],"PLAIN DOWN"]; titleFadeOut 4;
    thePlayer removeEventHandler ["Fired", _EH_Fired];
    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    };
};


Enjoy!


thats good still id rather not have the uid restriction
 
is there a way to remove the damage on vehicles and removing the availabililty to steal things from backpacks? cause actually i'm using this safezone script on my server but in my trader cities the players just cry cause sometimes other player destroy their cars or rob them while they in a trading process... but i think a "safe zone" should really be safe... safe for everything u have with u...

also if someone of u has an idea, i'm running dayz epoch and is there a way to add kind of a godmode to locked vehicles?
 
Hi ghostphantom172, may i ask u something? why u added two class sensors?, if i only want 1 safe zone what i should write? (sorry for my english) and thanks for this awesome script i was looking alot of it : ).-
 
write it like this :)

Code:
class Sensors
    {
    items=1;
    class Item0
        {
            position[]={11471,0,11333};
            ractivationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="trading_post1";
            expCond="(player distance trading_post1) < 80;";
            expActiv="inSafeZone = true;";
            expDesactiv="inSafeZone = false;";
        class Effects
        {
        };
    };
};
 
oh thanks and my last question, we need to create a folder with this name "scripts" and move there the safazone.sqf right?, because i was Reading this: [] execVM "scripts\safezone.sqf";
 
is there a way to remove the damage on vehicles and removing the availabililty to steal things from backpacks? cause actually i'm using this safezone script on my server but in my trader cities the players just cry cause sometimes other player destroy their cars or rob them while they in a trading process... but i think a "safe zone" should really be safe... safe for everything u have with u...

also if someone of u has an idea, i'm running dayz epoch and is there a way to add kind of a godmode to locked vehicles?


well i have figured out the gear part but right now i can only get it to not allow and gear function but im working on making it for a person only, the car damage i will work on next
 
if you want the new code for when firing in safezone no agroo and no gear in safezone Notice the Changes

Code:
Private ["_EH_Fired"];
 
if (isNil "inSafezone") then {
    inSafezone = false;
};
 
while {true} do {
    waitUntil { inSafeZone };
    titleText [format["Entering Safe Zone! Weapons off, and shooting wastes ammo."],"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 = {};
    player_fired = {};
    fnc_usec_damageHandler = {};
    fnc_usec_unconscious  = {};
    object_monitorGear = {};
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer addEventHandler ["handleDamage", {false}];
    thePlayer allowDamage false;
 
    waitUntil { !inSafeZone };
 
    titleText [format["Exiting Safe Zone!"],"PLAIN DOWN"]; titleFadeOut 4;
    thePlayer removeEventHandler ["Fired", _EH_Fired];
 
    player_zombieCheck = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_zombieCheck.sqf";
    player_fired = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\player_fired.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";
    object_monitorGear = compile preprocessFileLineNumbers "\z\addons\dayz_code\compile\object_monitorGear.sqf";
    thePlayer addEventHandler ["handleDamage", {true}];
    thePlayer removeAllEventHandlers "handleDamage";
    thePlayer allowDamage true;
 
};
 
cool... if u use epoch too u could try goin with the "Tag as Friendly" option to allow only players who are tagged as firendly to use the gear of your backpack... :D

and well... the car damage... i've seen some kind of "godmode" script for vehicles but those are from an admin-menu script and just sets the damage of the car every second to 0... but this would mean, as soon as someone drives inside the safe zone: "whoop magic my car is repaired" ^^

well i'm a code n00b but isnt it possible to do it something like this:

theCar removeAllEventHandlers "handleDamage";
theCar addEventHandler ["handleDamage", {false}];
theCar allowDamage false;

but the problem i think is the following line cause i dont know what to write in ^^
theCar = ?????

for "thePlayer" it is
thePlayer = vehicle player;

:)

maybe u can find something in the vehicle_handleDamage.sqf ?
got one from epoch here: https://github.com/vbawol/DayZ-Epoch/blob/master/SQF/dayz_code/compile/vehicle_handleDamage.sqf
 
thats more or less on what im going for but it is still gonna take me some time to get it figures out, and the gear monitor.sqf handles the backpacks tents and cars so there has to be a script to remove those actions without removing them all


EDIT:
on the car part it needs to be set to LandVehicle for cars
but the fact is that is not enough considering the vehicles will only be invulnerable when a player is in the zone you would need to set it up for a vehicle in the zone causes the vehicle to be invulnerable!
 
i would be happy also with a version that only works when there are players inside the zone... cause when somebody leaves his car alone in the safezone... well... it would be ok for me when it can be destroyed then...

theCar = LandVehicle

would that work? together with

theCar removeAllEventHandlers "handleDamage";
theCar addEventHandler ["handleDamage", {false}];
theCar allowDamage false;

would be cool if it is this easy ^^ cause then i would add that as soon as possible to my server :p
 
Back
Top