Files
red-valley/resources/[framework]/[addons]/qs-advancedgarages/server/custom/main.lua
2026-03-29 21:41:17 +03:00

26 lines
859 B
Lua

function CheckSpawnCoordsIsFree(coords)
local vehicles = GetAllVehicles()
for k, v in pairs(vehicles) do
local vehicleCoords = GetEntityCoords(v)
local distance = #(coords - vec3(vehicleCoords.x, vehicleCoords.y, vehicleCoords.z))
local plate = MathTrim(GetVehicleNumberPlateText(v))
if distance < 3 then
local existVehicle = GetVehicleFromPlate(plate)
if not existVehicle then
if DoesEntityExist(v) then
DeleteEntity(v)
end
goto continue
end
local existDriver = GetPedInVehicleSeat(v, -1)
if existDriver == 0 then
DeleteSpawnedVehicle(plate)
goto continue
end
return false
end
::continue::
end
return true
end