|H|TiTanium Posted September 19, 2013 Share Posted September 19, 2013 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
Castillo Posted September 19, 2013 Share Posted September 19, 2013 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
|H|TiTanium Posted September 19, 2013 Author Share Posted September 19, 2013 It wasn't working, then I tried deleting some spaces between functions and parentheses, and now it works perfectly. Thank you for helping me. Link to comment
Castillo Posted September 19, 2013 Share Posted September 19, 2013 The spaces have nothing to do with that, the code I posted has to work. Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now