IsVehicleDamageProof: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
mNo edit summary
Line 15: Line 15:


==Example==
==Example==
This example will output in the chatbox whether the vehicle is vulnerable to damage or not when a player enters in it.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
-- TODO
function checkVulnerability(theVehicle)
  if isVehicleDamageProof(theVehicle) == true then
            outputChatBox("This vehicle is not vulnerable to damage", source)
  else
            outputChatBox("This vehicle is vulnerable to damage", source)
  end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkVulnerability )
 
</syntaxhighlight>
</syntaxhighlight>



Revision as of 18:03, 24 December 2011

This function checks if a vehicle is damage proof (set with setVehicleDamageProof).

Syntax

bool isVehicleDamageProof ( vehicle theVehicle )

Required Arguments

  • theVehicle: the vehicle whose invincibility status we want to check.

Returns

Returns true if the vehicle is damage proof, false if it isn't or if invalid arguments were passed.

Example

This example will output in the chatbox whether the vehicle is vulnerable to damage or not when a player enters in it.

function checkVulnerability(theVehicle)
   if isVehicleDamageProof(theVehicle) == true then
            outputChatBox("This vehicle is not vulnerable to damage", source)
   else
            outputChatBox("This vehicle is vulnerable to damage", source)
   end
end
addEventHandler ( "onPlayerVehicleEnter", getRootElement(), checkVulnerability )
  

See Also