GetVehicleDoorOpenRatio: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{Server client function}}
{{Server client function}}
This function tells you how open a door is. Doors include boots/trunks and bonnets on vehicles that have them.
This function tells you how open a door is (the 'open ratio'). Doors include boots/trunks and bonnets on vehicles that have them.


==Syntax==
==Syntax==
Line 10: Line 10:
==Required Arguments==
==Required Arguments==
*'''theVehicle:''' The [[vehicle]] that you wish to get the door open ratio of.
*'''theVehicle:''' The [[vehicle]] that you wish to get the door open ratio of.
*'''door:''' An integer between 0 and 5 specifying the door you want to get the open ratio of.
*'''door:''' An integer between 0 and 5 specifying which door you want to get the open ratio of.


==Returns==
==Returns==
Returns the door open ratio, or ''false'' if invalid arguments are passed.
Returns a number between 0 and 1 that indicates how open the door is. 0 is closed, and 1 is fully open. Returns ''false'' if invalid arguments are passed.


==Example==
==Example==

Revision as of 01:21, 18 January 2011

This function tells you how open a door is (the 'open ratio'). Doors include boots/trunks and bonnets on vehicles that have them.

Syntax

float getVehicleDoorOpenRatio ( vehicle theVehicle, int door )

Required Arguments

  • theVehicle: The vehicle that you wish to get the door open ratio of.
  • door: An integer between 0 and 5 specifying which door you want to get the open ratio of.

Returns

Returns a number between 0 and 1 that indicates how open the door is. 0 is closed, and 1 is fully open. Returns 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