Squirrel/Server/Functions/Messages/MessagePlayer
From Liberty Unleashed Wiki
(Difference between revisions)
m |
|||
Line 6: | Line 6: | ||
''MessagePlayer'' can take 2 differant parameter lists. These are: | ''MessagePlayer'' can take 2 differant parameter lists. These are: | ||
− | <code>bool MessagePlayer( string text, | + | <code>bool MessagePlayer( string text, player plr, int r, int g, int b )</code> |
− | <code>bool Message( string text, Colour col )</code> | + | <code>bool Message( 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 pointer 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 | ||
Line 23: | Line 23: | ||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | function OnPlayerCommand( | + | function OnPlayerCommand( player, cmd, text ) |
{ | { | ||
if ( cmd == "testpm" ) | if ( cmd == "testpm" ) | ||
{ | { | ||
− | MessagePlayer( "Testing PM...", | + | MessagePlayer( "Testing PM...", player, 255, 0, 0 ); |
} | } | ||
} | } |
Revision as of 20:31, 31 March 2009
This function sends a personal message to a player in the game. It can be customized to your own colour if needed.
Syntax
MessagePlayer can take 2 differant parameter lists. These are:
bool MessagePlayer( string text, player plr, int r, int g, int b )
bool Message( string text, player plr, Colour col )
Arguments
- text - This is the message to send to the player
- plr - This is the pointer 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 - A colour class. Good for defining your own colours at script start
Example
This will send a personal message saying 'Testing PM...' when a player types '/testpm'
function OnPlayerCommand( player, cmd, text ) { if ( cmd == "testpm" ) { MessagePlayer( "Testing PM...", player, 255, 0, 0 ); } }
Notes
The call OnPlayerCommand was used in in this example. More info about this in the corresponding page.