ShowCursor: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
This function is used to show or hide a player's cursor | This function is used to show or hide a player's cursor. Note that, regardless of the cursor state you set using this function, the cursor will always be visible while the menu or chatbox are open. | ||
==Syntax== | ==Syntax== | ||
Line 8: | Line 8: | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''thePlayer''' The player you want to show or hide the cursor of. | *'''thePlayer:''' The [[player]] you want to show or hide the cursor of. | ||
*'''show''' A boolean value determining whether to show ( true ) or hide ( false ) the cursor. | *'''show:''' A boolean value determining whether to show (''true'') or hide (''false'') the cursor. | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the player's cursor was shown or hidden successfully, | Returns ''true'' if the player's cursor was shown or hidden successfully, ''false'' otherwise. | ||
==Example== | ==Example== | ||
This example shows the | This example shows the cursor for a player named "Dave", then outputs a message if it was shown successfully. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
thePlayer = getPlayerFromNick ( "Dave" ) -- | local thePlayer = getPlayerFromNick ( "Dave" ) -- get the player named Dave | ||
if ( thePlayer ) then -- if we got him | if ( thePlayer ) then -- if we got him | ||
showCursor ( thePlayer, true ) -- make his cursor show | showCursor ( thePlayer, true ) -- make his cursor show | ||
if | if isCursorShowing ( thePlayer ) then -- did it show? | ||
outputChatBox ( " | outputChatBox ( "Cursor is now showing for Dave." ) -- print a message to the chat box | ||
end | end | ||
end | end |
Revision as of 13:57, 29 July 2007
This function is used to show or hide a player's cursor. Note that, regardless of the cursor state you set using this function, the cursor will always be visible while the menu or chatbox are open.
Syntax
bool showCursor ( player thePlayer, bool show )
Required Arguments
- thePlayer: The player you want to show or hide the cursor of.
- show: A boolean value determining whether to show (true) or hide (false) the cursor.
Returns
Returns true if the player's cursor was shown or hidden successfully, false otherwise.
Example
This example shows the cursor for a player named "Dave", then outputs a message if it was shown successfully.
local thePlayer = getPlayerFromNick ( "Dave" ) -- get the player named Dave if ( thePlayer ) then -- if we got him showCursor ( thePlayer, true ) -- make his cursor show if isCursorShowing ( thePlayer ) then -- did it show? outputChatBox ( "Cursor is now showing for Dave." ) -- print a message to the chat box end end
See Also