How to create map blips in FiveM: AddBlipForCoord and radius blips
Create blips in FiveM with AddBlipForCoord: sprite, colour, scale, short range, a name label, radius blips with AddBlipForRadius, removing blips and job-only blips.
You call AddBlipForCoord and get a white dot with no icon, or a blip with the name "Blip" or "NULL", or one that stays on the map after the script stops. Blips are simple once you know the order of the calls. This article walks through creating one, naming it, drawing a radius, removing it, and showing blips only to a job.
A basic blip
All blip natives run on the client. This creates a shop icon at a position:
local blip = AddBlipForCoord(25.7, -1347.3, 29.5)
SetBlipSprite(blip, 52)
SetBlipDisplay(blip, 4)
SetBlipScale(blip, 0.8)
SetBlipColour(blip, 2)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName('24/7 Shop')
EndTextCommandSetBlipName(blip)What each call does:
| Native | Purpose |
|---|---|
AddBlipForCoord |
Creates the blip and returns a handle. Keep it. |
SetBlipSprite |
The icon, a number. |
SetBlipDisplay |
Where it shows: 4 is the main map and the minimap. |
SetBlipScale |
The size. 1.0 is normal. |
SetBlipColour |
The colour, a number. |
SetBlipAsShortRange |
true shows it on the minimap only when near. |
The numbers for sprites and colours are listed on the FiveM documentation site, under game references, blips. The sprite 52 above is a store icon. If you see only a white dot, the sprite number is wrong or missing.
Set the name
The label shown on the map and in the pause menu is not a simple string argument. It goes through the text command natives, in this order:
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName('24/7 Shop')
EndTextCommandSetBlipName(blip)The blip must already exist, and you must call all three. Skip one and the name is empty or shows a default. Without a name, a blip appears in the legend as "Blip" or by its sprite.
Tip: put these calls in a function that takes a table, so each blip is one line in a config instead of ten lines of natives.
local function createBlip(data)
local blip = AddBlipForCoord(data.coords.x, data.coords.y, data.coords.z)
SetBlipSprite(blip, data.sprite)
SetBlipDisplay(blip, 4)
SetBlipScale(blip, data.scale or 0.8)
SetBlipColour(blip, data.colour or 0)
SetBlipAsShortRange(blip, data.shortRange ~= false)
BeginTextCommandSetBlipName('STRING')
AddTextComponentSubstringPlayerName(data.name)
EndTextCommandSetBlipName(blip)
return blip
end
local shopBlip = createBlip({
coords = vec3(25.7, -1347.3, 29.5),
sprite = 52,
colour = 2,
name = '24/7 Shop',
})Short range or always visible
SetBlipAsShortRange(blip, true) means the blip only shows on the minimap when the player is close, and it is still visible on the full map. With false, it always shows on the minimap, edge-clamped, wherever the player is. Use short range for shops and jobs, and false for a main objective.
Radius blips
A radius blip is a coloured circle for an area, such as a search zone or a turf. AddBlipForRadius makes the circle, but not an icon, so add a normal blip at the same spot if you want both:
local area = AddBlipForRadius(25.7, -1347.3, 29.5, 150.0)
SetBlipColour(area, 1)
SetBlipAlpha(area, 100)The last argument is the radius in metres. Set the alpha (0 to 255) low, or the circle covers the map. The radius blip is a separate handle, so remove it separately.
Remove blips
Always keep the handle, and remove the blip when it is no longer needed:
if DoesBlipExist(shopBlip) then
RemoveBlip(shopBlip)
endBlips are not removed for you when a resource stops, or not reliably, so clean up in a handler. Without it, restarting your script piles up duplicates on the map:
AddEventHandler('onResourceStop', function(resource)
if resource ~= GetCurrentResourceName() then return end
if DoesBlipExist(shopBlip) then RemoveBlip(shopBlip) end
if DoesBlipExist(area) then RemoveBlip(area) end
end)Job-only blips
Blips are created on each player's own client, so a job-only blip means: create it for the right job, remove it for everyone else. Keep a table of what you created, and react to job changes.
On ESX:
local blips = {}
local function refreshBlips(job)
for i = #blips, 1, -1 do
RemoveBlip(blips[i])
blips[i] = nil
end
if job and job.name == 'police' then
blips[#blips + 1] = createBlip({
coords = vec3(441.2, -981.9, 30.7),
sprite = 60,
colour = 3,
name = 'Police station',
})
end
end
RegisterNetEvent('esx:playerLoaded', function(xPlayer)
refreshBlips(xPlayer.job)
end)
RegisterNetEvent('esx:setJob', function(job)
refreshBlips(job)
end)On QBCore (and QBox through its compatibility layer):
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
refreshBlips(QBCore.Functions.GetPlayerData().job)
end)
RegisterNetEvent('QBCore:Client:OnJobUpdate', function(job)
refreshBlips(job)
end)Both use the same refreshBlips and createBlip from above. If the script can restart while the player is online, also call refreshBlips once at start with the current job, since the loaded event has already fired by then.
Warning: hiding a blip on the client is not security. A player can still see it if they patch the client. For a secret, such as an illegal hideout, do not send the position to the client at all until the player earns it.
Other blip types
AddBlipForEntity(entity)follows a vehicle or a ped.SetBlipRoute(blip, true)draws a GPS route to the blip.SetBlipFlashes(blip, true)makes it blink.
Checklist
| Symptom | Fix |
|---|---|
| White dot, no icon | Call SetBlipSprite with a valid sprite number |
| Blip has no name or the wrong name | Use the three-call name sequence after creating the blip |
| Blip too big or too small | Adjust SetBlipScale (1.0 is normal) |
| Radius circle hides the map | Lower it with SetBlipAlpha |
| Duplicates after a script restart | RemoveBlip in onResourceStop |
| Blip must show for one job only | Create and remove on the job-update events |
Quick answers
Why does my blip show the wrong name or no name?
The name must be set with BeginTextCommandSetBlipName('STRING'), AddTextComponentSubstringPlayerName(name) and EndTextCommandSetBlipName(blip), in that order, after the blip exists.
How do I remove a blip?
Call RemoveBlip(blip) with the handle you stored when you created it. If you did not keep the handle, you cannot remove that blip.
How do I show a blip to one job only?
Create it when the player's job matches, and remove it when the job changes. Do it from the framework's job-update event, since a blip is created on the client.
Scripts that skip this problem
Shop CreatorBuild a shop in under a minute — owners, employees, vaults and robberies included.View script →
Advanced BoostingTablet-driven vehicle boosting: contracts from class D to S+, crews and a live queue.View script →
Quest CreatorA visual editor for quests and NPC dialogues, built node by node in game.View script →