Jump to content

Scripting a Teleporter with a GUI


Recommended Posts

Posted

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.

Hey, Ich bin der Gründer und Besitzer von Fun Zentrale | Fun Central.

Hey, I'm the owner of Fun Zentrale | Fun Central.

Fun Zentrale | Fun Central

Website DE: http://www.funzentrale.de.tl

Website EN: http://www.funcentral-english.page.tl

YouTube: http://youtube.com/user/funzentrale

FZFC & DJFG - Entertainment

Website DE: http://fzfc-djfg-entertainment.de.tl/Home.htm

Website EN: http://fzfc-djfg-entertainment-english.page.tl/

Posted

Yeah, but I don't know how to put that all together.

Hey, Ich bin der Gründer und Besitzer von Fun Zentrale | Fun Central.

Hey, I'm the owner of Fun Zentrale | Fun Central.

Fun Zentrale | Fun Central

Website DE: http://www.funzentrale.de.tl

Website EN: http://www.funcentral-english.page.tl

YouTube: http://youtube.com/user/funzentrale

FZFC & DJFG - Entertainment

Website DE: http://fzfc-djfg-entertainment.de.tl/Home.htm

Website EN: http://fzfc-djfg-entertainment-english.page.tl/

Posted

What should I do with "onClientGUIClick" and triggerServerEvent, sorry but I don't understand that part.

Hey, Ich bin der Gründer und Besitzer von Fun Zentrale | Fun Central.

Hey, I'm the owner of Fun Zentrale | Fun Central.

Fun Zentrale | Fun Central

Website DE: http://www.funzentrale.de.tl

Website EN: http://www.funcentral-english.page.tl

YouTube: http://youtube.com/user/funzentrale

FZFC & DJFG - Entertainment

Website DE: http://fzfc-djfg-entertainment.de.tl/Home.htm

Website EN: http://fzfc-djfg-entertainment-english.page.tl/

Posted

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?

Hey, Ich bin der Gründer und Besitzer von Fun Zentrale | Fun Central.

Hey, I'm the owner of Fun Zentrale | Fun Central.

Fun Zentrale | Fun Central

Website DE: http://www.funzentrale.de.tl

Website EN: http://www.funcentral-english.page.tl

YouTube: http://youtube.com/user/funzentrale

FZFC & DJFG - Entertainment

Website DE: http://fzfc-djfg-entertainment.de.tl/Home.htm

Website EN: http://fzfc-djfg-entertainment-english.page.tl/

Posted

My Script is not for GUI, it's for using commands in chat. So I think first it has to create a GUI on the client-side and then it should create buttons, but yeah, you're right i have to learn first

Hey, Ich bin der Gründer und Besitzer von Fun Zentrale | Fun Central.

Hey, I'm the owner of Fun Zentrale | Fun Central.

Fun Zentrale | Fun Central

Website DE: http://www.funzentrale.de.tl

Website EN: http://www.funcentral-english.page.tl

YouTube: http://youtube.com/user/funzentrale

FZFC & DJFG - Entertainment

Website DE: http://fzfc-djfg-entertainment.de.tl/Home.htm

Website EN: http://fzfc-djfg-entertainment-english.page.tl/

Posted

Thanks!

Hey, Ich bin der Gründer und Besitzer von Fun Zentrale | Fun Central.

Hey, I'm the owner of Fun Zentrale | Fun Central.

Fun Zentrale | Fun Central

Website DE: http://www.funzentrale.de.tl

Website EN: http://www.funcentral-english.page.tl

YouTube: http://youtube.com/user/funzentrale

FZFC & DJFG - Entertainment

Website DE: http://fzfc-djfg-entertainment.de.tl/Home.htm

Website EN: http://fzfc-djfg-entertainment-english.page.tl/

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...