Jump to content

Coordinates


Tails

Recommended Posts

Posted

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.

Posted

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) 

Posted (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 by Guest
Posted

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.

Posted
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 xD my fault

Posted

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.

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