Jump to content

CreateMovingObject


kalitonchik

Recommended Posts

help please

I have many times tried to run these scripts, but without success

and examples from the wiki do not work

http://development.mtasa.com/index.php?title=MoveObject

please help a fool

createObject(id,posX,posY,posZ) 
moveObject( there i need set value to up and down +;-value_posZ ) 
hear    command for object move speed ( in whot time fore exemple 5 sek ) 

this is my guess please help to run this script

Link to comment
i whont create moving object script include tdma map

this is my attemp

function createObject( 3117, 2500, 450.5, 9.6 )

moveObject ( 5000, x, y, -2 / +2 )

end

object dont spawn so he can moveXD

whot i lost

whot can i do? act a fool!

Lol, your doing the createObject in the function now?

  
function createAndShowObject() 
myobject = createObject( 3117, 2500, 450.5, 9.6 ) 
moveObject ( myobject, 5000, x, y, -2 / +2 ) 
end 
addCommandHandler("showobject", createAndShowObject) 
  

Try that :redhotevil:

Link to comment
eror at

unexpected symbol near '+'

so i deleted / +2 (to see whots hapens next)

but now another eror

ERROR: Couldn't packetize argument list, invalid element specified.

  
function createAndShowObject() 
myobject = createObject( 3117, 2500, 450.5, 9.6 ) 
moveObject ( myobject, 5000, 2500, 450.5, 15 ) 
end 
addCommandHandler("showobject", createAndShowObject) 
  

This will move the object up. (Takes 5 seconds, as you can see, moveObject( myObject, 5000ms <--- ))

Link to comment
hm but whot you can tell about this?!

ERROR: Couldn't packetize argument list, invalid element specified.

( object dont spawn ) :-k

Alright. Lets do it this way then.

  
function loadObjects() 
myobject = createObject( 3117, 2500, 450.5, 9.6 ) 
end 
addEventHandler("onResourceStart", getRootElement(), loadObjects) 
  
function moveObjects() 
moveObject ( myobject, 5000, 2500, 450.5, 15 ) 
end 
addCommandHandler("showobject", moveObjects) 
  

Link to comment

  
function loadObjects() 
myobject = createObject( 3117, 2500, 450.5, 9.6 ) 
end 
addEventHandler("onResourceStart", getRootElement(), loadObjects) 
  
function moveObjects() 
moveObject(myobject, 5000, 2500, 450.5, 15 ) 
end 
addCommandHandler("showobject", moveObjects) 
  

There cant be anything wrong with it. Exept that your doing it clientsided, or you just dont know where the object is. I spawned an object on other X,Y,Z´s in my server. With this script. Worked like a charm.

Link to comment

function loadObjects()

myobject = createObject( 3117, 2500, 480, 10.5 )

end

addEventHandler("onResourceStart", getRootElement(), loadObjects)

function moveObjects()

local 2500, 480, 10.5, = getElementPosition ( object )

local 12.5 = 10.5 + 2

moveObject ( object, 5000, 2500, 480, 12.5 )

end

addCommandHandler("showobject", moveObjects)

donw work

dont spawn object

and eror '' expected near '2500'

Link to comment

  
function loadObjects() 
myobject = createObject ( 1337, 5540.6654, 1020.55122, 1240.545, 90, 0, 0 ) 
end 
addEventHandler("onResourceStart", getRootElement(), loadObjects) 
  
function moveObjects() 
moveObject(myobject, 5000, 2500, 450.5, 15 ) 
end 
addCommandHandler("showobject", moveObjects) 
  

¨

Ingame, go to the coordinateds 5540, 1020, 1240

Link to comment
local x, y, z = getElementPosition ( myObject ) 

use this instead. u said getELementPosition ( object ) ive looked through your code and "object" does not exist... u have to provie the specific object name in this case it is myObject

U use getElementPosition to get the position. If u provide the numbers for the arguement like u did it would be more like setting the position I guess

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