Jump to content

Package always on back


DarkLink

Recommended Posts

Hi there guys, I read something by 50p on another post on how to do this.. and from what I understood on that day, I would need to use onClientPreRender, and setElementPosition and setElementRotation on the handler function of the event...

So I made this:

  
  
local object 
function pickweed() 
    local x,y,z = getElementPosition(getLocalPlayer()) 
    local xr,yr,zr = getElementRotation(getLocalPlayer()) 
    object = createObject (1578, x,y-0.0999755859,z+0.300000191) 
    setElementRotation(object, xr, yr+82, zr+270) 
     
    addEventHandler ( "onClientPreRender", getRootElement(), updateObjectCoords) 
end 
addCommandHandler ("pick", pickweed ) 
  
function updateObjectCoords() 
    local x,y,z = getElementPosition(getLocalPlayer()) 
    local xr,yr,zr = getElementRotation(getLocalPlayer()) 
    setElementPosition(object, x,y-0.0999755859,z+0.300000191) 
    setElementRotation(object, xr, yr+82, zr+270) 
     
end 
  

And I guess its fine, but the camera changes gets ZOOMED alot... I dont know why :S

I tryed to change camera with "V" key and nothing ...

Thanks alot in advance guys !

Link to comment
function pickweed() 
    local x,y,z = getElementPosition(localPlayer) 
    local xr,yr,zr = getElementRotation(localPlayer) 
    object = createObject (1578, x,y-0.0999755859,z+0.300000191) 
    setElementRotation(object, xr, yr+82, zr+270) 
    addEventHandler("onClientPreRender",root,updateObjectCoords) 
end 
addCommandHandler ("pick", pickweed ) 
  
function updateObjectCoords() 
    local x,y,z = getElementPosition(localPlayer) 
    local xr,yr,zr = getElementRotation(localPlayer) 
    setElementPosition(object, x,y-0.0999755859,z+0.300000191) 
    setElementRotation(object, xr, yr+82, zr+270) 
    setElementCollisionsEnabled(object, false) 
end 
  

Link to comment
function pickweed() 
    local x,y,z = getElementPosition(localPlayer) 
    local xr,yr,zr = getElementRotation(localPlayer) 
    object = createObject (1578, x,y-0.0999755859,z+0.300000191) 
    setElementRotation(object, xr, yr+82, zr+270) 
    addEventHandler("onClientPreRender",root,updateObjectCoords) 
end 
addCommandHandler ("pick", pickweed ) 
  
function updateObjectCoords() 
    local x,y,z = getElementPosition(localPlayer) 
    local xr,yr,zr = getElementRotation(localPlayer) 
    setElementPosition(object, x,y-0.0999755859,z+0.300000191) 
    setElementRotation(object, xr, yr+82, zr+270) 
    setElementCollisionsEnabled(object, false) 
end 
  

You don't have to do it on every frame. Just disable collision after creating the object.

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