Difference between revisions of "SetVehicleDoorState"

From Multi Theft Auto: Wiki
(Clarified some things.)
m (Added OOP syntax.)
Line 4: Line 4:
  
 
==Syntax==
 
==Syntax==
<syntaxhighlight lang="lua">
+
<syntaxhighlight lang="lua">bool setVehicleDoorState ( vehicle theVehicle, int door, int state )</syntaxhighlight>
bool setVehicleDoorState ( vehicle theVehicle, int door, int state )
+
{{OOP||[[vehicle]]:setDoorState||getVehicleDoorState}}
</syntaxhighlight>
 
  
 
==Required Arguments==
 
==Required Arguments==

Revision as of 22:21, 6 April 2018

This function sets the state of the specified door on a vehicle.

Syntax

bool setVehicleDoorState ( vehicle theVehicle, int door, int state )

OOP Syntax Help! I don't understand this!

Method: vehicle:setDoorState(...)
Counterpart: getVehicleDoorState

Required Arguments

  • theVehicle: The vehicle that you wish to change the door state of.
  • door: An integer representing which door to set the state of. Valid values are:
    • 0: Hood
    • 1: Trunk
    • 2: Front left
    • 3: Front right
    • 4: Rear left
    • 5: Rear right
  • state: An integer representing the state to set the door to. Valid values are:
    • 0: Shut, intact
    • 1: Ajar, intact
    • 2: Shut, damaged
    • 3: Ajar, damaged
    • 4: Missing

Returns

Returns true if the door state was successfully set, false otherwise.

Example

-- create a new vehicle
local newcar = createVehicle ( 520, 1024, 1024, 1024 )
-- break its front left door off
state = setVehicleDoorState ( newcar, 2, 4 )

See Also

FROM VERSION 1.5.7 r19626 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS
FROM VERSION 1.6 r7485 ONWARDS