fivem icon indicating copy to clipboard operation
fivem copied to clipboard

99 Blip Limits

Open TGIANN opened this issue 10 months ago • 9 comments

What happened?

When more than 99 blips are added, the names of other blips disappear. a set command needs to be added to increase this limit. nowadays servers use a lot of blips.

Image

Expected result

blip limit should have been increased

Reproduction steps

  1. I added more than 99 blips.
  2. opened the map and checked the names

Importancy

Unknown

Area(s)

FiveM

Specific version(s)

Any version

Additional information

  • A few forum topics previously opened with this problem
  1. https://forum.cfx.re/t/how-can-i-bypass-the-blip-limit/4831552
  2. https://forum.cfx.re/t/change-maximum-amount-of-blips/1059087
  3. https://forum.cfx.re/t/map-blip-legend-disappearing/5175777

TGIANN avatar Apr 13 '25 15:04 TGIANN

doesn't it affect the server performance ?

rwixy avatar Apr 13 '25 16:04 rwixy

Hi. From my knowledge there is not a 99 limit.

You're dealing with either native misuse / race conditions on natives.

I'll test right now and come back with some answers.

d22tny avatar Apr 14 '25 02:04 d22tny

Yup, exactly.

More than 99 unique blips names ( everything is fine ) :

Image

More than 99 entries for the same named blips ( still everything fine )

Image

So as i told you, there is no 99 limit, only bad code.

d22tny avatar Apr 14 '25 02:04 d22tny

With this PR merged, you should be able to have 133 named blip categories and then 120 more unnamed ones.

Keep in mind that as of writing this, this change is not available on the Production/Release update channel. It should be in the coming days though.

Gogsi avatar Apr 14 '25 07:04 Gogsi

With this PR merged, you should be able to have 133 named blip categories and then 120 more unnamed ones.

Keep in mind that as of writing this, this change is not available on the Production/Release update channel. It should be in the coming days though.

Still, if he use the same creation logic as he does now, he will still be left with unnamed blips.

d22tny avatar Apr 14 '25 13:04 d22tny

Yup, exactly.

More than 99 unique blips names ( everything is fine ) :

Image

More than 99 entries for the same named blips ( still everything fine )

Image

So as i told you, there is no 99 limit, only bad code.

Image

I tried with my test command, the blips are distorted again If you increase the number of blips more, this time the "ge" text will also removed :D

local blipId = 0

local function generateRandomIntCoords()
	local x = math.random(-3500, 3500)
	local y = math.random(-3500, 3500)
	return x, y
end

local function createBlip(sprite, colour, blipName)
	local x, y = generateRandomIntCoords()
	local blip = AddBlipForCoord(x + 0.0, y + 0.0, 1.0)
	SetBlipSprite(blip, sprite or math.random(118, 137))
	SetBlipDisplay(blip, 4)
	SetBlipScale(blip, 0.5)
	SetBlipColour(blip, colour or math.random(1, 30))
	SetBlipAsShortRange(blip, true)
	BeginTextCommandSetBlipName("STRING")
	blipName = blipName or string.format("My Custom Blip %d", blipId)
	AddTextComponentString(blipName)
	EndTextCommandSetBlipName(blip)
	blipId = blipId + 1
	print(blipName, "Added")
end


for _ = 1, 100 do
	createBlip(357, 3, "Garage") -- simulate a garages
end
for _ = 1, 100 do
	createBlip(40, 2, "Test House")
end
for _ = 1, 100 do
	createBlip() -- full random
end

TGIANN avatar Apr 14 '25 17:04 TGIANN

If i remember correctly, the issue happens because this gets called a lot on the same ticks.

BeginTextCommandSetBlipName("STRING")
blipName = blipName or string.format("My Custom Blip %d", blipId)
AddTextComponentString(blipName)
EndTextCommandSetBlipName(blip)

So, to solve this, inside each for loop add a Wait(1) or Wait(2), that should register all the string components.

for _ = 1, 100 do
    Wait(1)
    createBlip(40, 2, "Test House")
end

Looking back at my code, i see i have Wait(math.random(1,100), i don't know why i did that at the time, i've done this a really long time ago.

d22tny avatar Apr 14 '25 18:04 d22tny

Yes, the problem solved when I added Wait(1) but I think it is absurd to be like this, I think

TGIANN avatar Apr 16 '25 16:04 TGIANN

No, it's not. In the same logic, adding Wait in a coroutine would be absurd. It is normal to give time for the code to run. And loading the blips on the scripts start, i assure you that all blips would be created until the player really spawns in and could use the map.

d22tny avatar Apr 16 '25 17:04 d22tny