-
Notifications
You must be signed in to change notification settings - Fork 5
Adding Blips
StyledStrike edited this page Sep 3, 2023
·
8 revisions
Blips are small icons visible in the minimap. They can be placed in certain positions, or follow entities.
blip, id = GMinimap:AddBlip(params: table)
The params
table is a key-value dictionary that should contain the initial properties
of the blip. You can modify the returned blip
with these same parameters at any point.
Key | Type | Description |
---|---|---|
id | string | A ID that can be used to remove the blip later |
parent | Entity | A parent entity the blip will follow, if valid |
icon | string | Icon file path, either as a URL or a file on disk |
position | Vector | World position (doesnt apply if parent was set) |
angle | Angle | World rotation (doesnt apply if parent was set) |
scale | number | Blip icon scale |
alpha | number | Blip icon opacity (between 0 and 255 ) |
color | Color | Blip icon color |
indicateAlt | boolean | Show a altitude indicator when not in the same level |
indicateAng | boolean | Show a heading arrow |
lockIconAng | boolean |
angle will only affect indicateAng , icon does not rotate |
Note: Calling AddBlip
when another blip with same id
already exists will update the existing blip instead of creating a new one. Also, if parent
becomes invalid, the blip will be removed automatically.
-- create a blip at the center of the world,
-- with one of the built-in icons
local blip, id = GMinimap:AddBlip( {
position = Vector( 0, 0, 0 ),
icon = "gminimap/blips/jet.png",
scale = 1.5
} )
-- after 5 seconds..
timer.Simple( 5, function()
-- put the blip near the local player's position
blip.position = LocalPlayer():GetPos() + Vector( 1000, 0, 0 )
-- change the icon to a online URL image file
blip.icon = "https://cdn3.emoji.gg/emojis/2319-astonished-cat.png"
-- make it always point up
blip.lockIconAng = true
end )
blip = GMinimap:FindBlipByID(id: string)
Find a blip created previously by it's ID.
GMinimap:RemoveBlipById(id: string)
Remove a blip created previously by it's id
. You can obtain the id
either from the second value returned from GMinimap:AddBlip
or in the blip itself, blip.id
.
-- constantly create and remove a blip at the center
-- of the map, so it appears as if it's flashing
local created = false
timer.Create( "FlahsingBlipExample", 0.5, 0, function()
if created then
GMinimap:RemoveBlipById( "my_flashing_blip" )
created = false
else
GMinimap:AddBlip( {
id = "my_flashing_blip",
icon = "gminimap/blips/star.png",
position = Vector( 0, 0, 0 ),
scale = 1.5,
lockIconAng = true
} )
created = true
end
end )
GMinimap:RemoveBlipByParent(ent: Entity)
Remove all blips created previously that have ent
as their parent
.