Hey guys, I’ve been scripting in Fivem for quite a while until now. I have been using this snippet code for displaying markers and coordinate detection.
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
local pedCoords = GetEntityCoords(PlayerPedId())
local letSleep = true
for k,v in pairs(Config.Chest) do
local dist = #(pedCoords - v.coords)
if dist < 25 then
-- display marker
letSleep = false
if dist < 1.5 then
-- display help notification
if IsControlJustReleased(0, 38) then
--do something
end
end
end
end
if letSleep then
Citizen.Wait(500)
end
end
end)
How do you guys usually do this?