Blips Module โ
The Blips module provides utility functions for creating and managing map blips in RedM. It includes automatic cleanup when the resource stops.
Getting Started โ
lua
-- Get blips module instance
local Blips = exports.bln_lib:blip()
Methods โ
BlipsAPI.create โ
Create a new blip on the map.
lua
Blips.create(location, name, sprite, blipHash, color)
Parameters
location
(table): Coordinates of the blip- Must have
x
,y
,z
components
- Must have
name
(string): Display name of the blipsprite
(string/number): Sprite hash or nameblipHash
(integer, optional): Type of blip (default: 1664425300)color
(string, optional): Blip color modifier
Returns
integer
: Blip ID for reference
Example
lua
-- Create basic blip
local location = { x = 1234.0, y = 5678.0, z = 90.0 }
local blip = Blips.create(
location,
"Saloon",
"blip_ambient_sheriff", -- or use hash directly
1664425300,
"BLIP_MODIFIER_MP_COLOR_1"
)
-- Create blip with default type
local storeBlip = Blips.create(
{ x = 2345.0, y = 6789.0, z = 80.0 },
"General Store",
"blip_ambient_general_store"
)
BlipsAPI.sonar โ
Create a sonar-style blip pulse at specified coordinates.
lua
Blips.sonar(coords, typehash)
Parameters
coords
(table): Coordinates where to show the sonar pulse- Must have
x
,y
,z
components
- Must have
typehash
(integer, optional): Type of sonar blip (default: 227904798)
Example
lua
-- Create sonar pulse at location
Blips.sonar({ x = 1234.0, y = 5678.0, z = 90.0 })
-- Create custom sonar pulse
Blips.sonar(
{ x = 1234.0, y = 5678.0, z = 90.0 },
joaat("YOUR_SONAR_TYPE")
)
Common Blip Hashes โ
lua
-- Standard blip types
BLIP_STYLE_DEFAULT = 1664425300
BLIP_STYLE_MISSION = -1477394784
BLIP_STYLE_WAYPOINT = -1594303955
-- Blip sprites (use with joaat())
"blip_ambient_bounty_target"
"blip_ambient_hitching_post"
"blip_ambient_law"
"blip_ambient_sheriff"
"blip_ambient_theatre"
"blip_ambient_wages"
"blip_shop_barber"
"blip_shop_butcher"
"blip_shop_doctor"
"blip_shop_fence"
"blip_shop_general_store"
"blip_shop_gunsmith"
"blip_shop_horse_shop"
"blip_shop_photo_studio"
"blip_shop_stable"
"blip_shop_tailor"
Common Color Modifiers โ
lua
"BLIP_MODIFIER_MP_COLOR_1" -- Red
"BLIP_MODIFIER_MP_COLOR_2" -- Light Blue
"BLIP_MODIFIER_MP_COLOR_3" -- Dark Blue
"BLIP_MODIFIER_MP_COLOR_4" -- Purple
"BLIP_MODIFIER_MP_COLOR_5" -- Yellow
"BLIP_MODIFIER_MP_COLOR_6" -- Pink
"BLIP_MODIFIER_MP_COLOR_7" -- Dark Green
"BLIP_MODIFIER_MP_COLOR_8" -- Light Green
Auto-Cleanup โ
The module automatically removes all created blips when the resource stops. This is handled internally and requires no additional code.
Complete Examples โ
Creating Multiple Blips โ
lua
-- Create store locations
local stores = {
{ pos = { x = 1234.0, y = 5678.0, z = 90.0 }, name = "Valentine General Store" },
{ pos = { x = 2345.0, y = 6789.0, z = 80.0 }, name = "Saint Denis General Store" },
}
-- Add blips for all stores
for _, store in pairs(stores) do
Blips.create(
store.pos,
store.name,
"blip_shop_general_store",
1664425300,
"BLIP_MODIFIER_MP_COLOR_1"
)
end
Mission Waypoint with Sonar โ
lua
-- Create mission destination
local destination = { x = 1234.0, y = 5678.0, z = 90.0 }
-- Add waypoint blip
local blip = Blips.create(
destination,
"Mission Target",
"blip_ambient_bounty_target",
-1477394784, -- Mission style blip
"BLIP_MODIFIER_MP_COLOR_2"
)
-- Add sonar effect
Blips.sonar(destination)