Hello and thanks for readme, sorry if its a stupid question I’m a little new with lua. I’m trying to get coords with “local pos” and get it on the other “for”, but I don’t know how. Now on console shows "attempt to index a nil value (‘local pos’). This code basically what do its draw a mark where the player is dead.
Citizen.CreateThread(function()
while true do
Citizen.Wait(7)
for i,data in pairs(deadPlayers) do
local pos = GetEntityCoords(PlayerPedId(), true)
end
for i,player in ipairs(GetActivePlayers()) do
local pos2 = GetEntityCoords(PlayerPedId(), true)
if ESX.GetPlayerData().job.name == "ambulance" and GetDistanceBetweenCoords(pos.x, pos.y,
pos.z, pos2.x, pos2.y, pos2.z, true) < 2.5 then
DrawMarker(22, pos.x, pos.y, pos.z+0.5, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 187, 4, 4, 50, false,
true, 2, nil, nil, false)
end
end
end
end)