SetVehicleDoorOpenRatio

From Multi Theft Auto: Wiki
Revision as of 21:07, 16 January 2011 by Alberto Alonso (talk | contribs) (Created page with "__NOTOC__ {{Server client function}} This function sets the door open ratio on a vehicle. ==Syntax== <syntaxhighlight lang="lua"> bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, f...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This function sets the door open ratio on a vehicle.

Syntax

bool setVehicleDoorOpenRatio ( vehicle theVehicle, int door, float ratio [, int time ] )

Required Arguments

  • theVehicle: The vehicle that you wish to change the door open ratio of.
  • door: An integer between 0 and 5 specifying the door you want to change open ratio of.
  • ratio: The ratio value, ranging from 0 (fully closed) to 1 (fully open).

Optional Arguments

NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.

  • time: The time that the change will take. A value of 0 will change the door open ratio inmediately.

Returns

Returns true if the door open ratio was successfully set, false if invalid arguments are passed.

Example

addCommandHandler ( "carshowoff", function ( playerSource )
	local vehicle = getPedOccupiedVehicle ( playerSource )
	if vehicle then
		for i=0,5 do
			setVehicleDoorOpenRatio ( vehicle, i, 1 - getVehicleDoorOpenRatio ( vehicle, i ), 2500 )
		end
	end
end )

See Also