IsChatInputBlocked: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "{{Client function}} __NOTOC__ This function checks if the player's chat input is blocked. ==Syntax== <syntaxhighlight lang="lua"> bool isChatInputBlocked ( ) </syntaxhighlig...")
 
No edit summary
Line 1: Line 1:
{{Client function}}
{{Client function}}
__NOTOC__
__NOTOC__
This function checks if the player's chat input is blocked.
{{Added feature/item|3.0159|1.5.9|1.5.8|20898|This function checks if the player's chat input is blocked.}}


==Syntax==  
==Syntax==  
Line 12: Line 12:


==Example==
==Example==
This example adds a ''blockchat'' command that allows blocking and unblocking of the chat input.
This example shows how to block and unblock the chat input:
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
function toggleInputBlocked()
function toggleInputBlocked ()
     local visible = isChatVisible() -- check if the chat is visible
     local visible = isChatVisible () -- check if the chat is visible
     showChat(visible, not isChatInputBlocked()) -- toggle inputBlocked
     showChat (visible, not isChatInputBlocked ()) -- toggle inputBlocked
end
end


addCommandHandler("blockchat", toggleInputBlocked)
addCommandHandler("blockchat", toggleInputBlocked)
</syntaxhighlight>
</syntaxhighlight>
==Requirements==
{{Requirements|n/a|1.5.8-9.20898}}


==See Also==
==See Also==
{{Client_output_functions}}
{{Client_output_functions}}

Revision as of 21:53, 22 September 2021

20898

Syntax

bool isChatInputBlocked ( )

Returns

Returns true if the chat input is blocked, false otherwise.

Example

This example shows how to block and unblock the chat input:

function toggleInputBlocked ()
    local visible = isChatVisible () -- check if the chat is visible
    showChat (visible, not isChatInputBlocked ()) -- toggle inputBlocked
end

addCommandHandler("blockchat", toggleInputBlocked)

Requirements

Minimum server version n/a
Minimum client version 1.5.8-9.20898

Note: Using this feature requires the resource to have the above minimum version declared in the meta.xml <min_mta_version> section. e.g. <min_mta_version client="1.5.8-9.20898" />

See Also