mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 17:23:31 +00:00
fix(client/functions): type checking for vectors (#430)
allows for cross scrt compatibility with newer functions
This commit is contained in:
+17
-10
@@ -62,17 +62,19 @@ function QBCore.Functions.CreateBlip(coords, sprite, display, scale, colour, sho
|
|||||||
if not coords or not sprite or not display or not scale or not colour or shortRange == nil or not title then
|
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, debug log: ")
|
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.")
|
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
|
return
|
||||||
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
|
||||||
|
|
||||||
|
coords = type(coords) == 'table' and vec3(coords.x, coords.y, coords.z) or coords
|
||||||
|
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
|
||||||
|
|
||||||
function QBCore.Functions.RequestAnimDict(animDict)
|
function QBCore.Functions.RequestAnimDict(animDict)
|
||||||
@@ -403,6 +405,11 @@ function QBCore.Functions.GetPlate(vehicle)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function QBCore.Functions.SpawnClear(coords, radius)
|
function QBCore.Functions.SpawnClear(coords, radius)
|
||||||
|
if coords then
|
||||||
|
coords = type(coords) == 'table' and vec3(coords.x, coords.y, coords.z) or coords
|
||||||
|
else
|
||||||
|
coords = GetEntityCoords(ped)
|
||||||
|
end
|
||||||
local vehicles = GetGamePool('CVehicle')
|
local vehicles = GetGamePool('CVehicle')
|
||||||
local closeVeh = {}
|
local closeVeh = {}
|
||||||
for i=1, #vehicles, 1 do
|
for i=1, #vehicles, 1 do
|
||||||
|
|||||||
Reference in New Issue
Block a user