Jump to content

Noob question (getElementPosition to outputChatBox)


Recommended Posts

Posted

Hi. :)

I'm making a script that displays my coordinates in the chatbox, but it's not working. :(

Here's my script:

function getPos() 
    outputChatBox(getElementPosition(theplayer), source) 
end 
addCommandHandler("getpos", getPos) 

Posted
function getPos(theplayer) 
local x,y,z = getElementPosition ( theplayer )  
    outputChatBox(x..", "..y.. ", "..z, theplayer) 
end 
addCommandHandler("getpos", getPos) 

Posted
Damn it. The script you provided also doesn't work.

Nothing happens when I write "getpos" in my console or do /getpos in the chat.

Did you set it to server side in meta.xml?

Posted
  
addCommandHandler("getpos",  
function ()  
      outputChatBox( string.format( 'Position: %s, %s, %s', getElementPosition ( localPlayer ) ) ) 
end 
) 
  

Posted
Damn it. The script you provided also doesn't work.

Nothing happens when I write "getpos" in my console or do /getpos in the chat.

Did you set it to server side in meta.xml?

No, I set it to client. Is that okay?

  
addCommandHandler("getpos",  
function ()  
      outputChatBox( string.format( 'Position: %s, %s, %s', getElementPosition ( localPlayer ) ) ) 
end 
) 
  

Wow!

That works!

Thanks :)

etWsVK7.jpg

Posted
Damn it. The script you provided also doesn't work.

Nothing happens when I write "getpos" in my console or do /getpos in the chat.

It works but it's server sided.

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