OnPlayerDamage: Difference between revisions
From Onset Developer Wiki
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
== Example == | == Example == | ||
<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
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
- OnPlayerServerAuth
- OnPlayerSteamAuth
- OnPlayerDownloadFile
- OnPlayerStreamIn
- OnPlayerStreamOut
- OnPlayerPickupHit
- OnPlayerJoin
- OnPlayerQuit
- OnPlayerSpawn
- OnPlayerDeath
- OnPlayerWeaponShot
- OnPlayerDamage
- OnPlayerChat
- OnPlayerChatCommand
- OnPlayerInteractDoor
- OnPlayerChangeDimension
Vehicle
- OnPlayerEnterVehicle
- OnPlayerLeaveVehicle
- OnPlayerStateChange
- OnVehicleRespawn
- OnVehicleStreamIn
- OnVehicleStreamOut
- OnVehicleDamage
- OnVehicleChangeDimension
- OnVehicleCreated
- OnVehicleDestroyed
Game
Package
NPC
- OnNPCReachTarget
- OnNPCDamage
- OnNPCSpawn
- OnNPCDeath
- OnNPCStreamIn
- OnNPCStreamOut
- OnNPCChangeDimension
- OnNPCCreated
- OnNPCDestroyed
Object
- OnObjectStopMoving
- OnObjectChangeDimension
- OnObjectCreated
- OnObjectDestroyed
- OnObjectStreamIn
- OnObjectStreamOut