Squirrel/Server/Functions/Messages/SmallMessage

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function sends a small GTA style text to a player or all the players in the game. == Syntax == ''SmallMessage'' can take 2 different lists of parameters. These are: <code...)
 
Line 16: Line 16:
 
* '''plr''' - The pointer to the player who should get the message
 
* '''plr''' - The pointer to the player who should get the message
  
== Example ==
+
== Example 1 ==
  
 
{{Squirrel/NeedsExample}}
 
{{Squirrel/NeedsExample}}
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "smallmsg" )
 +
{
 +
if ( text ) SmallMessage( text, 5000, 1 );
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This command will show a small message, with type 0, lasting 5 seconds, showing the specified text, for all players.
 +
 +
== Example 2 ==
 +
 +
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "smallmsg" )
 +
{
 +
if ( text ) SmallMessage( player, text, 5000, 1 );
 +
}
 +
}
 +
</code>
 +
 +
This command will show a small message, with type 0, lasting 5 seconds, showing the specified text, for the command user.
  
 
=== Notes ===
 
=== Notes ===
  
-- Example notes here
+
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/Server/Functions/Messages}}
 
{{Squirrel/Server/Functions/Messages}}

Revision as of 02:16, 8 March 2010

This function sends a small GTA style text to a player or all the players in the game.

Syntax

SmallMessage can take 2 different lists of parameters. These are:

  1. bool SmallMessage( string text, int time, int type )
  1. bool SmallMessage( Player plr, string text, int time, int type )

Arguments

  • text - This is the message to send to players
  • time - This is how long the message will stay on screen
  • type - The type of the announcement message
  • plr - The pointer to the player who should get the message

Example 1

This function needs an example. You can help us complete the wiki by writing one, or maybe even more :o
  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "smallmsg" )
  5. {
  6. if ( text ) SmallMessage( text, 5000, 1 );
  7. }
  8. }
  9.  

This command will show a small message, with type 0, lasting 5 seconds, showing the specified text, for all players.

Example 2

function onPlayerCommand( player, cmd, text ) { if ( cmd == "smallmsg" ) { if ( text ) SmallMessage( player, text, 5000, 1 ); } } </code>

This command will show a small message, with type 0, lasting 5 seconds, showing the specified text, for the command user.

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