I’m not sure what is wrong. No marker is drawn.
If the player is in the server, and the resource is restarted the marker draws? But not when the player first joins…
No errors in the logs at all.
Citizen.CreateThread(function()
Citizen.Trace("Loading Train Markers.")
while true do
Wait(0)
if Config.ModelsLoaded then
local coords = GetEntityCoords(Config.localPed)
for i=1, #Config.TrainLocations, 1 do
if(GetDistanceBetweenCoords(coords, Config.TrainLocations[i].x, Config.TrainLocations[i].y, Config.TrainLocations[i].z, true) < Config.DrawDistance) then
DrawMarker(Config.MarkerType, Config.TrainLocations[i].x, Config.TrainLocations[i].y, Config.TrainLocations[i].z, 0.0, 0.0, 0.0, 0, 0.0, 0.0, Config.MarkerSize.x, Config.MarkerSize.y, Config.MarkerSize.z-2.0, Config.MarkerColor.r, Config.MarkerColor.g, Config.MarkerColor.b, 75, 0, 1, 2, 0, 0, 0, 0)
end
if(GetDistanceBetweenCoords(coords, Config.TrainLocations[i].x, Config.TrainLocations[i].y, Config.TrainLocations[i].z, true) < Config.MarkerSize.x / 2) then
if(IsControlPressed(0,58) and(GetGameTimer() - Config.EnterExitDelay) > Config.EnterExitDelayMax) then -- G
Config.EnterExitDelay = 0
Wait(60)
createNewTrain(Config.TrainLocations[i].trainID, Config.TrainLocations[i].trainX, Config.TrainLocations[i].trainY, Config.TrainLocations[i].trainZ)
end
end
end
end
end
end)
I’m stumped. I even put everything from my config.lua into my client.lua (main file) to see if it wasn’t loading the config on time, but it is (It still didn’t work). So I have no idea why it’s occurring…
Here is the config it’s referencing
Config.TrainLocations = {
{ ['x'] = 247.965, ['y'] = -1201.17, ['z'] = 38.92, ['trainID'] = 24, ['trainX'] = 247.9364, ['trainY'] = -1198.597, ['trainZ'] = 37.4482 }, -- Trolley
{ ['x'] = 670.2056, ['y'] = -685.7708, ['z'] = 25.15311, ['trainID'] = 2, ['trainX'] = 670.2056, ['trainY'] = -685.7708, ['trainZ'] = 25.15311 }, -- FTrain
}