[ESX] Teleport menu for admins

ESX TELEPORT MENU FOR ADMIN

This is the basic teleport menu that you can use to teleport on your custom locations and to go back if needed along with other options.I already added couple of locations but you can easily add more and change notification text in config file.


DOWNLOAD
Github page https://github.com/amaradra/esx_tpmenu

INSTALLATION

  • Download files from my github page or from here and place it in your resource folder.
  • Change the name of esx_tpmenu_master to esx_tpmenu
  • Add start esx_tpmenu to your server.cfg
  • Restart your server

COMMANDS
Use /tpmenu to open teleport menu or F5 key

8 Likes

nice script!

can you add tp to waypoint to this menu??

I really dont know where i got this.I would like to credit developer who made this so please tell me below if you know.Here you go my friend i hope this helps

CLIENT SIDE

RegisterNetEvent('gpstools:tpwaypoint')
AddEventHandler('gpstools:tpwaypoint', function()
	local playerPed = GetPlayerPed(-1)
	local blip = GetFirstBlipInfoId(8)

	if DoesBlipExist(blip) then
		local coord = GetBlipInfoIdCoord(blip)
		local groundFound, coordZ = false, 0
		local groundCheckHeights = { 0.0, 50.0, 100.0, 150.0, 200.0, 250.0, 300.0, 350.0, 400.0,450.0, 500.0, 550.0, 600.0, 650.0, 700.0, 750.0, 800.0 }

		for i, height in ipairs(groundCheckHeights) do
		
			ESX.Game.Teleport(playerPed, {
				x = coord.x,
				y = coord.y,
				z = height
			})

			local foundGround, z = GetGroundZFor_3dCoord(coord.x, coord.y, height)
			if foundGround then
				coordZ = z + 3
				groundFound = true
				break
			end
		end
	
		if not groundFound then
			coordZ = 100
			TriggerEvent('esx:addWeapon', 'GADGET_PARACHUTE', 0)
			ESX.ShowHelpNotification('the ground (Z axis) could not be found! You\'ve been given a ~y~parachute~s~, good luck!')
		end

		ESX.Game.Teleport(playerPed, {
			x = coord.x,
			y = coord.y,
			z = coordZ
		})
	else
		ESX.ShowHelpNotification('You do not have a waypoint set!')
	end
end)

SERVER SIDE

TriggerEvent('es:addGroupCommand', 'tpwaypoint', 'admin', function(source, args, user)
	TriggerClientEvent('gpstools:tpwaypoint', source)

end, function(source, args, user)
	TriggerClientEvent('chatMessage', source, 'SYSTEM', {255, 0, 0}, 'Insufficient Permissions.')
end, {help = 'TP to the way-point selected on GPS'})
1 Like

Should i add this to my ESX folder or nah?

You can add this to esx_tpmenu script so you can keep teleport things in one place.

Awesome release!

Thank you dude.

1 Like

how to make the menu come out by pressing f4 or something?

Just copy this code inside client.lua.After this you can press F5 and it will open the menu.Also i didnt test this so please reply to make sure that this works.

local group = "user"

function OpenTpMenu()
   ESX.UI.Menu.CloseAll()			
    
    ESX.UI.Menu.Open(
        'default', GetCurrentResourceName(), 'tpmenu',
        {
            title    = 'Teleport menu',
            align    = 'bottom-right',
            elements = elements
        },
        function(data, menu)						--on data selection
            if data.current.label == "Last location" then
                if lastlocation ~= nil then  
                    ESX.Game.Teleport(PlayerPedId(), lastlocation) 
                    ESX.ShowNotification(Locale['teleported_last'])
                else 
                    ESX.ShowNotification(Locale['teleported_last_empty'])
                end
            else
                lastlocation = GetEntityCoords(GetPlayerPed(-1))
                local coords = { x = data.current.x,  y = data.current.y, z = data.current.z}
                ESX.Game.Teleport(PlayerPedId(), coords)
                ESX.ShowNotification(Locale['teleported'] .. data.current.label)
            end
            menu.close()							--close menu after selection
          end,
          function(data, menu)
            menu.close()
          end
        )
end

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		if IsControlJustReleased(1, 166) then --WHEN YOU PRESS F5
			if group ~= "user" then
				OpenTpMenu()
			end
		end
	end
end)

RegisterNetEvent('es_admin:setGroup')
AddEventHandler('es_admin:setGroup', function(g)
	group = g
end)
1 Like

its working!!! thanks buddy ! really appreciate it.

1 Like

Friend makes one of god mode for admin :heart_eyes:

1 Like

would it be possible to teleport the vehicle with the player?

Here is the whole file.I didnt test it so please give a feedback.


--[[ TELEPORT MENU BY ADRA ]]--
ESX = nil

Citizen.CreateThread(function()
	while ESX == nil do
		TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
		Citizen.Wait(50)
	end
end)

local elements = {}
local lastlocation = nil
table.insert(elements, { label = 'Last location' })

local teleportwithveh = false
table.insert(elements, { label = 'Teleport with car' })


--[[
    TELEPORT MENU COORDINATES
    Below you have lines of code that you need to change based on your use
    LABEL - label of location that you can find in menu
    OTHER lines are the actual coordinates
]]--

table.insert(elements, { label = 'Police station', x = 425.1, y = -979.5, z = 30.7  })
table.insert(elements, { label = 'Airport Los Santos', x = -1037.51, y = -2963.24, z = 13.95 })
table.insert(elements, { label = 'Airport Sandy Shores', x = 1718.47, y = 3254.40, z = 41.14})
table.insert(elements, { label = 'Mount Chiliad', x = 501.76, y = 5604.28, z = 797.91})
table.insert(elements, { label = 'Vinewood Sign', x = 663.41, y = 1217.21, z = 322.94})
table.insert(elements, { label = 'Benny\'s', x = -205.73, y = -1303.71, z = 31.24 })
table.insert(elements, { label = 'Los Santos Customs', x = -360.91, y = -129.46, z = 38.70 })
table.insert(elements, { label = 'Top of Maze Bank',  x = -75.20, y = -818.95, z = 326.18 })

--[[
    TELEPORT MENU LOCALE
    You can change notification messages based on your language
]]--


local Locale = {
    ['teleported']  = 'You have teleported to ~b~',
    ['teleport_tpwithcar']  = 'You teleportation with car is ',
    ['teleported_last']  = 'You have teleported to ~r~Last Location',
    ['teleported_last_empty']  = 'You didn\'t visit any location with this menu.',
}

RegisterNetEvent('tpmenu:open')
AddEventHandler('tpmenu:open', function()
    ESX.UI.Menu.CloseAll()					--Close everything ESX.Menu related	
    
    ESX.UI.Menu.Open(
        'default', GetCurrentResourceName(), 'tpmenu',
        {
            title    = 'Teleport menu',
            align    = 'bottom-right',
            elements = elements
        },
        function(data, menu)						--on data selection
            if data.current.label == "Last location" then
                if lastlocation ~= nil then  
                    ESX.Game.Teleport(PlayerPedId(), lastlocation) 
                    ESX.ShowNotification(Locale['teleported_last'])
                else 
                    ESX.ShowNotification(Locale['teleported_last_empty'])
                end
            elseif data.current.label == "Teleport with car" then
                  if teleportwithveh == false then 
                    teleportwithveh = true 
                    ESX.ShowNotification(Locale['teleport_tpwithcar'] .. '~g~ON')
                  else 
                    teleportwithveh = false 
                    ESX.ShowNotification(Locale['teleport_tpwithcar'] .. '~r~OFF')
                  end
            else
                  local playerPed = GetPlayerPed(-1)
                  lastlocation = GetEntityCoords(playerPed )
                  local coords = { x = data.current.x,  y = data.current.y, z = data.current.z}
                  if teleportwithveh == true then
                    local vehicle = GetVehiclePedIsIn(playerPed, false)
                    ESX.Game.Teleport(vehicle , coords)
                    SetPedIntoVehicle(playerPed , vehicle , -1)
                  end
                  ESX.Game.Teleport(playerPed, coords)
         
                  ESX.ShowNotification(Locale['teleported'] .. data.current.label)
            end
            menu.close()							--close menu after selection
          end,
          function(data, menu)
            menu.close()
          end
        )
    
end)

not working
teleport work for player
not for car

it would be possible for you to add the function to open the menu with the help of a key

You have that in reply above…

Try now i change the code.

press key work thx
EDIT after resource restart F5 broke
EDIT2 after reboot the client game F5 work
no probleme with cmd

after complet server reboot it work for a car teleport
only one probleme the player spawn on top of the car …
would it be possible to make it spawner inside the vehicle

Try now i edited my post again.I think it will work fine now.

the command (/ tpmenu) works well
I can teleport myself with the vehicle but when
falls to the ground the player does not follow the vehicle and falls down

and when I try to introduce the key function to open
nothing works