ShowChat: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
mNo edit summary |
||
Line 6: | Line 6: | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<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. | |||
</section> | </section> | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool showChat(player thePlayer, bool show) | bool showChat ( player thePlayer, bool show ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*''' | *'''thePlayer:''' The [[player]] whose chat is to be hidden or shown. | ||
*'''show:''' A boolean value determining whether to show (''true'') or hide (''false'') the chat. | *'''show:''' A boolean value determining whether to show (''true'') or hide (''false'') the chat. | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the player's chat was shown or hidden successfully, ''false'' otherwise. | Returns ''true'' if the player's chat was shown or hidden successfully, ''false'' otherwise. | ||
</section> | |||
==Example== | ==Example== | ||
Line 26: | Line 32: | ||
This example toggle's the player's chat when they press the "'''i'''" key. | This example toggle's the player's chat when they press the "'''i'''" key. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
local isChatVisible = true | local isChatVisible = true -- let's assume the chat is visible | ||
function chat(key, keyState) | 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 | end | ||
bindKey ("i", "down | bindKey ( "i", "down", chat ) -- the player's "i" key will toggle the chat | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | </section> |
Revision as of 16:11, 4 April 2009
This function is used to show or hide the player's chat.
Syntax
Click to collapse [-]
Clientbool 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.
Click to collapse [-]
Serverbool showChat ( player thePlayer, bool show )
Required Arguments
- thePlayer: The player whose chat is to be hidden or shown.
- 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
Click to collapse [-]
ClientThis 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", chat ) -- the player's "i" key will toggle the chat
See Also
- getMaxPlayers
- getServerConfigSetting
- getServerHttpPort
- getServerName
- getServerPassword
- getServerPort
- isGlitchEnabled
- setGlitchEnabled
- setMaxPlayers
- setServerConfigSetting
- setServerPassword
- shutdown