-- Enter / Exit marker events & Draw Markers
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local coords = GetEntityCoords(PlayerPedId())
local isInMarker, letSleep, currentZone = false, true
for k,v in pairs(Config.Zones) do
local distance = #(playerCoords - v.Pos)
if distance < Config.DrawDistance then
letSleep = false
if v.Type ~= -1 then
DrawMarker(v.Type, v.Pos, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, v.Size.x, v.Size.y, v.Size.z, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 100, false, true, 2, false, nil, nil, false)
end
if distance < v.Size.x then
isInMarker, currentZone = true, k
end
end
end
if (isInMarker and not HasAlreadyEnteredMarker) or (isInMarker and LastZone ~= currentZone) then
HasAlreadyEnteredMarker, LastZone = true, currentZone
LastZone = currentZone
TriggerEvent('esx_aircraftshop:hasEnteredMarker', currentZone)
end
if not isInMarker and HasAlreadyEnteredMarker then
HasAlreadyEnteredMarker = false
TriggerEvent('esx_aircraftshop:hasExitedMarker', LastZone)
end
if letSleep then
Citizen.Wait(500)
end
end
end)
COMMUNITY QUESTION
ERROR: main.lua:9: attempt to perform arithmetic on a nil value (global 'playerCoords') help?
1 answer
you have a # before the (playerCoords - v.Pos)
hash tags are supposed to meen the number of things in it for example #game.Players wich would probaly give you a error to but I dont know much about these, that is all I know about them.
1 comment
0
btw I might be wrong because I dont know much about them.
This discussion is preserved as it was. New answers, comments, and votes are closed.

1 comment
hmm