From 1b2b1b34833a0102f04e2b3200f3a99682218d7c Mon Sep 17 00:00:00 2001 From: vanillaa <80897991+evanillaa@users.noreply.github.com> Date: Thu, 30 Dec 2021 23:44:12 +0200 Subject: [PATCH] check up Spawn Clear Kakarot made it for me one day --- client/functions.lua | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/client/functions.lua b/client/functions.lua index 67919f2..28b693b 100644 --- a/client/functions.lua +++ b/client/functions.lua @@ -402,6 +402,20 @@ function QBCore.Functions.GetPlate(vehicle) return QBCore.Shared.Trim(GetVehicleNumberPlateText(vehicle)) end +function QBCore.Functions.SpawnClear(coords, radius) + local vehicles = GetGamePool('CVehicle') + local closeVeh = {} + for i=1, #vehicles, 1 do + local vehicleCoords = GetEntityCoords(vehicles[i]) + local distance = #(vehicleCoords - coords) + if distance <= radius then + closeVeh[#closeVeh + 1] = vehicles[i] + end + end + if #closeVeh > 0 then return false end + return true +end + function QBCore.Functions.GetVehicleProperties(vehicle) if DoesEntityExist(vehicle) then local colorPrimary, colorSecondary = GetVehicleColours(vehicle)