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,zcomponents
- 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,zcomponents
- 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 GreenCommon Sonar hashes โ
lua
{name = "PING_AUTO", hash = 0xB1F69C74},
{name = "PING_BEAT_EXPLOSION", hash = 0xB456DFE8},
{name = "PING_BELL_RING", hash = 0x5BB356FE},
{name = "PING_FAST", hash = 0x2AF985E8},
{name = "PING_FAST_LARGE", hash = 0x603DA5E0},
{name = "PING_LEGENDARY_ANIMAL_CLUE", hash = 0xF34063C9},
{name = "PING_MEDIUM", hash = 0x691306EB},
{name = "PING_MEDIUM_BEAT", hash = 0xD1A67C50},
{name = "PING_MEDIUM_LONG", hash = 0x106855E7},
{name = "PING_MEDIUM_NO_BLIP", hash = 0xAF9781C9},
{name = "PING_MEDIUM_SLOW", hash = 0x5E66117D},
{name = "PING_MEDIUM_SMALL", hash = 0x4C3C857E},
{name = "PING_MEDIUM_THREAT", hash = 0x25C64EEF},
{name = "PING_SLOW", hash = 0x3212A764},
{name = "PING_TREE_FALL", hash = 0x7067641D},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"
)
endMission 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)