From 700355cf55710b39de7733aa41c9b19dd0dee66d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Thu, 3 Aug 2017 15:44:01 +0200 Subject: [PATCH] Add ESX.Game.Teleport --- .../es_extended/client/functions.lua | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/resources/[essential]/es_extended/client/functions.lua b/resources/[essential]/es_extended/client/functions.lua index 945fa6a8..f70fe539 100644 --- a/resources/[essential]/es_extended/client/functions.lua +++ b/resources/[essential]/es_extended/client/functions.lua @@ -247,6 +247,23 @@ ESX.GetWeaponLabel = function(name) end +ESX.Game.Teleport = function(entity, coords, cb) + + RequestCollisionAtCoord(coords.x, coords.y, coords.z) + + while not HasCollisionLoadedAroundEntity(entity) do + RequestCollisionAtCoord(coords.x, coords.x, coords.x) + Citizen.Wait(0) + end + + SetEntityCoords(entity, coords.x, coords.y, coords.z) + + if cb ~= nil then + cb() + end + +end + ESX.Game.GetPlayers = function() local maxPlayers = Config.MaxPlayers