Blip (tm.blip)
Client side only. Map blips for positions, entities and radius areas, with groups the player can hide together.
lua
local station = tm.blip.coords({
coords = vec3(100.0, 200.0, 30.0),
sprite = 60,
color = 3,
scale = 0.8,
name = 'Police Station',
group = 'police',
})
station:remove()Creating
Each call takes a props table, which becomes the returned object (with id, kind, blipId and remove added).
| Call | Description |
|---|---|
tm.blip.coords(props) | A blip at props.coords. |
tm.blip.entity(props) | A blip that follows props.entity. Raises an error when the entity does not exist. |
tm.blip.radius(props) | A circle at props.coords with props.radius. |
| Prop | Description |
|---|---|
name | Label on the map. label is accepted too. |
sprite, color, scale | Blip sprite, color (colour is accepted too, default 0) and scale (default 0.6). |
display | Display mode, default 2. |
short | Short range only, default true. |
category | Blip category. |
alpha, rotation, priority | 0 to 255, degrees, draw order. |
heading | true shows a heading arrow. |
distance | Coords and radius blips only exist on the map while the player is closer than this. Checked every 6 seconds. |
group | Blips of one group can be hidden together. |
icon, iconColor | A custom icon (a name or an image URL) and its '#rrggbb' color, for map UIs that draw their own icons. The game blip still uses sprite. |
| Capitalized keys | Any key like Flashes or Route calls the matching SetBlip<Key> native (a table value is unpacked into arguments). |
Functions
| Call | Description |
|---|---|
tm.blip.remove(blip) | Removes a blip. Takes the returned object or its id. Safe to call more than once. blip:remove() does the same. |
tm.blip.setBlipInfo(handle, data) | Changes an existing native blip (use blip.blipId). Only the fields in data change, and map UIs are told. |
tm.blip.getBlip(id) | The object for a registry id, or nil. |
tm.blip.setGroupDisplay(group, display?) | Sets the display mode of every blip in a group (stored, so it survives hiding and showing). nil re-applies the stored modes. |
tm.blip.getGroupDisplay(group) | The display mode of the first live blip in the group, 2 when there is none. |
tm.blip.setGroupHidden(group, hidden) | Hides or shows a group for every resource, and remembers it for resources that start later. |
tm.blip.isGroupHidden(group) | Whether the group is hidden. |
tm.blip.registerGroup(id, label?) | Names a group so a settings screen can offer "Show <label> blips". |
Shared state and events
Each resource that imports tm.blip keeps its own registry of live blips. Hidden groups are shared through LocalPlayer.state.tmHiddenBlipGroups (not replicated) and the local event tm_lib:blip:groupHidden(group, hidden).
| Event | Arguments | When |
|---|---|---|
tm_lib:blip:groupHidden | group, hidden | A group was hidden or shown. |
tm_lib:blip:groupRegistered | id, label | registerGroup named a group. |
tm_lib:blip:created / tm_lib:blip:updated | info | A blip was made or changed. info is plain data (blipId, name, sprite, color, group, icon, ...). |
tm_lib:blip:removed | blipHandle | A blip was removed. |
tm_lib:blip:announceAll | none | Trigger it to make every resource announce its live blips again (a map UI that started late). |
tm_lib:blip:refreshGroup | group, display? | Trigger it to call setGroupDisplay in every resource. |