Tails Posted August 7, 2012 Share Posted August 7, 2012 Hi, I was wondering if there is quick way to fetch coordinates from your ingame ped position? Like print them to the console for example. Thanks in advance. Link to comment
Castillo Posted August 7, 2012 Share Posted August 7, 2012 No, but you can make one within seconds. Functions you need: addCommandHandler getElementPosition outputChatBox Link to comment
Tails Posted August 7, 2012 Author Share Posted August 7, 2012 Yeah, I figured I could Let's see if I can if not I'll come back here and ask for help Link to comment
Tails Posted August 7, 2012 Author Share Posted August 7, 2012 Sorry, am lost once again. function getCoord() local x,y,z = getElementPosition(thePlayer) outputChatbox("Coordinates: " .. getElementPosition(thePlayer) .."", getRootElement(), 255,0,255, true) end addCommandHandler("coord", getCoord) function getCoord() local x,y,z = getElementPosition(thePlayer) outputChatbox("Coordinates:", getRootElement(), 255,0,255, true, x, y, z) end addCommandHandler("coord", getCoord) Link to comment
UAEpro Posted August 7, 2012 Share Posted August 7, 2012 (edited) --- edited .. thanks to Solidsnake14 function getCoord(thePlayer) local x,y,z = getElementPosition(thePlayer) outputChatBox("Coordinates:".." X"..x.." Y"..y.." Z"..z, getRootElement(), 255,0,255, true) end addCommandHandler("coord", getCoord) Edited August 7, 2012 by Guest Link to comment
Castillo Posted August 7, 2012 Share Posted August 7, 2012 Well, first you must define 'thePlayer' in the function name, second you must define the x, y, z variables, like this: local x, y, z = getElementPosition ( thePlayer ) And then output it to the player who used the command. @UAEpro: You didn't define 'thePlayer', also, is outputChatBox, not outputChatbox. Link to comment
TAPL Posted August 7, 2012 Share Posted August 7, 2012 outputChatbox should be outputChatBox Link to comment
UAEpro Posted August 7, 2012 Share Posted August 7, 2012 Well, first you must define 'thePlayer' in the function name, second you must define the x, y, z variables, like this: local x, y, z = getElementPosition ( thePlayer ) And then output it to the player who used the command. @UAEpro: You didn't define 'thePlayer', also, is outputChatBox, not outputChatbox. thanks .. i just fixed it to show the position without looking to the function my fault Link to comment
Tails Posted August 7, 2012 Author Share Posted August 7, 2012 Ah, I noticed I forgot the capital since it wasn't outputting anything at all. And wow. Thank you all! The script just makes so much sense now. 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