Difference between revisions of "ClearChatBox"

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Server client function}} This function clearing chatbox, not console under F8. ==Syntax== <section name="Client" class="client" show="true"> <syntaxhighlight la...")
 
 
(6 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
__NOTOC__  
 
__NOTOC__  
 
{{Server client function}}  
 
{{Server client function}}  
This function clearing chatbox, not console under F8.
+
{{New feature/item|3.0156|1.5.5|14165|This function clears the chatbox. It does not clear the console (F8)}}
  
 
==Syntax==
 
==Syntax==
Line 17: Line 17:
  
 
===Required Arguments===  
 
===Required Arguments===  
*'''clearFor :''' The [[player]] whose chat is to be cleared. By default clear for all.
+
*'''clearFor :''' The [[player]] whose chat is to be cleared. By default, this is set to the root element, which will affect all players.
  
 
===Returns===
 
===Returns===
Line 25: Line 25:
 
==Example==  
 
==Example==  
 
<section name="Client" class="client" show="true">
 
<section name="Client" class="client" show="true">
This example removing spam couse by outputChatBox
+
This example removes spam caused by outputChatBox
 
<syntaxhighlight lang="lua">
 
<syntaxhighlight lang="lua">
 
 
for i=1,10 do
 
for i=1,10 do
 
   outputChatBox( "spam ..." )
 
   outputChatBox( "spam ..." )
Line 34: Line 33:
 
clearChatBox()
 
clearChatBox()
 
outputChatBox("Chat cleared successfully!")
 
outputChatBox("Chat cleared successfully!")
 +
</syntaxhighlight>
 +
</section>
 +
 +
<section name="Server" class="server" show="false">
 +
This example deletes messages for reandom player
 +
<syntaxhighlight lang="lua">
 +
local RandomPlayer = getRandomPlayer ( )
 +
clearChatBox(RandomPlayer)
 
</syntaxhighlight>
 
</syntaxhighlight>
 
</section>
 
</section>

Latest revision as of 13:19, 27 April 2020

This function clears the chatbox. It does not clear the console (F8)

Syntax

Click to collapse [-]
Client
bool clearChatBox ()

Returns

Returns true if the player's chat was cleared successfully, false otherwise.

Click to collapse [-]
Server
bool clearChatBox ( [ element clearFor = getRootElement() ])

Required Arguments

  • clearFor : The player whose chat is to be cleared. By default, this is set to the root element, which will affect all players.

Returns

Returns true if the player's chat was cleared successfully, false otherwise.

Example

Click to collapse [-]
Client

This example removes spam caused by outputChatBox

for i=1,10 do
  outputChatBox( "spam ..." )
end

clearChatBox()
outputChatBox("Chat cleared successfully!")
Click to expand [+]
Server

See Also

BETA: FROM VERSION 1.5.8 r20788 ONWARDS
BETA: FROM VERSION 1.5.8 r20788 ONWARDS