Jump to content

Add coordinate


Recommended Posts

Posted

Hello,

Here is my problem : I have this line :

setElementPosition( veh, getElementPosition( other ) ) 

I would like to add 2 to z, how can I make that ? (other is a teleporter's marker, and the vehicles spawn througt the ground.

Thanks.

Posted

If u want to put Z for the element u have to put all the arguments before, u cant define an argument after the ones that werent declared. did u understand ?

  
setElementPosition ( element theElement, float x, float y, float z [, bool warp = true ] ) 
  

The function gets an element, a float x, a float y , a float z.. and an optional argument.

So if u want to declare only the float z, u also need to declare the float x and y and ofc the element.

But if u dont want to change the X and Y, put the same .

Sorry if u didnt understand,

I am portuguese and my english sucks :S

EDIT: Nevermind I didnt understand u, u want this:

  
local x,y,z = getElementPosition (other) 
  
setElementPosition(veh, x, y, z +2) 
  

try it ;)

Posted
Maybe make variables be4? =] like this
local x,y,z2 = getElementPosition( other ) 
local z = z2+2 
setElementPosition( veh, x,y,z ) 
  

he can make the + 2 inside the function ;)

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