Jump to content

Help AttachElement and MoveObject


Namorek

Recommended Posts

learn lua? begging us for doing whole script for you wont help i think..

there was a lot of scripts moving objects in two ways here, look in this forum for them..

and just add attach object, and thats all

this could help you (click on the function name to get more help)

attachElements
moveObject

Link to comment
learn lua? begging us for doing whole script for you wont help i think..

there was a lot of scripts moving objects in two ways here, look in this forum for them..

and just add attach object, and thats all

this could help you (click on the function name to get more help)

attachElements
moveObject

Yes Lua bur please give me Code look you my idea http://img339.imageshack.us/img339/604/beztytuuxej.jpg you know??

Link to comment

lol, varez will be mad, but ill try

local x,y,z,object= --offsets and object here
function moveUp()
setTimer(function()
     z=z+0.2
setElementAttachedOffsets(object,x,y,z)
end,200,40)
setTimer(moveDown,8000,1)
end
 
function moveDown()
setTimer(function()
     z=z-0.2
setElementAttachedOffsets(object,x,y,z)
end,200,40)
setTimer(moveUp,8000,1)
end

just call one of the functions to start the move

Link to comment
lol, varez will be mad, but ill try
local x,y,z,object= --offsets and object here
function moveUp()
setTimer(function()
     z=z+0.2
setElementAttachedOffsets(object,x,y,z)
end,200,40)
setTimer(moveDown,8000,1)
end
 
function moveDown()
setTimer(function()
     z=z-0.2
setElementAttachedOffsets(object,x,y,z)
end,200,40)
setTimer(moveUp,8000,1)
end

just call one of the functions to start the move

Nice Job but no has Attach Vehicle :(

Link to comment

car = createVehicle(400,0,0,5)
marker = createMarker(0,0,0,"ring")
offset = 2
max_offset, min_offset = 10, 2
bool = true
obnizacz = 0.05
 
attachElements(marker, car, 0, 0, offset)
 
addEventHandler("onClientRender", getRootElement(), 
   function ()
       if bool then
           if offset >= max_offset then
               bool = false
           else
               offset = offset + obnizacz
           end
       else
           if offset <= min_offset then
               bool = true
           else
               offset = offset - obnizacz
           end
       end
 
       setElementAttachedOffsets(marker, 0, 0, offset)
   end)

+

local x,y,z,object= --offsets and object here
function moveUp()
  setTimer(function()
     z=z+0.2
     setElementAttachedOffsets(object,x,y,z)
  end,200,40)
  setTimer(moveDown,8000,1)
end
 
function moveDown()
setTimer(function()
     z=z-0.2
     setElementAttachedOffsets(object,x,y,z)
  end,200,40)
  setTimer(moveUp,8000,1)
end

=

My Code is good??

But How Attach+Move=..... Help!!

Link to comment

1) use the [ lua] [ /lua] tags!really annoying noobs cant get that

2)your code is invalid, the moving speed is depending on fps, and that will cause general unsync and look not the best

3)you still dont get

YOU CANT MOVE AN OBJECT WITCH IS ATTACHED

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