Blips

HapticLib provides self cleaning blips and its extremely easy to use. Rather than generating each blip manually in your script. You can use the lib

Previous Blip Generation Example

if v.blip_enabled then
     local blip = AddBlipForCoord(v.blip_location)
     SetBlipAsShortRange(blip, true)
     SetBlipSprite(blip, v.blip_sprite)
     SetBlipScale(blip, v.blip_scale)
     SetBlipDisplay(blip, 6)
     BeginTextCommandSetBlipName('STRING')
     AddTextComponentString(v.blip_name)
     EndTextCommandSetBlipName(blip)
end

You can pass the same parameters to the Lib and not have to worry about cleaning up blips.

-- Function
HapticLib.CreateBlip(uniqueid, coords, shortrange, sprite, scale, name, color)

-- Usage
-- You always want to parse a uniqueid to the library so that it can clean up
local uniqueid = "Cityhall_" .. HapticLib.GenerateString(4)
HapticLib.CreateBlip(uniqueid, v.blip_location, v.blip_shortrange, v.blip_sprite, v.blip_scale, v.blip_name, v.blip_color)

To Remove a blip in runtime you can also do.

HapticLib.RemoveBlip(UniqueID) -- This is why setting uniqueid's is important

Last updated