Drawmarkers and markers flickering

Good day, I only recently came back to FiveM and I have started working on a server and have realised that a few markers are blinking and drawtexts as well. or even flickering. I have already tried to set Citizen.Wait to 0 in some scripts but thats not help.

Please someone let me know if they have a better idea.

I would be happy to take a look if you could please share the code of one of the problematic areas.
I can’t do much without seeing an example of one of your loops that has flashing markers.

Good day, I have the problem with this script: [Release] [ESX] 99kr-shops The DrawText and the Markers are flickering. Thank you for trying to help :slight_smile:

Try changing \client\shop.lua, line 4 to local wait = 0

That won’t do anything.
That wait is 750 when not near any shop shelf. But is reassigned to 5 when near.
The markers don’t get drawn when not near so that 750 is not the issue.

There was some stuff in the code that could slow it down if there are lots of shelves.
I rewrote it to make it faster and neater. Not sure if it’s enough, but it could help.

--[[ Marker loop ]]--
CreateThread(function()
	while true do
		local wait = 750
		local coords = GetEntityCoords(PlayerPedId())
		for i = 1, #Config.Locations do
			for j = 1, #Config.Locations[i].shelfs do
				local pos = Config.Locations[i].shelfs[j]
				local dist = #(coords - vector3(pos.x, pos.y, pos.z))
				if dist <= 5.0 then
					if dist <= 1.5 then
						if dist <= 1.0 then
							if IsControlJustPressed(0, 38) then
								OpenAction(pos, Config.Items[pos.value], Config.Locales[pos.value])
							end
						end
						local text = "[E] " .. Config.Locales[pos.value]
						DrawText3D(pos.x, pos.y, pos.z, text)
					end
					wait = 0
					Marker(pos)
				end
			end
		end
		Wait(wait)
	end
end)
1 Like

Appreciate it a lot, this has fixed it for me :slight_smile: Thank you!