Squirrel/Server/Functions/Messages/ClearMessages
From Liberty Unleashed Wiki
(Difference between revisions)
(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 == |
− | |||
<code lang="squirrel"> | <code lang="squirrel"> | ||
− | + | 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 === | ||
− | + | 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:
bool ClearMessages()
bool ClearMessages( Player plr )
Arguments
- plr - The pointer to the player whose messages should be cleared
Example 1
function onPlayerCommand( player, cmd, text ) { if ( cmd == "clearmsg" ) { ClearMessages( ); } }
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.