kusanagy

Restricted Zone

Oct 23rd, 2018
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.97 KB | None | 0 0
  1. local ZoneCheck = {
  2.        AllowedZones = {
  3.                [4] = true,
  4.                [2557] = true,
  5.                [3277] = true,
  6.                [2597] = true,
  7.                [3358] = true,
  8.        },
  9.        TeleportLocations = {
  10.                -- [TeamId] = {Map, X, Y, Z, Orientation}
  11.                [0] = {0, -10998, -3400, 62.5, 0},
  12.                [1] = {0, -10900, -2700, 7.6, 0},
  13.        },
  14.        RestrictedMessage = "You have entered a restricted zone. You have been removed from the area."
  15. }
  16.  
  17. function ZoneCheck.OnChange(event, player, newZone)
  18.        if not player:IsGM() then
  19.                if not(ZoneCheck.AllowedZones[newZone]) then
  20.                        local map, x, y, z, o = table.unpack(ZoneCheck.TeleportLocations[player:GetTeam()])
  21.                        player:Teleport(map, x, y, z, o)
  22.                        player:SendAreaTriggerMessage(ZoneCheck.RestrictedMessage)
  23.                end
  24.        end
  25. end
  26.  
  27. RegisterPlayerEvent(27, ZoneCheck.OnChange)
Advertisement
Add Comment
Please, Sign In to add comment