Squirrel/Client/Events/Player/onClientDeath

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|onClientDeath}} This event is called when the local player dies == Syntax == <code>function onClientDeath( killer, weapon, bodypart)</code> === Arguments === …')
 
(Example)
 
Line 18: Line 18:
 
== Example ==
 
== Example ==
  
Some explanation here
+
This will show a message saying who killed the player.
{{Squirrel/NeedsExample}}
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onClientDeath( killer, weapon, bodypart)
 +
{
 +
local pPlayer = FindLocalPlayer();
 +
if ( pPlayer && killer )
 +
{
 +
Message("HA! You got killed by " + killer.Name);
 +
}
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The functions [[Squirrel/Client/Functions/Players/FindLocalPlayer|FindLocalPlayer]] and [[Squirrel/Client/Functions/Messages/Message|Message]] were used in in this example. More info about them in corresponding pages.
  
 
== Related Events ==
 
== Related Events ==
  
 
{{Squirrel/Client/Events/Player}}
 
{{Squirrel/Client/Events/Player}}

Latest revision as of 20:54, 11 November 2013

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

This event is called when the local player dies

[edit] Syntax

  1. function onClientDeath( killer, weapon, bodypart)

[edit] Arguments

  • killer - The pointer to the player who killed the local player
  • weapon - The weapon used
  • bodypart - The bodypart hit

[edit] Returns

This event does not handle return values.

[edit] Example

This will show a message saying who killed the player.

  1.  
  2. function onClientDeath( killer, weapon, bodypart)
  3. {
  4. local pPlayer = FindLocalPlayer();
  5. if ( pPlayer && killer )
  6. {
  7. Message("HA! You got killed by " + killer.Name);
  8. }
  9. }
  10.  

[edit] Notes

The functions FindLocalPlayer and Message were used in in this example. More info about them in corresponding pages.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox