Jump to content

Cursor problem


ArmyOfTwo

Recommended Posts

Posted

Hi, i am very beginner in lua!

function ShowBuilding( )
local sx,sy,x,y,z = getCursorPosition ( )
local object = createObject (3596,x, y, z+299, 90, 0, 0)
       ox, oy, oz = getElementPosition(object)
       gz = getGroundPosition( ox, oy, oz )
createObject (3596,x, y, gz, 90+90, 0, 0)
destroyElement( object )
end

It creates the object but in wrong x, y coordinates! When i drive around where it's supposed to be created its competely in different location than my cursos was! Please help me!

Posted

You don't need to create an object then get its position and then get ground possition. Just use getGroundPosition( x, y, z ). When is this function called?

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