Squirrel/Server/Events/Player/onPlayerDeath

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (Forgot return values >:/)
 
Line 10: Line 10:
 
* '''player''' - The player pointer
 
* '''player''' - The player pointer
 
* '''reason''' - The weapon/reason which caused the player to die - check list [[Squirrel/Server/Constants#Weapons.2FDeath_Reasons|here]]
 
* '''reason''' - The weapon/reason which caused the player to die - check list [[Squirrel/Server/Constants#Weapons.2FDeath_Reasons|here]]
 +
 +
=== Returns ===
 +
 +
This event does not handle return values.
  
 
== Example ==
 
== Example ==

Latest revision as of 19:03, 22 December 2010

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

This is called when a player dies, for any reason.

[edit] Syntax

  1. function onPlayerDeath( Player player, int reason )

[edit] Arguments

  • player - The player pointer
  • reason - The weapon/reason which caused the player to die - check list here

[edit] Returns

This event does not handle return values.

[edit] Example

This will send a message to the main chat if a player drowns.

  1.  
  2. function onPlayerDeath( player, reason )
  3. {
  4. if ( reason == WEP_DROWNED ) Message( "* " + player.Name + " is sleeping with the fishes." );
  5. return 1;
  6. }
  7.  

[edit] Notes

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

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox