GetVehiclePanelState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 5: Line 5:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int getVehiclePanelState ( vehicle thevehicle, int panel )
int getVehiclePanelState ( vehicle theVehicle, int panel )
</syntaxhighlight>  
</syntaxhighlight>  


Line 20: Line 20:


==Returns==
==Returns==
Returns an [[int]] indicating the state of the specified the panel. This is a value between 0 and 3, with 0 indicating the panel is undamaged and 3 indicating it is very damaged.
Returns an [[int]]eger indicating the state of the specified the panel. This is a value between 0 and 3, with 0 indicating the panel is undamaged and 3 indicating it is very damaged.


==Example==
==Example==
This function creates an admiral and outputs every panel's state in the chatbox.
This function creates an admiral and outputs every panel's state in the chatbox.
<syntaxhighlight lang="lua">local admiral = createVehicle ( 445, 0, 0, 10 )
<syntaxhighlight lang="lua">
 
local admiral = createVehicle ( 445, 0, 0, 10 )
for i=0, 6 do
for i=0, 6 do
  local panel = getVehiclePanelState ( admiral, i )
    local panel = getVehiclePanelState ( admiral, i )
     outputChatBox ( panel )
     outputChatBox ( tostring ( panel ) )
end
end
</syntaxhighlight>
</syntaxhighlight>
Line 34: Line 34:
==See Also==
==See Also==
{{Vehicle functions}}
{{Vehicle functions}}
[[Category:Incomplete]]

Revision as of 20:33, 25 March 2009

This function returns the current state of a specifed panel on the vehicle. A vehicle can have up to 7 panels.

Syntax

int getVehiclePanelState ( vehicle theVehicle, int panel )

Required Arguments

  • theVehicle: The vehicle that you wish to know the panel state of.
  • panel: An integer specifying the panel you want to know the state of. Not every vehicle has every panel. Possible values are:
    • 0: Front-left panel
    • 1: Front-right panel
    • 2: Rear-left panel
    • 3: Rear-right panel
    • 4: Windscreen
    • 5: Front bumper
    • 6: Rear bumper

Returns

Returns an integer indicating the state of the specified the panel. This is a value between 0 and 3, with 0 indicating the panel is undamaged and 3 indicating it is very damaged.

Example

This function creates an admiral and outputs every panel's state in the chatbox.

local admiral = createVehicle ( 445, 0, 0, 10 )
for i=0, 6 do
    local panel = getVehiclePanelState ( admiral, i )
    outputChatBox ( tostring ( panel ) )
end

See Also