onClientHurt

From Liberty Unleashed Wiki
Revision as of 00:16, 27 September 2011 by Callum (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This event is called when the local player gets hurt.

Note: This does not fire when the player gets shot. Use onClientShot instead.

Syntax

  1. function onClientHurt( entity )

Arguments

  • entity - The pointer to the entity that hurt the player. Either vehicle or null

Returns

  • 1 - Let the player be hurt normally
  • 0 - Stops the player being hurt

Example

This example makes you invincible if you're called 'Bob' (does not apply to damage taken from other players).

  1.  
  2. function onClientHurt(entity)
  3. {
  4. // Get the local player
  5. local player = FindLocalPlayer();
  6. if(player)
  7. {
  8. // Check if they're called "Bob"
  9. local name = player.Name;
  10. if(name == "Bob")
  11. {
  12. // Cancel the damage
  13. return 0;
  14. }
  15. }
  16. }
  17.  

Notes

-- List of used functions and other notes here.

Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox