From 1a7c1d740772b04885267b6a72b8720bbefa6971 Mon Sep 17 00:00:00 2001 From: YeahItsHayden Date: Wed, 8 Dec 2021 16:19:34 +1000 Subject: [PATCH 1/3] (add): create blip function --- client/functions.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/client/functions.lua b/client/functions.lua index 4d2b947..b67566d 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -60,6 +60,23 @@ function QBCore.Functions.DrawText3D(x, y, z, text) ClearDrawOrigin() end +function QBCore.Functions.CreateBlip(coords, sprite, display, scale, colour, shortRange, title) + print(coords, sprite, display, scale, colour, shortRange, title) + if not coords or not sprite or not display or not scale or not colour or shortRange == nil or not title then + print("Blip failed to create, most likely missed a setting") + else + blip = AddBlipForCoord(coords) + SetBlipSprite(blip, sprite) + SetBlipDisplay(blip, display) + SetBlipScale(blip, scale) + SetBlipColour(blip, colour) + SetBlipAsShortRange(blip, shortRange) + BeginTextCommandSetBlipName("STRING") + AddTextComponentString(title) + EndTextCommandSetBlipName(blip) + end +end + RegisterNUICallback('getNotifyConfig', function(_, cb) cb(QBCore.Config.Notify) end) From b7a075127c1c64e8012b5114c8fd05aa4308448e Mon Sep 17 00:00:00 2001 From: YeahItsHayden Date: Wed, 8 Dec 2021 17:20:21 +1000 Subject: [PATCH 2/3] (add): request anim dict to core --- client/functions.lua | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/client/functions.lua b/client/functions.lua index b67566d..a008cec 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -77,6 +77,16 @@ function QBCore.Functions.CreateBlip(coords, sprite, display, scale, colour, sho end end +function QBCore.Functions.RequestAnimDict(animDict) + if not HasAnimDictLoaded(animDict) then + RequestAnimDict(animDict) + + while not HasAnimDictLoaded(animDict) do + Wait(4) + end + end +end + RegisterNUICallback('getNotifyConfig', function(_, cb) cb(QBCore.Config.Notify) end) From 4d4f249ef45a7e0e07e1fc158210f84d06f570e7 Mon Sep 17 00:00:00 2001 From: YeahItsHayden Date: Thu, 9 Dec 2021 13:58:12 +1000 Subject: [PATCH 3/3] (add): Remove Print + add error trace --- client/functions.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/client/functions.lua b/client/functions.lua index a008cec..877fe94 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -61,9 +61,9 @@ function QBCore.Functions.DrawText3D(x, y, z, text) end function QBCore.Functions.CreateBlip(coords, sprite, display, scale, colour, shortRange, title) - print(coords, sprite, display, scale, colour, shortRange, title) if not coords or not sprite or not display or not scale or not colour or shortRange == nil or not title then - print("Blip failed to create, most likely missed a setting") + print("Blip failed to create, most likely missed a setting, debug log: ") + print("Coords: " .. coords .. " Sprite: " .. sprite .. " Display: " .. display .. " scale: " .. scale .. " shortRange: " .. shortRange .. " Title: " .. title .. " if you're attempting to use a blip without a title, use an empty string.") else blip = AddBlipForCoord(coords) SetBlipSprite(blip, sprite)