Squirrel/Server/Functions/Messages/ClearMessages

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(New page: __NOTOC__ This function clears all the GTA messages currently on screen. This can be used for one player or for all players. == Syntax == ''ClearMessages'' can take 2 different lists of ...)
 
Line 13: Line 13:
 
* '''plr''' - The pointer to the player whose messages should be cleared
 
* '''plr''' - The pointer to the player whose messages should be cleared
  
== Example ==
+
== Example 1 ==
  
{{Squirrel/NeedsExample}}
 
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "clearmsg" )
 +
{
 +
ClearMessages( );
 +
}
 +
}
 
</code>
 
</code>
 +
 +
This command will clear all GTA messages for all players.
 +
 +
== Example 2 ==
 +
 +
function onPlayerCommand( player, cmd, text )
 +
{
 +
if ( cmd == "clearmsg" )
 +
{
 +
ClearMessages( player );
 +
}
 +
}
 +
</code>
 +
 +
This command will clear all GTA messages 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 01:47, 8 March 2010

This function clears all the GTA messages currently on screen. This can be used for one player or for all players.

Syntax

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

  1. bool ClearMessages()
  1. bool ClearMessages( Player plr )

Arguments

  • plr - The pointer to the player whose messages should be cleared

Example 1

  1.  
  2. function onPlayerCommand( player, cmd, text )
  3. {
  4. if ( cmd == "clearmsg" )
  5. {
  6. ClearMessages( );
  7. }
  8. }
  9.  

This command will clear all GTA messages for all players.

Example 2

function onPlayerCommand( player, cmd, text ) { if ( cmd == "clearmsg" ) { ClearMessages( player ); } } </code>

This command will clear all GTA messages 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