IsVehicleWindowOpen

From Multi Theft Auto: Wiki
Revision as of 15:06, 10 September 2015 by Mr.SFA7 (talk | contribs) (→‎Example)
Jump to navigation Jump to search

Accessories-text-editor.png Script Example Missing Function IsVehicleWindowOpen needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.

This function gets the vehicle window state.

Syntax

bool isVehicleWindowOpen ( vehicle theVehicle, int window )

Required arguments

  • theVehicle: The vehicle that you wish to get the window state.
  • window: An integer representing a vehicle window. It can be:
    • 0: motorbike shield
    • 1: rear window
    • 2: right front window
    • 3: right back window
    • 4: left front (driver) window
    • 5: left back window
    • 6: windshield

Returns

This function returns a boolean which represents window open state.

Example

table = { 4, 2, 5, 3 }

addCommandHandler ("Window_vehicle", function (  )
  if ( isPedInVehicle ( localPlayer ) ) then
 local vehicle = getPedOccupiedVehicle( localPlayer ) 
 local window = getPedOccupiedVehicleSeat( localPlayer )
 setVehicleWindowOpen( vehicle, table[window], not isVehicleWindowOpen( vehicle, table[window] ) )
	      end
    end
 )

See also

Shared