Squirrel/Server/Events/Player/onPlayerKill
From Liberty Unleashed Wiki
(Difference between revisions)
Line 1: | Line 1: | ||
+ | {{Squirrel/Title|onPlayerKill}} | ||
+ | This event is called when a player kills another player. | ||
+ | |||
== Syntax == | == Syntax == | ||
− | <code>function onPlayerKill( pPlayer, pKiller, iWeapon, iBodyPart )</code> | + | <code>function onPlayerKill( Player pPlayer, Player pKiller, int iWeapon, int iBodyPart )</code> |
− | == | + | === Arguments === |
− | * '''pPlayer''' - The | + | * '''pPlayer''' - The pointer of the player who killed |
− | * '''pKiller''' - The | + | * '''pKiller''' - The pointer of the player who was killed |
− | * '''iWeapon''' - The ID of the weapon used to kill the player | + | * '''iWeapon''' - The ID of the weapon used to kill the player - check list [[Squirrel/Server/Constants#Weapons.2FDeath_Reasons|here]] |
− | * '''iBodyPart''' - The part of the body which was hit | + | * '''iBodyPart''' - The part of the body which was hit - check list [[Squirrel/Server/Constants#Body_Parts|here]] |
+ | |||
+ | === Returns === | ||
+ | |||
+ | This event does not handle return values. | ||
== Example == | == Example == | ||
− | This will message the | + | This will message the chatbox when a player kills another player. |
<code lang="squirrel"> | <code lang="squirrel"> | ||
function onPlayerKill( killer, player, reason, bodypart ) | function onPlayerKill( killer, player, reason, bodypart ) | ||
{ | { | ||
− | Message( " | + | Message( "* " + killer.Name + " killed " + player.Name " (" + GetWeaponName( reason ) + ")" ); |
} | } | ||
</code> | </code> | ||
Line 23: | Line 30: | ||
=== Notes === | === Notes === | ||
− | The functions [[Squirrel/Server/Functions/Messages/Message|Message]], [[Squirrel/Server/Functions/Players/Name| | + | The functions [[Squirrel/Server/Functions/Messages/Message|Message]], [[Squirrel/Server/Functions/Players/Name|Player.Name]] and [[Squirrel/Server/Functions/Weapons/GetWeaponName|GetWeaponName]] were used in this example. More info about them can be found in the corresponding pages. |
− | + | ||
== Related Functions == | == Related Functions == | ||
{{Squirrel/Server/Events/Player}} | {{Squirrel/Server/Events/Player}} |
Revision as of 19:35, 22 December 2010
This event is called when a player kills another player.
Syntax
function onPlayerKill( Player pPlayer, Player pKiller, int iWeapon, int iBodyPart )
Arguments
- pPlayer - The pointer of the player who killed
- pKiller - The pointer of the player who was killed
- iWeapon - The ID of the weapon used to kill the player - check list here
- iBodyPart - The part of the body which was hit - check list here
Returns
This event does not handle return values.
Example
This will message the chatbox when a player kills another player.
function onPlayerKill( killer, player, reason, bodypart ) { Message( "* " + killer.Name + " killed " + player.Name " (" + GetWeaponName( reason ) + ")" ); }
Notes
The functions Message, Player.Name and GetWeaponName were used in this example. More info about them can be found in the corresponding pages.
Related Functions
- onPlayerAction
- onPlayerArmourChange
- onPlayerCashChange
- onPlayerChat
- onPlayerCommand
- onPlayerConnect
- onPlayerDeath
- onPlayerFall
- onPlayerHealthChange
- onPlayerIslandChange
- onPlayerJoin
- onPlayerKeyStateChange
- onPlayerKill
- onPlayerPart
- onPlayerScoreChange
- onPlayerSkinChange
- onPlayerSpawn
- onPlayerUpdate
- onPlayerTeamChange
- onPlayerUseDetonator
- onPlayerVirtualWorldChange
- onPlayerWeaponChange