isVehicleWindowOpen | Multi Theft Auto: Wiki Skip to content

isVehicleWindowOpen

Client-side
Server-side
Shared

Manual Review Required

Please finish this page using the corresponding Old Wiki article. Go to Contribution guidelines for more information.


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

  • bool: value

This function returns a boolean which represents window open state.

Code Examples

shared

This example opens the vehicle windows when the local player use /openwindow .

function openVehicleWindow (cmd,number)
if (isPedInVehicle (localPlayer)) then
local vehicle = getPedOccupiedVehicle(localPlayer)
if number and tonumber(number) then
if tonumber(number) > 0 and tonumber(number) < 7 then
setVehicleWindowOpen(vehicle,tonumber(number), not isVehicleWindowOpen( vehicle, tonumber(number)))
end
end
end
end
addCommandHandler ("openwindow",openVehicleWindow)

See Also

Vehicle Functions