SetVehicleDoorState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:


==Syntax==
==Syntax==
<section name="Server and Client" class="both" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
setVehicleDoorState ( vehicle theVehicle, int door, int state )
setVehicleDoorState ( vehicle theVehicle, int door, int state )
Line 21: Line 20:
==Returns==
==Returns==
Returns ''true'' if the door state was successfully set, ''false'' if invalid arguments, invalid door IDs or invalid state IDs are passed.
Returns ''true'' if the door state was successfully set, ''false'' if invalid arguments, invalid door IDs or invalid state IDs are passed.
</section>


==Example==
==Example==
<section name="Server and Client" class="both" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- create a new vehicle
-- create a new vehicle
Line 31: Line 28:
state = setVehicleDoorState ( newcar, 2, 4 )
state = setVehicleDoorState ( newcar, 2, 4 )
</syntaxhighlight>
</syntaxhighlight>
</section>


==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}

Revision as of 15:50, 19 February 2009

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

Syntax

setVehicleDoorState ( vehicle theVehicle, int door, int state )

Required Arguments

  • theVehicle: The vehicle that you wish to change the door state of.
  • door: An integer between 0 and 5 specifying the door you want to change state of.
  • state: An integer determining the new state of the door:
    • 0: intact
    • 1: swinging free
    • 2: bashed
    • 3: bashed and swinging free
    • 4: missing

Returns

Returns true if the door state was successfully set, false if invalid arguments, invalid door IDs or invalid state IDs are passed.

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