GetVehiclePanelState: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
m (Fixed broken redirect.)
 
(12 intermediate revisions by 5 users not shown)
Line 1: Line 1:
__NOTOC__
{{Server client function}}
{{Server client function}}
__NOTOC__
This function returns the current state of a specifed panel on the vehicle. A vehicle can have up to 7 panels.
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
This fake function is for use with blah & blah and does blahblahblabhalbhl


==Syntax==  
==Syntax==  
<!-- NOTE: don't use 'special' names for variable names, e.g. you shouldn't be writing things like 'player player, vehicle vehicle', instead write something like 'player thePlayer, vehicle vehicleToGetInto'. This is less confusing and prevents the syntax highlighting being odd -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
int getVehiclePanelState ( vehicle thevehicle, int panel )
int getVehiclePanelState ( vehicle theVehicle, int panel )
</syntaxhighlight>  
</syntaxhighlight>  
{{OOP||[[vehicle]]:getPanelState||setVehiclePanelState}}


===Required Arguments===  
==Required Arguments==
<!-- List each argument one per line. This should be the argument's name as in the argument list above, NOT the argument's data type -->
*'''theVehicle:''' the [[vehicle]] that you wish to know the panel state of.
*'''argumentName:''' description
*'''panel:''' an ''integer'' specifying the panel you want to know the state of. Not every vehicle has every panel. Possible values are:
<!-- Only include this section below if there are optional arguments -->
** '''0:''' Front-left panel
===Optional Arguments===
** '''1:''' Front-right panel
{{OptionalArg}}
** '''2:''' Rear-left panel
*'''argumentName2:''' description
** '''3:''' Rear-right panel
*'''argumentName3:''' description
** '''4:''' Windscreen
** '''5:''' Front bumper
** '''6:''' Rear bumper


===Returns===
==Returns==
<!-- Make this descriptive. Explain what cases will return false. If you're unsure, add a tag to it so we can check -->
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 ''true'' if blah, ''false'' otherwise.
*returns state as integer for the panel  


==Example==  
==Example==
<!-- Explain what the example is in a single sentance -->
This function creates an admiral and outputs every panel's state in the chatbox.
This example does...
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
local admiral = createVehicle ( 445, 0, 0, 10 )
blabhalbalhb --abababa
for i=0, 6 do
--This line does this...
    local panel = getVehiclePanelState ( admiral, i )
mooo
    outputChatBox ( tostring ( panel ) )
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
<!-- Change FunctionArea to the area that this function is in on the main function list page, e.g. Server, Player, Vehicle etc -->
{{Vehicle functions}}
{{FunctionArea_functions}}
[[Category:Incomplete]] -- leave this unless you complete the function

Latest revision as of 00:25, 7 April 2018

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 )

OOP Syntax Help! I don't understand this!

Method: vehicle:getPanelState(...)
Counterpart: setVehiclePanelState


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 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.

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