IsPlayerHitByVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
 
(7 intermediate revisions by the same user not shown)
Line 9: Line 9:
* '''attacker''' : The element that attacks .
* '''attacker''' : The element that attacks .


==Code==
==Function Source==
<section name="Function source" class="both" show="true">
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function isPlayerHitByVehicle (attacker)
function isPlayerHitByVehicle (attacker)
Line 20: Line 21:
end
end
</syntaxhighlight>
</syntaxhighlight>
 
</section>
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
==Client==
function isPlayerHitByVehicle (attacker)
if not attacker then
return
end
if getElementType(attacker) == 'vehicle' then
cancelEvent()
end
end
addEventHandler("onClientPlayerDamage", getLocalPlayer(), isPlayerHitByVehicle)
 
==Server==
 
function isPlayerHitByVehicle (attacker)
if not attacker then
return
end
if getElementType(attacker) == 'vehicle' then
cancelEvent()
end
end
addEventHandler("onPlayerDamage", root, isPlayerHitByVehicle)


== Author ==
== Author ==


Lisek
Lisek
In Discord Lisek#5811

Latest revision as of 08:21, 10 June 2020

isPlayerHitByVehicle

Syntax

bool isPlayerHitByVehicle(attacker)

Required Arguments

  • attacker : The element that attacks .

Function Source

Click to collapse [-]
Function source
function isPlayerHitByVehicle (attacker)
	if not attacker then
		return
	end
	if getElementType(attacker) == 'vehicle' then
		cancelEvent()
	end
end

Author

Lisek In Discord Lisek#5811