mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Fix prop detection + probably fix getclosestvehicle
This commit is contained in:
+34
-12
@@ -420,7 +420,7 @@ function OpenPoliceActionsMenu()
|
|||||||
ESX.UI.Menu.Open(
|
ESX.UI.Menu.Open(
|
||||||
'default', GetCurrentResourceName(), 'citizen_interaction',
|
'default', GetCurrentResourceName(), 'citizen_interaction',
|
||||||
{
|
{
|
||||||
title = 'Interactions Voirie',
|
title = 'Interaction Voirie',
|
||||||
align = 'top-left',
|
align = 'top-left',
|
||||||
elements = {
|
elements = {
|
||||||
{label = 'Plot', value = 'prop_roadcone02a'},
|
{label = 'Plot', value = 'prop_roadcone02a'},
|
||||||
@@ -1343,6 +1343,15 @@ end)
|
|||||||
|
|
||||||
-- Enter / Exit entity zone events
|
-- Enter / Exit entity zone events
|
||||||
Citizen.CreateThread(function()
|
Citizen.CreateThread(function()
|
||||||
|
|
||||||
|
local trackedEntities = {
|
||||||
|
'prop_roadcone02a',
|
||||||
|
'prop_barrier_work06a',
|
||||||
|
'p_ld_stinger_s',
|
||||||
|
'prop_boxpile_07d',
|
||||||
|
'hei_prop_cash_crate_half_full'
|
||||||
|
}
|
||||||
|
|
||||||
while true do
|
while true do
|
||||||
|
|
||||||
Citizen.Wait(0)
|
Citizen.Wait(0)
|
||||||
@@ -1350,19 +1359,32 @@ Citizen.CreateThread(function()
|
|||||||
local playerPed = GetPlayerPed(-1)
|
local playerPed = GetPlayerPed(-1)
|
||||||
local coords = GetEntityCoords(playerPed)
|
local coords = GetEntityCoords(playerPed)
|
||||||
|
|
||||||
local entity, distance = ESX.Game.GetClosestObject({
|
local closestDistance = -1
|
||||||
'prop_roadcone02a',
|
local closestEntity = nil
|
||||||
'prop_barrier_work06a',
|
|
||||||
'p_ld_stinger_s',
|
|
||||||
'prop_boxpile_07d',
|
|
||||||
'hei_prop_cash_crate_half_full'
|
|
||||||
})
|
|
||||||
|
|
||||||
if distance ~= -1 and distance <= 3.0 then
|
for i=1, #trackedEntities, 1 do
|
||||||
|
|
||||||
|
local object = GetClosestObjectOfType(coords.x, coords.y, coords.z, 3.0, GetHashKey(trackedEntities[i]), false, false, false)
|
||||||
|
|
||||||
|
if DoesEntityExist(object) then
|
||||||
|
|
||||||
if LastEntity ~= entity then
|
local objCoords = GetEntityCoords(object)
|
||||||
TriggerEvent('esx_policejob:hasEnteredEntityZone', entity)
|
local distance = GetDistanceBetweenCoords(coords.x, coords.y, coords.z, objCoords.x, objCoords.y, objCoords.z, true)
|
||||||
LastEntity = entity
|
|
||||||
|
if closestDistance == -1 or closestDistance > distance then
|
||||||
|
closestDistance = distance
|
||||||
|
closestEntity = object
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
if closestDistance ~= -1 and closestDistance <= 3.0 then
|
||||||
|
|
||||||
|
if LastEntity ~= closestEntity then
|
||||||
|
TriggerEvent('esx_policejob:hasEnteredEntityZone', closestEntity)
|
||||||
|
LastEntity = closestEntity
|
||||||
end
|
end
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user