Jump to content

Truck job, ramp lift up/down


DzMG-LV

Recommended Posts

Okey, i've see'n on SeeMTA when them have trucker job, when u can lift up/down truck's ramp. I've made when u can lift up/down ramp with cmd using setVehicleComponentVisible, setVehicleComponentPosition/Rotation, but that ramp, i can't stay on it, it's like a just texture. What would i need to do, to ramp is like object.

Heres video:

Link to comment
I think you should use these functions. Create an object and when the ramp is moving down then set the objects rotation
  
createObject 
setElementRotation 
setElementAlpha 
  

Okey but how can i make it, when i use cmd /rampdown it will moves with ramp in same position?

Link to comment

Try this:

  
function move_ramp() 
local veh = getPedOccupiedVehicle ( localPlayer) 
local x,y,z = getElementPosition(veh) 
   if veh then 
      ramp = createObject ( 0, 0, 0, 1000, 90, 0, 0 ) 
      setElementAlpha(ramp , 0) 
      attachElements ( ramp , veh, x, y, z ) 
  
      local rotX, rotY, rotZ = getElementRotation(ramp ) 
      setElementRotation(ramp ,rotX,rotY,rotZ+10) 
end 
end 
addCommandHandler("rampdown", move_ramp) 
  

Link to comment
Try this:
  
function move_ramp() 
local veh = getPedOccupiedVehicle ( localPlayer) 
local x,y,z = getElementPosition(veh) 
   if veh then 
      ramp = createObject ( 0, 0, 0, 1000, 90, 0, 0 ) 
      setElementAlpha(ramp , 0) 
      attachElements ( ramp , veh, x, y, z ) 
  
      local rotX, rotY, rotZ = getElementRotation(ramp ) 
      setElementRotation(ramp ,rotX,rotY,rotZ+10) 
end 
end 
addCommandHandler("rampdown", move_ramp) 
  

Hmm nope it isnt that what i need.

Heres my script:

Client

addEvent( "rampdown", true ) 
addEventHandler( "rampdown", localPlayer, function ( theVeh ) 
              setTimer( 
              function() 
              theVeh = getPedOccupiedVehicle(localPlayer) 
              x, y, z = getVehicleComponentPosition( theVeh, "boot_dummy") 
              rx, ry, rz = getVehicleComponentRotation(theVeh, "boot_dummy" )              
              --setVehicleComponentPosition( theVeh, "boot_dummy", x, y, z+0.1 ) 
              setVehicleComponentRotation(theVeh, "boot_dummy", rx-0.8, 0, 0 ) 
              end, 50, 113) 
              
end ) 

Server:

addCommandHandler("rampdown", function ( thePlayer ) 
     if isPedInVehicle ( thePlayer ) then 
          local veh = getPedOccupiedVehicle ( thePlayer ) 
          for i, player in ipairs ( getElementsByType("player") ) do 
               triggerClientEvent ( player, "rampdown", player, veh ) 
          end 
     end 
end ) 

Link to comment
Okey new problem, when i open that ramp it opens only for player who use's cmd /rampdown, only he can see when its open.

You need make when player writes command /rampdown, it goes trough server side and goes back to client side and then only executes command it should work then.

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