AddBlipForEntity
Docslocal retval = AddBlipForEntity(entity)Description
Create a blip that by default is red (enemy), you can use SET_BLIP_AS_FRIENDLY to make it blue (friend).
Can be used for objects, vehicles and peds.
Example of enemy:
!enemy
Example of friend:
!friend
This is the server-side RPC native equivalent of the client native [ADD_BLIP_FOR_ENTITY](?\_0x5CDE92C702A8FCE7).
Parameters
| Name | Type | Description |
|---|---|---|
entity | Entity | The entity handle to create the blip. |
Quick Snippet: Get Entityentity
entityUse this to obtain an entity handle from the player's aim or crosshair.
-- Get the entity the player is aiming at
local ped = PlayerPedId()
local hit, entity = GetEntityPlayerIsFreeAimingAt(PlayerId())
if hit and entity ~= 0 then
print("Entity: " .. entity)
print("Model: " .. GetEntityModel(entity))
print("Type: " .. GetEntityType(entity)) -- 1=Ped, 2=Vehicle, 3=Object
endQuick Snippet: Create Blip→ Blip
→ BlipUse this to create or reference a map blip for this native.
-- Create a blip at the player's position
local coords = GetEntityCoords(PlayerPedId())
local blip = AddBlipForCoord(coords.x, coords.y, coords.z)
SetBlipSprite(blip, 1) -- Standard blip icon
SetBlipColour(blip, 1) -- Red color
SetBlipScale(blip, 0.8)
SetBlipAsShortRange(blip, true)
BeginTextCommandSetBlipName("STRING")
AddTextComponentSubstringPlayerName("My Blip")
EndTextCommandSetBlipName(blip)
print("Blip created: " .. blip)Returns
BlipReturns a blip handle.