mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
Post-check fix
Post-check fix . Fixes after the check by @AvarianKnight
This commit is contained in:
+5
-13
@@ -142,9 +142,7 @@ end
|
|||||||
|
|
||||||
function QBCore.Functions.GetClosestPlayer(coords)
|
function QBCore.Functions.GetClosestPlayer(coords)
|
||||||
local ped = PlayerPedId()
|
local ped = PlayerPedId()
|
||||||
if coords == nil then
|
local coords = coords or GetEntityCoords(ped)
|
||||||
coords = GetEntityCoords(ped)
|
|
||||||
end
|
|
||||||
local closestPlayers = QBCore.Functions.GetPlayersFromCoords(coords)
|
local closestPlayers = QBCore.Functions.GetPlayersFromCoords(coords)
|
||||||
local closestDistance = -1
|
local closestDistance = -1
|
||||||
local closestPlayer = -1
|
local closestPlayer = -1
|
||||||
@@ -183,10 +181,7 @@ function QBCore.Functions.GetClosestVehicle(coords)
|
|||||||
local vehicles = GetGamePool('CVehicle')
|
local vehicles = GetGamePool('CVehicle')
|
||||||
local closestDistance = -1
|
local closestDistance = -1
|
||||||
local closestVehicle = -1
|
local closestVehicle = -1
|
||||||
local coords = coords
|
local coords = coords or GetEntityCoords(ped)
|
||||||
if coords == nil then
|
|
||||||
coords = GetEntityCoords(ped)
|
|
||||||
end
|
|
||||||
for i=1, #vehicles, 1 do
|
for i=1, #vehicles, 1 do
|
||||||
local vehicleCoords = GetEntityCoords(vehicles[i])
|
local vehicleCoords = GetEntityCoords(vehicles[i])
|
||||||
local distance = #(vehicleCoords - coords)
|
local distance = #(vehicleCoords - coords)
|
||||||
@@ -196,7 +191,7 @@ function QBCore.Functions.GetClosestVehicle(coords)
|
|||||||
closestDistance = distance
|
closestDistance = distance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return closestVehicle,closestDistance
|
return closestVehicle, closestDistance
|
||||||
end
|
end
|
||||||
|
|
||||||
function QBCore.Functions.GetClosestObject(coords)
|
function QBCore.Functions.GetClosestObject(coords)
|
||||||
@@ -204,10 +199,7 @@ function QBCore.Functions.GetClosestObject(coords)
|
|||||||
local objects = GetGamePool('CObject')
|
local objects = GetGamePool('CObject')
|
||||||
local closestDistance = -1
|
local closestDistance = -1
|
||||||
local closestObject = -1
|
local closestObject = -1
|
||||||
local coords = coords
|
local coords = coords or GetEntityCoords(ped)
|
||||||
if coords == nil then
|
|
||||||
coords = GetEntityCoords(ped)
|
|
||||||
end
|
|
||||||
for i = 1, #objects, 1 do
|
for i = 1, #objects, 1 do
|
||||||
local objectCoords = GetEntityCoords(objects[i])
|
local objectCoords = GetEntityCoords(objects[i])
|
||||||
local distance = #(objectCoords - coords)
|
local distance = #(objectCoords - coords)
|
||||||
@@ -216,7 +208,7 @@ function QBCore.Functions.GetClosestObject(coords)
|
|||||||
closestDistance = distance
|
closestDistance = distance
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return closestObject,closestDistance
|
return closestObject, closestDistance
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Vehicle
|
-- Vehicle
|
||||||
|
|||||||
Reference in New Issue
Block a user