Jump to content

SetDoorOpenRatio


Recommended Posts

Made this:

function hoodOpen( thePlayer ) 
  
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
        if vehicle  then 
            hood = setVehicleDoorOpenRatio(vehicle, 0, 1, 3000) 
        else return end 
        if hood     then 
            setVehicleDoorOpenRatio(vehicle, 0, 0, 3000) 
        else return end 
end 
addCommandHandler("hood", hoodOpen) 
  
function trunkOpen( thePlayer ) 
  
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
        if vehicle  then 
            trunk = setVehicleDoorOpenRatio(vehicle, 1, 1, 3000) 
        else return end 
        if trunk    then 
            setVehicleDoorOpenRatio(vehicle, 1, 0, 3000) 
        else return end 
end 
addCommandHandler("trunk", hoodOpen) 
  
function fLeftOpen( thePlayer ) 
  
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
        if vehicle  then 
            fLeft = setVehicleDoorOpenRatio(vehicle, 2, 1, 3000) 
        else return end 
        if fLeft    then 
            setVehicleDoorOpenRatio(vehicle, 2, 0, 3000) 
        else return end 
end 
addCommandHandler("fleft", hoodOpen) 
  
function fRightOpen( thePlayer ) 
  
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
        if vehicle  then 
            fRight = setVehicleDoorOpenRatio(vehicle, 3, 1, 3000) 
        else return end 
        if fRight   then 
            setVehicleDoorOpenRatio(vehicle, 3, 0, 3000) 
        else return end 
end 
addCommandHandler("fright", hoodOpen) 
  
function rLeftOpen( thePlayer ) 
  
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
        if vehicle  then 
            rLeft = setVehicleDoorOpenRatio(vehicle, 4, 1, 3000) 
        else return end 
        if rLeft    then 
            setVehicleDoorOpenRatio(vehicle, 4, 0, 3000) 
        else return end 
end 
addCommandHandler("rleft", hoodOpen) 
  
function rRightOpen( thePlayer ) 
  
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
        if vehicle  then 
            rRight = setVehicleDoorOpenRatio(vehicle, 5, 1, 3000) 
        else return end 
        if rRight   then 
            setVehicleDoorOpenRatio(vehicle, 5, 0, 3000) 
        else return end 
end 
addCommandHandler("rright", hoodOpen) 

I run it, I try writing a command, nothing happens. No error either. The meta is set to server. This function is server and client.

<meta> 
    <info author="Charlie" type="script" description="Car Parts Movement"/> 
    <script src="carparts.lua" type="client"/> 
</meta> 

Link to comment
function hoodOpen( thePlayer ) 
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
    if not vehicle then return end 
    if getVehicleDoorOpenRatio ( vehicle, 0 ) == 0 then 
        setVehicleDoorOpenRatio(vehicle, 0, 1, 3000) 
    else 
        setVehicleDoorOpenRatio(vehicle, 0, 0, 300) 
    end 
end 
addCommandHandler("hood", hoodOpen) 
  
function trunkOpen( thePlayer ) 
     local vehicle = getPedOccupiedVehicle( thePlayer ) 
    if not vehicle then return end 
    if getVehicleDoorOpenRatio ( vehicle, 1 ) == 0 then 
        setVehicleDoorOpenRatio(vehicle, 1, 1, 3000) 
    else 
        setVehicleDoorOpenRatio(vehicle, 1, 0, 300) 
    end 
end 
addCommandHandler("trunk", trunkOpen) 
  
function fLeftOpen( thePlayer ) 
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
    if not vehicle then return end 
    if getVehicleDoorOpenRatio ( vehicle, 2 ) == 0 then 
        setVehicleDoorOpenRatio(vehicle, 2, 1, 3000) 
    else 
        setVehicleDoorOpenRatio(vehicle, 2, 0, 300) 
    end 
end 
addCommandHandler("fleft", fLeftOpen) 
  
function fRightOpen( thePlayer ) 
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
    if not vehicle then return end 
    if getVehicleDoorOpenRatio ( vehicle, 3 ) == 0 then 
        setVehicleDoorOpenRatio(vehicle, 3, 1, 3000) 
    else 
        setVehicleDoorOpenRatio(vehicle, 3, 0, 300) 
    end 
end 
addCommandHandler("fright", fRightOpen) 
  
function rLeftOpen( thePlayer ) 
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
    if not vehicle then return end 
    if getVehicleDoorOpenRatio ( vehicle, 4 ) == 0 then 
        setVehicleDoorOpenRatio(vehicle, 4, 1, 3000) 
    else 
        setVehicleDoorOpenRatio(vehicle, 4, 0, 300) 
    end 
end 
addCommandHandler("rleft", rLeftOpen) 
  
function rRightOpen( thePlayer ) 
    local vehicle = getPedOccupiedVehicle( thePlayer ) 
    if not vehicle then return end 
    if getVehicleDoorOpenRatio ( vehicle, 5 ) == 0 then 
        setVehicleDoorOpenRatio(vehicle, 5, 1, 3000) 
    else 
        setVehicleDoorOpenRatio(vehicle, 5, 0, 300) 
    end 
end 
addCommandHandler("rright", rRightOpen) 

    "Charlie" type="script" description="Car Parts Movement"/> 
    

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