Squirrel/Server/Functions/Messages/Message

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
m
m (facking old examples)
 
Line 33: Line 33:
 
           Message( "Blue!", Col_Blue );
 
           Message( "Blue!", Col_Blue );
 
     }
 
     }
 +
   
 +
    return 1;
 
}
 
}
 
</code>
 
</code>

Latest revision as of 01:59, 16 October 2010

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This function sends a chatbox message to all the players in the game. It can be customised to your own colour if needed. Defaults to Green.

[edit] Syntax

Message can take different lists of parameters. These are:

  1. bool Message( string text, [ int r, int g, int b ] )
  1. bool Message( string text, [ Colour col ] )

[edit] Arguments

  • text - This is the message to send to players
  • r - The amount of Red to be in the colour. This argument is optional
  • g - The amount of Green to be in the colour. This argument is optional
  • b - The amount of Blue to be in the colour. This argument is optional
  • col - A colour object. Good for defining your own colours at script start. This argument is optional

[edit] Example

This will send a message saying 'Testing... Red! Green! Blue!' when somebody types '/test'

  1.  
  2. Col_Blue <- Colour( 0, 0, 255 );
  3.  
  4. function onPlayerCommand( plr, cmd, text )
  5. {
  6. if ( cmd == "test" )
  7. {
  8. Message( "Testing..." );
  9. Message( "Red!", 255, 0, 0 );
  10. Message( "Green!", 0, 255, 0 );
  11. Message( "Blue!", Col_Blue );
  12. }
  13. return 1;
  14. }
  15.  

[edit] Notes

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

[edit] Related Functions

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox