Player Blip Disappearing after a small Distance

Hello,
I’m trying to make a “tracker” script where players can see their friends on the map according to the group they’re in. All of the code is completed, and it works almost but I have a blip issue where blips are only displayed for a relatively short distance (a few blocks). Could someone please tell me what i’m doing wrong here?

Citizen.CreateThread(function()
	while true do
		if trackedGroup ~= nil then
			for i, user in ipairs(trackedGroup.users) do
				local player = GetPlayerFromServerId(user.playerId)
				local ped = GetPlayerPed(player)
				if GetPlayerPed(-1) ~= ped then
					if GetBlipFromEntity(ped) == 0 then
						local blip = AddBlipForEntity(ped)
						SetBlipSprite(blip, 1)
						SetBlipColour(blip, user.colour)
						SetBlipDisplay(blip, 4)
						BeginTextCommandSetBlipName("STRING")
						AddTextComponentString(user.name)
						EndTextCommandSetBlipName(blip)
					end
				end
			end
		end
		Wait(1)
	end
end)

I’ve also tried using:

SetBlipAsShortRange(blip, false)
and
SetBlipAsShortRange(blip, true)

But neither seem to make a difference.

I’m assuming you are using onesync. When using onesync players are not aware of any entities (including players) that are more than ~300 units away from them. This means you will not be able to get the player ped of a player that is not in the same scope as you. To accomplish this you would have to get the players coordinates on the server and send them (via events) to each client and create the blip using AddBlipForCoord instead of AddBlipForEntity. I believe if you search the forums there will be examples of this.

Hi, that makes sense… but it works already for esx_policejob, and other scripts that create the blips in a very similar way that I am above? So i don’t understand how it can work for those, but not this.

Looking at the code for esx_policejob I believe it will have the same issue on onesync as once a client is out of scope you are not able to get that clients ped and therefor the blip will remove.

Apologies for the necro however I have spent about 12 hours on this issue

and the solution is infact to disable onesync in your server.cfg

change the config line from “set onesync on” to “set onesync off”

All my blips instantly work globally now on the map

I was too busy looking for code examples - when the problem was a server setting all along

onesync seems to set a server side limitation for distance

You could probably overcome this with server side scripting, however almost no-one online discusses server side scripting to overcome this issue, most scripts people release for blips are client side, and you can never overcome this issue with client side scripting

That’s not a fix to this issue. Disabling Onesync will create many other issues.

EDIT - To fix this issue I had to re-write the way it works, you’ll be able to find an example on my GitHub.