OnPlayerDamage: Difference between revisions

From Onset Developer Wiki
No edit summary
No edit summary
Line 11: Line 11:


== Example ==
== Example ==
__EDIT_ME__
<syntaxhighlight lang="Lua">
function OnPlayerDamage(player, damagetype, amount)
local DamageName = {
"Weapon",
"Explosion",
"Fire",
"Fall",
"Vehicle Collision"
}
 
print(GetPlayerName(player).."("..player..") took "..amount.." damage of type "..DamageName[damagetype])
end
AddEvent("OnPlayerDamage", OnPlayerDamage)
</syntaxhighlight>


{{RelatedFunctions}}
{{RelatedFunctions}}
{{ServerEvents}}
{{ServerEvents}}

Revision as of 10:38, 23 March 2019

OnPlayerDamage

Type: Event
Context: Server
Introduced: v1.0

Description

__EDIT_ME__

Syntax

OnPlayerDamage(player, damagetype, amount)

Parameters

  • player
    The player who is being damaged.
  • damagetype
    Type of damage applied.
  • amount
    Amount of damage applied.

Example

function OnPlayerDamage(player, damagetype, amount)
	local DamageName = {
		"Weapon",
		"Explosion",
		"Fire",
		"Fall",
		"Vehicle Collision"
	}

	print(GetPlayerName(player).."("..player..") took "..amount.." damage of type "..DamageName[damagetype])
end
AddEvent("OnPlayerDamage", OnPlayerDamage)

See also

Player

Vehicle

Game

Package

NPC

Object

Pickup

Text3D

Door