99 Blip Limits
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.
Expected result
blip limit should have been increased
Reproduction steps
- I added more than 99 blips.
- 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
- https://forum.cfx.re/t/how-can-i-bypass-the-blip-limit/4831552
- https://forum.cfx.re/t/change-maximum-amount-of-blips/1059087
- https://forum.cfx.re/t/map-blip-legend-disappearing/5175777
doesn't it affect the server performance ?
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.
Yup, exactly.
More than 99 unique blips names ( everything is fine ) :
More than 99 entries for the same named blips ( still everything fine )
So as i told you, there is no 99 limit, only bad code.
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.
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.
Yup, exactly.
More than 99 unique blips names ( everything is fine ) :
More than 99 entries for the same named blips ( still everything fine )
So as i told you, there is no
99 limit, only bad code.
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
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.
Yes, the problem solved when I added Wait(1)
but I think it is absurd to be like this, I think
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.