SetVehicleDoorsUndamageable: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
(Added sections, minor changes, removed flawed example (correcting it would make it too long))
Line 1: Line 1:
__NOTOC__  
__NOTOC__  
{{Server client function}}
{{Server client function}}
This function is used to make a car's doors undamageable.
This function makes a vehicle's doors undamageable.


==Syntax==  
==Syntax==  
<section name="Server and Client" class="both" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool setVehicleDoorsUndamageable ( vehicle theVehicle, bool state )
bool setVehicleDoorsUndamageable ( vehicle theVehicle, bool state )
</syntaxhighlight>  
</syntaxhighlight>  


===Required Arguments===  
===Required Arguments===
*'''theVehicle:''' The vehicle of which you wish to set the car door damageability.
*'''theVehicle:''' The [[vehicle]] of which you wish to set the car door damageability.
*'''state:''' ''true'' is undamageable, ''false'' damageable.
*'''state:''' A boolean denoting whether the vehicle's doors are undamageable (''true'') or damageable (''false'') damageable.


===Returns===
===Returns===
Returns ''true'' if successful, ''false'' otherwise.
Returns ''true'' if the damageability state was successfully changed, ''false'' if invalid arguments were passed.
</section>


==Example==
==Example==
As long as a Cluckin' Bell cock is in a car, that car's doors are damage proof.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function onPlayerEnterVehicle ( theVehicle )
    if getPlayerSkin ( source ) == 167
          setVehicleDoorsUndamageable ( theVehicle, true )
    end
end
addEventHandler ( "onPlayerEnterVehicle", getRootElement ( ), onPlayerEnterVehicle )
function onPlayerExitVehicle ( theVehicle )
    if getPlayerSkin ( source ) == 167
          setVehicleDoorsUndamageable ( theVehicle, false )
    end
end
addEventHandler ( "onPlayerExitVehicle", getRootElement ( ), onPlayerExitVehicle )
</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:Needs example]]
[[Category:Incomplete]] -- leave this unless you complete the function

Revision as of 20:43, 26 August 2007

This function makes a vehicle's doors undamageable.

Syntax

Click to collapse [-]
Server and Client
bool setVehicleDoorsUndamageable ( vehicle theVehicle, bool state )

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

Returns

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

Example


See Also