@@ -473,26 +473,6 @@ function ESX.Game.GetPedMugshot(ped, transparent)
473473 return mugshot , GetPedheadshotTxdString (mugshot )
474474end
475475
476- --- @param entity integer The entity to get the coords of
477- --- @param coords table | vector3 | vector4 The coords to teleport the entity to
478- --- @param cb ? function The callback function
479- function ESX .Game .Teleport (entity , coords , cb )
480-
481- if DoesEntityExist (entity ) then
482- RequestCollisionAtCoord (coords .x , coords .y , coords .z )
483- while not HasCollisionLoadedAroundEntity (entity ) do
484- Wait (0 )
485- end
486-
487- SetEntityCoords (entity , coords .x , coords .y , coords .z , false , false , false , false )
488- SetEntityHeading (entity , coords .w or coords .heading or 0.0 )
489- end
490-
491- if cb then
492- cb ()
493- end
494- end
495-
496476--- @param object integer | string The object to spawn
497477--- @param coords table | vector3 The coords to spawn the object at
498478--- @param cb ? function The callback function
@@ -689,32 +669,6 @@ function ESX.Game.GetClosestVehicle(coords, modelFilter)
689669 return ESX .Game .GetClosestEntity (ESX .Game .GetVehicles (), false , coords , modelFilter )
690670end
691671
692- --- @param entities table The entities to search through
693- --- @param isPlayerEntities boolean Whether the entities are players
694- --- @param coords table | vector3 The coords to search from
695- --- @param maxDistance number The max distance to search within
696- --- @return table
697- local function EnumerateEntitiesWithinDistance (entities , isPlayerEntities , coords , maxDistance )
698- local nearbyEntities = {}
699-
700- if coords then
701- coords = vector3 (coords .x , coords .y , coords .z )
702- else
703- local playerPed = ESX .PlayerData .ped
704- coords = GetEntityCoords (playerPed )
705- end
706-
707- for k , entity in pairs (entities ) do
708- local distance = # (coords - GetEntityCoords (entity ))
709-
710- if distance <= maxDistance then
711- nearbyEntities [# nearbyEntities + 1 ] = isPlayerEntities and k or entity
712- end
713- end
714-
715- return nearbyEntities
716- end
717-
718672--- @param coords table | vector3 The coords to search from
719673--- @param maxDistance number The max distance to search within
720674--- @return table
@@ -757,42 +711,6 @@ function ESX.Game.RaycastScreen(depth, ...)
757711 return target , ESX .Game .GetShapeTestResultSync (StartShapeTestLosProbe (origin .x , origin .y , origin .z , target .x , target .y , target .z , ... ))
758712end
759713
760- --- @param entities table The entities to search through
761- --- @param isPlayerEntities boolean Whether the entities are players
762- --- @param coords ? table | vector3 The coords to search from
763- --- @param modelFilter ? table The model filter
764- --- @return integer , integer
765- function ESX .Game .GetClosestEntity (entities , isPlayerEntities , coords , modelFilter )
766- local closestEntity , closestEntityDistance , filteredEntities = - 1 , - 1 , nil
767-
768- if coords then
769- coords = vector3 (coords .x , coords .y , coords .z )
770- else
771- local playerPed = ESX .PlayerData .ped
772- coords = GetEntityCoords (playerPed )
773- end
774-
775- if modelFilter then
776- filteredEntities = {}
777-
778- for currentEntityIndex = 1 , # entities do
779- if modelFilter [GetEntityModel (entities [currentEntityIndex ])] then
780- filteredEntities [# filteredEntities + 1 ] = entities [currentEntityIndex ]
781- end
782- end
783- end
784-
785- for k , entity in pairs (filteredEntities or entities ) do
786- local distance = # (coords - GetEntityCoords (entity ))
787-
788- if closestEntityDistance == - 1 or distance < closestEntityDistance then
789- closestEntity , closestEntityDistance = isPlayerEntities and k or entity , distance
790- end
791- end
792-
793- return closestEntity , closestEntityDistance
794- end
795-
796714--- @return integer | nil , vector3 | nil
797715function ESX .Game .GetVehicleInDirection ()
798716 local _ , hit , coords , _ , _ , entity = ESX .Game .RaycastScreen (5 , 10 , ESX .PlayerData .ped )
0 commit comments