Hey, so I’m trying to teleport the player using the teleport guide on the Wiki, however it doesn’t work at all. Is it broken? The code is exactly that on the Wiki.
Same here. Must be broken.
No “teleport” isn’t broken.
Have you used it client side?
Otherwise build your own teleport function.
You only need you destination Location
For example this should you teleport to another player: (UNTESTED BUT SHOULD WORK)
Serverside build a command:
function CommandHandler(fullcommand) command = stringsplit(fullcommand, " ") if(command == "/tp") then -- Captures the command if (command) then TriggerClientEvent("teleport_Player", source, command) --use in your Chat /tp TARGET_PLAYER end end end AddEventHandler('chatCommandEntered', CommandHandler)
RegisterNetEvent("teleport_Player") function TeleportMeToPlayer(player) local destPed = GetPlayerPed(player) local localPed = GetPlayerPed(-1) if destPed and destPed ~= -1 then --check if your target exists local coords = GetEntityCoords(destPed, true) SetEntityCoords(localPed, coords, true, false, false, true) end end AddEventHandler("teleport_Player", TeleportMeToPlayer)
I got it working. It turns out it was the tiniest error in the lib.lua I created. lmao
@iago You would most likely have it take the player name and get the coords for that player name then teleport to those coords…so right above your comment.
Of course it is possible too.
All you need is in case of the player to handle the destination in your case Akina
What you need are the coords of Akina.
SetEntityCoords(localPed, Akina_Coord_X, Akina_Coord_Y, Akina_Coord_Z, …)
You can create yourself a command like I also do to gather coords.