Jump to content

How to make so you can't create objects in MTA Dayz server in specific zone.


Recommended Posts

Use colshapes to create safe zones. 

local shapes = {}
local positions = { {123, 456, 50, 50}, {123, 456, 50, 50} }

for k, v in ipairs(positions) do
  local shape = createColRectangle( ... )
  table.insert(shapes, shape)
end


function startBuilding()
  if not isPlayerInSafezone(player) then
    -- building code
  else
    outputChatBox("in safe zone")
  end
end

function isPlayerInSafezone(player)
  for k, v in ipairs(shapes) do
    if isElementWithinColShape(player, v ) then
      return true
    end
  end
  return false
end
    

Not a working code, modify it yourself to suit your needs (eg. player element)

Link to comment

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.
×
×
  • Create New...