Squirrel/Server/Functions/Messages/MessageAllExcept
From Liberty Unleashed Wiki
(Difference between revisions)
(New page: __NOTOC__ Sends a message to every player in the game except to specified ID. It can be customized to your own colour if needed. == Syntax == <code>bool MessageAllExcept( string text, in...) |
m |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
− | Sends a message to every player in the game except to specified | + | Sends a message to every player in the game except to specified player. It can be customized to your own colour if needed. |
== Syntax == | == Syntax == | ||
− | <code>bool MessageAllExcept( string text, | + | <code>bool MessageAllExcept( string text, player plr, int r, int g, int b )</code> |
+ | <code>bool MessageAllExcept( string text, player plr, Colour col )</code> | ||
== Arguments == | == Arguments == | ||
* '''text''' - This is the message to send to the player | * '''text''' - This is the message to send to the player | ||
− | * ''' | + | * '''plr''' - This is the ID of the player |
* '''r''' - The ammount of Red to be in the colour | * '''r''' - The ammount of Red to be in the colour | ||
* '''g''' - The ammount of Green to be in the colour | * '''g''' - The ammount of Green to be in the colour | ||
* '''b''' - The ammount of Blue to be in the colour | * '''b''' - The ammount of Blue to be in the colour | ||
+ | * '''col''' - The colour to use for the message | ||
== Example == | == Example == | ||
Line 19: | Line 21: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function OnPlayerCommand( | + | function OnPlayerCommand( player, cmd, text ) |
{ | { | ||
if ( cmd == "message" ) | if ( cmd == "message" ) | ||
{ | { | ||
− | MessageAllExcept( "Testing message functions...", | + | MessageAllExcept( "Testing message functions...", player, 255, 0, 0 ); |
} | } | ||
} | } |
Revision as of 20:33, 31 March 2009
Sends a message to every player in the game except to specified player. It can be customized to your own colour if needed.
Syntax
bool MessageAllExcept( string text, player plr, int r, int g, int b )
bool MessageAllExcept( string text, player plr, Colour col )
Arguments
- text - This is the message to send to the player
- plr - This is the ID of the player
- r - The ammount of Red to be in the colour
- g - The ammount of Green to be in the colour
- b - The ammount of Blue to be in the colour
- col - The colour to use for the message
Example
This will send a message saying 'Testing message functions...' to all players except the one who uses the command '/message'.
function OnPlayerCommand( player, cmd, text ) { if ( cmd == "message" ) { MessageAllExcept( "Testing message functions...", player, 255, 0, 0 ); } }
Notes
The call OnPlayerCommand was used in in this example. More info about this in the corresponding page.