mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 17:28:53 +00:00
fix: force vector3 on Teleport function
This commit is contained in:
+7
-12
@@ -308,21 +308,16 @@ ESX.Game.GetPedMugshot = function(ped, transparent)
|
||||
end
|
||||
|
||||
ESX.Game.Teleport = function(entity, coords, cb)
|
||||
local vector = type(coords) == "vector4" and coords or type(coords) == "vector3" and vector4(coords, 0.0) or vec(coords.x, coords.y, coords.z, coords.heading or 0.0)
|
||||
|
||||
if DoesEntityExist(entity) then
|
||||
RequestCollisionAtCoord(coords.x, coords.y, coords.z)
|
||||
local timeout = 0
|
||||
|
||||
-- we can get stuck here if any of the axies are "invalid"
|
||||
while not HasCollisionLoadedAroundEntity(entity) and timeout < 2000 do
|
||||
Citizen.Wait(0)
|
||||
timeout = timeout + 1
|
||||
RequestCollisionAtCoord(vector.xyz)
|
||||
while not HasCollisionLoadedAroundEntity(entity) do
|
||||
Wait(0)
|
||||
end
|
||||
|
||||
SetEntityCoords(entity, coords.x, coords.y, coords.z, false, false, false, false)
|
||||
|
||||
if type(coords) == 'table' and coords.heading then
|
||||
SetEntityHeading(entity, coords.heading)
|
||||
end
|
||||
SetEntityCoords(entity, vector.xyz, false, false, false, false)
|
||||
SetEntityHeading(entity, vector.w)
|
||||
end
|
||||
|
||||
if cb then
|
||||
|
||||
Reference in New Issue
Block a user