[Release] esx_teleports, easy configurable teleport script, you can specify jobs

This script was just made because i had nothing to do, if you want teleporters to interiors etc. You could use this script and specify a job if you would like only an certain job to access it, easy configurable in config.lua.

If you find any bug feel free to comment down below.

Download

esx_teleports Download

11 Likes

:thinking:


Previews? Screenshots? Gifs? Video? Would make it easier so people can see what they are downloading lol. Even if it is a basic script.

5 Likes

There is redundant code in this script.

In the first part you do the following

PlayerData = ESX.GetPlayerData()

But a bit further down with esx:playerLoaded

PlayerData = xPlayer

So that code is very very redundant to be honest, you do the same thing 2 times

What you could do insted is move LoadMarkers() down in to esx:playerLoaded, and clean up the first part.

It makes more sence to me using the build in function thats called when data is loaded esx:playerLoaded.

You avoid setting the same variable twice, and avoid the check to se if ESX.GetPlayerData() is not nil.

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

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
    PlayerData = xPlayer
    LoadMarkers()
end)

Original code

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

    while ESX.GetPlayerData() == nil do
        Citizen.Wait(10)
    end

    PlayerData = ESX.GetPlayerData()

    LoadMarkers()
end) 

RegisterNetEvent('esx:playerLoaded')
AddEventHandler('esx:playerLoaded', function(xPlayer)
    PlayerData = xPlayer
end)

It’s for restarting the script if you restart it it wont do esx:playerLoaded

True. but why keep esx:playerLoaded then ? if you load it the other way, there should be no need for playerLoaded

Thank you very much, @qalle ! Just in time of need! :slight_smile:

1 Like

So the way you explain is the right way ?

Can i use more than 1 job? I need to make an entrance to a nightclub for everyone to use

1 Like

Did any one have this working every time i go in to a map building whitch it base under the ground it TP’s me and car on top of ground and not in building under the ground please help here

i’m trying to dev so that the tp function works with esx_organization

anyone know how to add it so it allows you to teleport with a vehicle?

I’d also love being able to teleport with vehicle

is it teleport vehicle too ?

Teleport with car.
main.lua (5.2 KB)

4 Likes

@franfdezmorales
es, I use the ESX nightclub script also released in on this Forum, It was just alot easier :slight_smile:

Thank you for replying! :slight_smile:

Hey!! u know how can i chance the specify job for a servergroup

can we change heading?

Hello, first of all thank you for this great contribution.
And now I wanted to ask you if there is a way instead of leaving the message floating on the marker, you can put the typical message up on the left “Press [Symbol E key] to move”.
From what I’ve seen in the plugins that include it, the function is

function alert(msg)
    SetTextComponentFormat("STRING")
    AddTextComponentString(msg)
    DisplayHelpTextFromStringLabel(0,0,1,-1)
end

It would be great to be able to implement it in this way, if someone knew how to do it, I would appreciate it.

you got this?? it would be great !!! Thanks for the great script qalle