DirkScripts Logo

Login With FiveM

Login

πŸ–₯️ Dirk Core
β€Ί
Functions
β€Ί
Client
β€Ί

πŸ”» Zones

πŸ”» Zones

Register

This is how you register a zone this is best used if you need to check if a player has entered/exited a zone or whether they are contiously inside it

lua
Core.Zones.Register("zoneIdentifier", {
  Type   = "poly", --## "circle", "poly", "box"
  Zone   = { --## "poly":table "circle":vec2(2d)/vec3(3d) "box":table {Width:2.0, Height:2.0, Pos:vector4(0,0,0,0)}
    vector3(0,0,0),
    vector3(0,0,0),
  },
  Radius = 2.5,    --## "circle" ONLY 

  Draw   = { --## OPTIONAL: Used to determine if you are drawing the zone and if so what colour etc
    Enabled = false, 
    Col     = {R = 255, G = 0, B = 100, A = 50}, 
  },


  onStayLoopTime = 500, --## OPTIONAL: WILL SEND YOUR onStay FUNCTION EVERY 500ms 
  onStay  = function() --## OPTIONAL

  end,

  onEnter = function() --## OPTIONAL: Will be triggered when a player enters this zone

  end,

  onExit  = function() --## OPTIONAL: Will be triggered when a player exits this zone

  end 
})

RemoveZone

lua
Core.Zones.RemoveZone("zoneIdentifier")

ToggleDraw

lua
Core.Zones.ToggleDraw("zoneIdentifier", true) --## true to draw, false to not draw...

EditColors

lua
Core.Zones.EditColors("zoneIdentifier", {R = 155, G = 0, B = 0, A = 50})

CreatePolygon

This will allow you create a polygon in-game which then will be copied to your clipboard for easy pasting into your scripts etc

lua
RegisterCommand("Dirk-Core:DrawPolygon", function(source,arg)
  local polygon = Core.Zones.CreatePolygon()
  Core.UI.Notify("Copied Polygon to Clipboard")
  print(Core.UI.CopyToClipboard(json.encode(polygon)))
end)

--## This is a command built into dirk-core for quickly creating polyzones but you 
--## could use this Core.Zones.CreatePolygon() anywhere you wanted...

IsPointInside

Could be used if you don't want to register polyzones for some reason and just want a one off check if a point is inside

{% code fullWidth="false" %}

lua
local polygon = {
    vector3(0,0,0),
    vector3(0,0,0),
    vector3(0,0,0),
}

local isInside = Core.Polygon.IsPointInside(vector3(0,0,0), polygon)
print("This point is inside this zone ", isInside)

{% endcode %}

plotPolygon

This will plot points within a polygon at seperation distances of your choosing aswell as the width of each cell

lua
local polygon = {
    vector3(0,0,0),
    vector3(0,0,0),
    vector3(0,0,0),
}

local pointWidth      = 1.0 --## How big these points are
local pointSeperation = 0.5 --## How far apart the points are

local plottedPoints = Core.Polygon.plotPolygon(polygon, pointSeperation, pointWidth)

--## This will return a bunch of plotted points within the polygon with the settings 
--## that you have chosen, I used this for spawning a bunch of random objects at random 
--## points within a polygon.

Copyright Β© 2026 DirkScripts.

Not affiliated with or endorsed by Rockstar North, Take-Two Interactive, or any other rights holders. FiveM is a copyright and registered trademark of Take-Two Interactive Software, Inc.
Our checkout system is provided by Tebex Limited, who manage payment processing, product delivery, and billing support. Prices shown in currencies other than GBP are approximate conversions updated daily. All purchases are processed in GBP, so the final amount charged may vary depending on your bank or payment provider’s exchange rate.

Daily dig available!

Hey you, you have free digs waiting

Dig Now