Squirrel/Server/Events/Player/onPlayerAction
From Liberty Unleashed Wiki
(Difference between revisions)
m (argument types) |
|||
Line 21: | Line 21: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function onPlayerAction( | + | function onPlayerAction( player, text ) |
{ | { | ||
if ( text == "died" ) | if ( text == "died" ) |
Latest revision as of 16:43, 10 July 2013
This is called when a player sends a /me action to the chat. This event is still called if the player is muted.
[edit] Syntax
function onPlayerAction( Player player, string message )
[edit] Arguments
- player - The player pointer
- message - The "action" that the player did with /me
[edit] Returns
- 1 - Send the action message to other clients, unless they're muted
- 0 - Returning 0 will cancel this message and mute the player
[edit] Example
This example will kill the player if/when they type /me died.
function onPlayerAction( player, text ) { if ( text == "died" ) { // Kill the player >:D player.Health = 0; MessagePlayer( "You asked for it", player ); } return 1; }
[edit] Notes
The functions MessagePlayer and Player.Health were used in this example. More info about them can be found in the corresponding pages.
[edit] Related Events
- onPlayerAction
- onPlayerArmourChange
- onPlayerCashChange
- onPlayerChat
- onPlayerCommand
- onPlayerConnect
- onPlayerDeath
- onPlayerFall
- onPlayerHealthChange
- onPlayerIslandChange
- onPlayerJoin
- onPlayerKeyStateChange
- onPlayerKill
- onPlayerPart
- onPlayerScoreChange
- onPlayerSkinChange
- onPlayerSpawn
- onPlayerUpdate
- onPlayerTeamChange
- onPlayerUseDetonator
- onPlayerVirtualWorldChange
- onPlayerWeaponChange