ShowChat: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
__NOTOC__
This function is used to show or hide the local player's chat.
==Syntax==
==Syntax==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool showChat ( bool show )
bool showChat ( bool show )
</syntaxhighlight>
</syntaxhighlight>
===Required Arguments===
*'''show:''' A boolean value determining whether to show (''true'') or hide (''false'') the chat.
===Returns===
Returns ''true'' if the player's chat was shown or hidden successfully, ''false'' otherwise.
==Example==
This example toggle's the player's chat when they press the "'''i'''" key.
<syntaxhighlight lang="lua">
local isChatVisible = true -- let's assume the chat is visible
function chat ( key, keyState )
if ( isChatVisible ) then -- if it's on
showChat ( false ) -- turn it off
isChatVisible = false
else showChat ( true ) -- if it's off
isChatVisible = true -- turn it on
end
end
bindKey ( "i", "down", "toggle chat", chat ) -- the player's "i" key will toggle the chat
</syntaxhighlight>
==See Also==
{{Cursor_functions}}

Revision as of 16:32, 1 August 2007

This function is used to show or hide the local player's chat.

Syntax

bool showChat ( bool show )

Required Arguments

  • show: A boolean value determining whether to show (true) or hide (false) the chat.

Returns

Returns true if the player's chat was shown or hidden successfully, false otherwise.

Example

This example toggle's the player's chat when they press the "i" key.

local isChatVisible = true -- let's assume the chat is visible
function chat ( key, keyState )
	if ( isChatVisible ) then -- if it's on
		showChat ( false ) -- turn it off
		isChatVisible = false
	else showChat ( true ) -- if it's off
		isChatVisible = true -- turn it on
	end
end
bindKey ( "i", "down", "toggle chat", chat ) -- the player's "i" key will toggle the chat

See Also