Jump to content

Scripting a Teleporter with a GUI


Recommended Posts

Hey Guys,

my Question ist how to script a GUI?

Because i want to add that when you press 'F4' it should open a Window where you can choose between some places and than there should be a butten which teleportes you when you press it.

Does somebody know how it works?

The script which I have made til now only can teleport you with a command in the chat. It works but I would prefer a solution with a GUI and the wiki couldn't help me.

That's my solution without a GUI:

    function LosSantos (thePlayer) 
        setElementInterior ( thePlayer, 0, 2496.23, -1688.27, 14.70 ) 
        setElementPosition ( thePlayer, 2496.23, -1688.27, 14.70 ) 
        outputChatBox ( "TP: ".. getPlayerName(thePlayer) .. ": Teleported to Los Santos with /LosSantos | Teleportierte sich nach Los Santos mit /LosSantos", root, 0, 255, 0 ) 
    end 
    addCommandHandler ( "LosSantos", LosSantos ) 
    addCommandHandler ( "losSantos", LosSantos ) 
    addCommandHandler ( "Lossantos", LosSantos ) 
    addCommandHandler ( "lossantos", LosSantos ) 
  
    function SanFierro (thePlayer) 
        setElementInterior ( thePlayer, 0, -2421.39965, -624.4323, 132.66188 ) 
        setElementPosition ( thePlayer, -2421.39965, -624.4323, 132.66188 ) 
        outputChatBox ( "TP: ".. getPlayerName(thePlayer) .. ": Teleported to San Fierro with /SanFierro | Teleportierte sich nach San Fierro mit /SanFierro", root, 0, 255, 0 ) 
    end 
    addCommandHandler ( "SanFierro", SanFierro ) 
    addCommandHandler ( "sanFierro", SanFierro ) 
    addCommandHandler ( "Sanfierro", SanFierro ) 
    addCommandHandler ( "sanfierro", SanFierro ) 
  
    function LasVenturas (thePlayer) 
        setElementInterior ( thePlayer, 0, 1999.54, 1544.04, 13.88 ) 
        setElementPosition ( thePlayer, 1999.54, 1544.04, 13.88 ) 
        outputChatBox ( "TP: ".. getPlayerName(thePlayer) .. ": Teleported to Las Venturas with /LasVenturas | Teleportierte sich nach Las Venturas mit /LasVenturas", root, 0, 255, 0 ) 
    end 
    addCommandHandler ( "LasVenturas", LasVenturas ) 
    addCommandHandler ( "Lasventuras", LasVenturas ) 
    addCommandHandler ( "lasVenturas", LasVenturas ) 
    addCommandHandler ( "lasventuras", LasVenturas ) 
  
    function Ranch (thePlayer) 
        setElementInterior ( thePlayer, 0, -683.5206, 952.4695, 12.1328 ) 
        setElementPosition ( thePlayer, -683.5206, 952.4695, 12.1328 ) 
        outputChatBox ( "TP: ".. getPlayerName(thePlayer) .. ": Teleported to the Ranch with /Ranch | Teleportierte sich zur Ranch mit /Ranch", root, 0, 255, 0 ) 
    end 
    addCommandHandler ( "Ranch", Ranch ) 
    addCommandHandler ( "ranch", Ranch ) 

Thank you for your possibilities in advance.

Link to comment

Okay, but what do I have to write in the script?

    
 function LosSantos (thePlayer) 
        "onClientGUIClick" 
        triggerServerEvent 
        setElementInterior ( thePlayer, 0, 2496.23, -1688.27, 14.70 ) 
        setElementPosition ( thePlayer, 2496.23, -1688.27, 14.70 ) 
        outputChatBox ( "TP: ".. getPlayerName(thePlayer) .. ": Teleported to Los Santos with /LosSantos | Teleportierte sich nach Los Santos mit /LosSantos", root, 0, 255, 0 ) 
    end 
    addCommandHandler ( "LosSantos", LosSantos ) 
    addCommandHandler ( "losSantos", LosSantos ) 
    addCommandHandler ( "Lossantos", LosSantos ) 
    addCommandHandler ( "lossantos", LosSantos ) 
  

What do i have to add?

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...