So I made this script:
local markerPos = vector3(-263.10089111328,-967.615234375,31.224607467651)
Citizen.CreateThread(function()
local ped = GetPlayerPed(-1)
while true do
Citizen.Wait(500)
local playerCoords = GetEntityCoords(ped)
local distance = #(playerCoords - markerPos)
if distance < 100.0 then
DrawMarker(25, markerPos.x, markerPos.y, markerPos.z + 1, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 2.0, 2.0, 2.0, 255, 128, 0, 50, false, true, 2, nil, nil, false)
else
Citizen.Wait(2000)
end
local inMarker = false
if distance < 2.0 then
inMarker = true
end
if inMarker then
TriggerServerEvent('vpj:adaugajob')
end
end
end)
And when I start up the server, the resource starts up, no errors in console (neither client or server) but the marker isn’t drawn. If I restart the resource it works but if I leave the server and join back again it stops working and I have to restart it again.