Squirrel/Server/Events/Player/onPlayerKill

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (Example)
 
Line 24: Line 24:
 
function onPlayerKill( killer, player, reason, bodypart )
 
function onPlayerKill( killer, player, reason, bodypart )
 
{
 
{
     Message( "* " + killer.Name + " killed " + player.Name " (" + GetWeaponName( reason ) + ")" );
+
     Message( "* " + killer.Name + " killed " + player.Name + " (" + GetWeaponName( reason ) + ")" );
 
      
 
      
 
     return 1;
 
     return 1;

Latest revision as of 17:06, 12 February 2012

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This event is called when a player kills another player.

[edit] Syntax

  1. function onPlayerKill( Player pKiller, Player pPlayer, int iWeapon, int iBodyPart )

[edit] Arguments

  • pKiller - The pointer of the player who killed pPlayer
  • pPlayer - 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

[edit] Returns

This event does not handle return values.

[edit] Example

This will message the chatbox when a player kills another player.

  1.  
  2. function onPlayerKill( killer, player, reason, bodypart )
  3. {
  4. Message( "* " + killer.Name + " killed " + player.Name + " (" + GetWeaponName( reason ) + ")" );
  5. return 1;
  6. }
  7.  

[edit] Notes

The functions Message, Player.Name and GetWeaponName were used in this example. More info about them can be found in the corresponding pages.

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox