Jump to content

guiSetText issue


|H|TiTanium

Recommended Posts

Basically when a player presses the "myButton2" button, the three edit boxes should output player's position. Like this:

I click on "myButton2" ( which says "Get Pos" ), then the first edit box shows my X cord. the 2nd shows my Y cord, and 3rd shows Z position. Tell me what is wrong please and help me please.

function tele() 
    local x = guiGetText ( myEdit2 ) 
    local y = guiGetText ( myEdit3 ) 
    local z = guiGetText ( myEdit4 ) 
    getElementPosition ( localplayer, x, y, z ) 
    guiSetText ( myEdit2, x ) 
    guiSetText ( myEdit3, y ) 
    guiSetText ( myEdit4, z ) 
end 
addEventHandler ( "onClientGUIClick", myButton2, tele, false ) 

Link to comment

You messed it up, there's no need for guiGetText, and you had to define x, y, z from getElementPosition.

function tele ( ) 
    local x, y, z = getElementPosition ( localPlayer ) 
    guiSetText ( myEdit2, x ) 
    guiSetText ( myEdit3, y ) 
    guiSetText ( myEdit4, z ) 
end 
addEventHandler ( "onClientGUIClick", myButton2, tele, false ) 

Also, is "localPlayer" not "localplayer".

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