Author Topic: Tutorial - Custom Zone Restriction 2  (Read 562 times)

Unkl

  • Site Administrator
  • Administrator
  • Newbie
  • *****
  • Posts: 41
  • Karma: +3/-0
    • View Profile
Tutorial - Custom Zone Restriction 2
« on: April 01, 2020, 03:19:30 AM »
The video tutorial for this script is available at: https://youtu.be/41troBy9fcU

To use this you need to have a named trigger which will detect your players as being in the zone and in the activation you will put:
zoneR = [nameOfTrigger, zoneType]execVM "Unk\fn_zoneRestrictor.sqf";
Where you use the name of your trigger and then zoneType can either be "inside" or any other value for "outside". This sets whether you want the trigger to be activated when the player is inside the zone or outside of the zone. It is a recent addition to the script as requested by Gamms from ISG.

Here is the full code:
Code: [Select]
//fn_zoneRestrictor.sqf by Unkl of PracticallyRealGaming.com (formerly TacticalGamer.com)
//Guide: available at forums.PracticallyRealGaming.com
//usage: zoneR = [nameOfTrigger, zoneType]execVM "Unk\fn_zoneRestrictor.sqf";
//zoneType possible values are - inside, outside. These correspond with either being inside the trigger zone or outside the trigger zone

_triggerActivated = _this select 0;
_triggerType = _this select 1;
_mssg = "fn_zoneRestrictor encountered an error if you see this";

if (_triggerType == "inside") then {
  if !(player in (list _triggerActivated)) exitWith {};
  _mssg = "YOU HAVE 7 SECONDS TO LEAVE THIS AREA";
} else {
  if (player in (list _triggerActivated)) exitWith {};
  _mssg = "YOU HAVE 7 SECONDS TO RETURN TO THE AO";
}

player groupChat "RETURN TO YOUR ASSIGNED AREA IMMEDIATELY!";
playSoundWarning = true;
cutText [_mssg, "plain", 0];
titleFadeout 5;

sleep 7;
if (_triggerType == "inside") then {
  if (player in (list _triggerActivated)) then
  {
    player setDamage 1;
    player groupChat "YOU HAVE BEEN KILLED FOR LEAVING YOUR AREA";
  } else {
    if (side player == west || side player == independent) then {player groupChat "YOU HAVE CLEARED THE UNAUTHORIZED ZONE";};
  };
} else {
  if !(player in (list _triggerActivated)) then
  {
    player setDamage 1;
    player groupChat "YOU HAVE BEEN KILLED FOR LEAVING YOUR AREA";
  } else {
    if (side player == west || side player == independent) then {player groupChat "YOU HAVE CLEARED THE UNAUTHORIZED ZONE";};
  };
}