Jump to content

Can anyone help with getElementPosition() and , pls?


thasajti

Recommended Posts

I wrote this code, and can't figure out why it won't work.

  
function getPos(player,command,target) 
   if target == nil then 
      outputChatBox(player.." poziciója: "..getElementPosition(player)) 
   else 
      outputChatBox(target.." poziciója: "..getElementPosition(target)) 
   end 
end 
addCommandHandler("pos",getPos) 
  

Link to comment

Try to

  
  
function getPos(player,command,target) 
   x, y, z = getElementPosition(player) 
   tx, ty, tz = getElementPosition(target) 
   if target == nil then 
      outputChatBox(player.." poziciója: "..x..y..z) 
   else 
      outputChatBox(target.." poziciója: "..tx..ty..tz) 
   end 
end 
addCommandHandler("pos",getPos) 
  

Link to comment

Try this :

function getPos ( thePlayer, cmd, target ) 
local t = getPlayerFromName ( target ); 
   if ( isElement ( t ) ) then 
      outputChatBox ( " poziciója: " .. table.concat ( { getElementPosition ( t ) }, ", " ), thePlayer, 0, 255, 0, true ); 
   else 
      outputChatBox ( " poziciója: " .. table.concat ( { getElementPosition ( thePlayer ) }, ", " ), thePlayer, 255, 0, 0, true ); 
   end 
end 
  
addCommandHandler ( "pos", getPos ); 

Its Works Itry It

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