GZRep

Help with safezone script?

5 posts in this topic

Posted (edited)

Hello guys!
Im working on a safezone script but im a bit stuck...

First...
What i try to do is make a certain area on the map invincible/god-mode protected (vehicles, players and territory-buildables) but still be able to build.

So here is what i have done so far:

In mission folder - mission.sqm

Spoiler

// GZRep Protection Script
        class Item36
        {
            position[]={22146.713,3.3687522,14468.044};
            name="GZProtection";
            markerType="ELLIPSE";
            type="Empty";
            colorName="ColorUNKNOWN";
            fillName="Solid";
            a=250;
            b=250;
        };
    };
    class Sensors
    {
        items=1;
        
        // GZRep Protection Script
        class Item0
        {
            position[]={22146.713,3.3687522,14468.044};
            a=250;
            b=250;
            activationBy="ANY";
            repeating=1;
            interruptable=1;
            age="UNKNOWN";
            name="GZProtection";
            expCond = "(player distance GZProtection) < 250;";
            expActiv="hint ""Entering Protected Area - Protection ON"";  inGZProtection = true;";
            expDesactiv="hint ""Leaving Protected Area - Protection OFF""; inGZProtection = false;";
            class Effects
            {
            };
        };
    };

In mission folder - init.sqf

Spoiler

// GZRep Protection Script
[] execVM "addons\GZProtection.sqf";

In mission folder - addons\GZProtection.sqf

Spoiler

////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
///// GZRep Protection Script
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////

if (isNil "GZProtection") then {inGZProtection = false;};

while {true}

do {

    private ["_GZPlayerSetDamage", "_GZPlayerHandleDamage", "_GZFired", "_GZVehiclePlayerSetDamage", "_GZVehiclePlayerHandleDamage"];
    ///////////////////////////////////////////////////////////////////
    // ENTER PROTECTION
    ///////////////////////////////////////////////////////////////////
    waitUntil {inGZProtection};

    // Player
    player allowDamage false;
    _GZPlayerSetDamage = player addEventhandler["SetDamage",{false}];
    _GZPlayerHandleDamage = player addEventhandler["HandleDamage",{false}];
    _GZFired = player addEventHandler ["Fired", {deleteVehicle (_this select 6); systemChat ("NOT ALLOWED IN THIS AREA!");}];

    // Vehicle Player
    vehicle player allowDamage false;
    _GZVehiclePlayerSetDamage = vehicle player addEventhandler["SetDamage",{false}];
    _GZVehiclePlayerHandleDamage = vehicle player addEventhandler["HandleDamage",{false}];
    
    ///////////////////////////////////////////////////////////////////
    // EXIT PROTECTION
    ///////////////////////////////////////////////////////////////////
    waitUntil {!inGZProtection};
    
    // Player
    player allowDamage true;
    player removeEventhandler["SetDamage", _GZPlayerSetDamage];
    player removeEventhandler["HandleDamage", _GZPlayerHandleDamage];
    player removeEventHandler["Fired", _GZFired];
    
    // Vehicle Player
    vehicle player allowDamage true;
    vehicle player removeEventhandler["SetDamage", _GZVehiclePlayerSetDamage];
    vehicle player removeEventhandler["HandleDamage", _GZVehiclePlayerHandleDamage];
};

So, when i enter the are on the map in-game i see the notifications going on and off correctly when entering / exiting area.
I also se the warning message for the "Fired" event handler and not being able to fire a weapon in the area is also working.
But vehicles are still getting damaged/destroyed...

I want it to work like the Exile safezones. Not being able to destroy other vehicles or you own.
But still be able to build and place territory.

Tnx up front for all help :D

Edited by GZRep

Share this post


Link to post
Share on other sites

i found an easy way by adding a protection zone in the editor inwhich is god mode at all times and i believe you can build on it also but not 100% sure

Share this post


Link to post
Share on other sites
Advertisement
9 minutes ago, hogansheroes said:

i found an easy way by adding a protection zone in the editor inwhich is god mode at all times and i believe you can build on it also but not 100% sure

Would you care to explain what you did? :)

Share this post


Link to post
Share on other sites
10 hours ago, GZRep said:

Would you care to explain what you did? :)

sorry for late reply mate in the editor just type in protection and it will come up with a few things but put the invisible box one in 

Share this post


Link to post
Share on other sites

Posted (edited)

5 hours ago, hogansheroes said:

sorry for late reply mate in the editor just type in protection and it will come up with a few things but put the invisible box one in 

Okay, so i tried that out now.
I removed my protection script to try this out clean.

Im able to get the zones to protect from any kind of weapon firing...
But vehicles still explode, and players can still be killed?

Edited by GZRep

Share this post


Link to post
Share on other sites
Advertisement

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

  • Recently Browsing   0 members

    No registered users viewing this page.