Jump to content

Trunk open


Peti930

Recommended Posts

local trunkDoor = -- put true or false if you want first time open put false
function toggleTrunk(player)
    if isPedInVehicle(player) then  - check player is in a car.
	    local car = getPedOccupiedVehicle(player) -- takes the car the player is inside.
		if turnkDoor then  -- put here trunk door and check if it false for open it or close it
		   setVehicleDoorOpenRatio(car)
		else
		   setVehicleDoorOpenRatio(car)
		end
	end
end
addCommandHandler("trunk", toggleTrunk)

 

Edited by Dimos7
Link to comment
local ms = 1000

addCommandHandler("trunk",
function(player)
	local vehicle = getPedOccupiedVehicle(player)
	if isElement(vehicle) then
		if getVehicleDoorOpenRatio(vehicle,1) > 0 then
			setVehicleDoorOpenRatio(vehicle,1,0,ms)
		else
			setVehicleDoorOpenRatio(vehicle,1,1,ms)
		end
	end
end)

Server side

Link to comment
local ms = 1000

addCommandHandler("trunk",
function(player)
	local vehicle = getPedOccupiedVehicle(player)
	if isElement(vehicle) and getElementModel(vehicle) == 541 then
		if getVehicleDoorOpenRatio(vehicle,1) > 0 then
			setVehicleDoorOpenRatio(vehicle,1,0,ms)
		else
			setVehicleDoorOpenRatio(vehicle,1,1,ms)
		end
	end
end)

Use getElementModel

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