Squirrel/Server/Functions/Messages/MessagePlayer

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m (Updated the page)
Line 4: Line 4:
 
== Syntax ==
 
== Syntax ==
  
''MessagePlayer'' can take 2 differant parameter lists. These are:
+
<code>bool MessagePlayer( string text, Player plr, int r, int g, int b )</code>
 
+
<code>bool MessagePlayer( string text, Player plr, Colour col )</code>
<code>bool MessagePlayer( string text, player plr, int r, int g, int b )</code>
+
<code>bool MessagePlayer( string text, player plr, Colour col )</code>
+
  
 
== Arguments ==
 
== Arguments ==
Line 13: Line 11:
 
* '''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
 
* '''plr''' - This is the pointer of the player
* '''r''' - The ammount of Red to be in the colour
+
* '''r''' - The amount of Red to be in the colour
* '''g''' - The ammount of Green to be in the colour
+
* '''g''' - The amount of Green to be in the colour
* '''b''' - The ammount of Blue to be in the colour
+
* '''b''' - The amount of Blue to be in the colour
* '''col''' - A colour class. Good for defining your own colours at script start
+
* '''col''' - A colour object. Good for defining your own colours at script start
  
 
== Example ==
 
== Example ==
Line 23: Line 21:
  
 
<code lang="squirrel">
 
<code lang="squirrel">
function OnPlayerCommand( player, cmd, text )
+
function onPlayerCommand( player, cmd, text )
 
{
 
{
 
     if ( cmd == "testpm" )
 
     if ( cmd == "testpm" )
Line 34: Line 32:
 
=== Notes ===
 
=== Notes ===
  
The call [[Squirrel/Events/Player/OnPlayerCommand|OnPlayerCommand]] was used in in this example. More info about this in the corresponding page.
+
The call [[Squirrel/Server/Events/Player/onPlayerCommand|onPlayerCommand]] was used in in this example. More info about this in the corresponding page.
  
 
== Related Functions ==
 
== Related Functions ==
  
{{Squirrel/Functions/Misc}}
+
{{Squirrel/Server/Functions/Messages}}

Revision as of 11:33, 9 September 2009

This function sends a personal message to a player in the game. It can be customized to your own colour if needed.

Syntax

  1. bool MessagePlayer( string text, Player plr, int r, int g, int b )
  1. bool MessagePlayer( 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 amount of Red to be in the colour
  • g - The amount of Green to be in the colour
  • b - The amount of Blue to be in the colour
  • col - A colour object. Good for defining your own colours at script start

Example

This will send a personal message saying 'Testing PM...' when a player types '/testpm'

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "testpm" )
  5. {
  6. MessagePlayer( "Testing PM...", player, 255, 0, 0 );
  7. }
  8. }
  9.  

Notes

The call onPlayerCommand was used in in this example. More info about this in the corresponding page.

Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox