SetVehicleDoorsUndamageable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
(OOP)
 
(11 intermediate revisions by 8 users not shown)
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
<!-- Describe in plain english what this function does. Don't go into details, just give an overview -->
{{Server client function}}
This fake function is for use with blah & blah and does blahblahblabhalbhl
This function makes a vehicle's doors undamageable, so they won't fall off when they're hit. Note that the vehicle '''has''' to be locked using [[setVehicleLocked]] for this setting to have any effect.


==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">
bool setVehicleDoorsUndamageable ( vehicle thevehicle, bool state )
bool setVehicleDoorsUndamageable ( vehicle theVehicle, bool state )
</syntaxhighlight>  
</syntaxhighlight>  
 
{{OOP||[[vehicle]]:setDoorsUndamageable|doorsUndamageable}}
===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]] of which you wish to set the car door damageability.
*'''argumentName:''' description
*'''state:''' A boolean denoting whether the vehicle's doors are undamageable (''true'') or damageable (''false'').
 
<!-- Only include this section below if there are optional arguments -->
===Optional Arguments===
{{OptionalArg}}
*'''argumentName2:''' description
*'''argumentName3:''' description


===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 ''true'' if the damageability state was successfully changed, ''false'' if invalid arguments were passed.
Returns ''true'' if blah, ''false'' otherwise.


==Example==  
==Example==
<!-- Explain what the example is in a single sentance -->
Here you can disable all vehicles doors damage with /nodamage, and enable it with /adddamage.
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...
function doorsLikeGod()
blabhalbalhb --abababa
for i, car in ipairs( getElementsByType ("vehicle") ) do
--This line does this...
setVehicleDoorsUndamageable ( car, true )
mooo
end
outputChatBox("All vehicles doors is not damageable")
end
addCommandHandler("nodamage", doorsLikeGod)
 
function doorsNotLikeGod()
for i, car in ipairs( getElementsByType ("vehicle") ) do
setVehicleDoorsUndamageable ( car, false )
end
outputChatBox("Now everyone can kick vehicles doors and throw them away.")
end
addCommandHandler("adddamage", doorsNotLikeGod)
</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 23:30, 17 December 2014

This function makes a vehicle's doors undamageable, so they won't fall off when they're hit. Note that the vehicle has to be locked using setVehicleLocked for this setting to have any effect.

Syntax

bool setVehicleDoorsUndamageable ( vehicle theVehicle, bool state )

OOP Syntax Help! I don't understand this!

Method: vehicle:setDoorsUndamageable(...)
Variable: .doorsUndamageable


Required Arguments

  • theVehicle: The vehicle of which you wish to set the car door damageability.
  • state: A boolean denoting whether the vehicle's doors are undamageable (true) or damageable (false).

Returns

Returns true if the damageability state was successfully changed, false if invalid arguments were passed.

Example

Here you can disable all vehicles doors damage with /nodamage, and enable it with /adddamage.

function doorsLikeGod()
	for i, car in ipairs( getElementsByType ("vehicle") ) do
		setVehicleDoorsUndamageable ( car, true )
	end
	outputChatBox("All vehicles doors is not damageable")
end
addCommandHandler("nodamage", doorsLikeGod)

function doorsNotLikeGod()
	for i, car in ipairs( getElementsByType ("vehicle") ) do
		setVehicleDoorsUndamageable ( car, false )
	end
	outputChatBox("Now everyone can kick vehicles doors and throw them away.")
end
addCommandHandler("adddamage", doorsNotLikeGod)

See Also