ShowCursor: Difference between revisions
DJFrankie-X (talk | contribs) No edit summary |
No edit summary |
||
Line 8: | Line 8: | ||
<section name="Server" class="server" show="true"> | <section name="Server" class="server" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool showCursor ( player thePlayer, bool show ) | bool showCursor ( player thePlayer, bool show, [ bool toggleControls = true ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Line 14: | Line 14: | ||
*'''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. | ||
===Optional Arguments=== | |||
{{OptionalArg}} | |||
{{New feature|3|1.0| | |||
*'''toggleControls:''' A boolean value determining whether to disable controls whilst the cursor is showing. ''true'' implies controls are disabled, ''false'' implies controls remain enabled. | |||
}} | |||
</section> | </section> | ||
<section name="Client" class="client" show="true"> | <section name="Client" class="client" show="true"> | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool showCursor ( bool show ) | bool showCursor ( bool show, [ bool toggleControls = true ] ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''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. | ||
===Optional Arguments=== | |||
{{OptionalArg}} | |||
{{New feature|3|1.0| | |||
*'''toggleControls:''' A boolean value determining whether to disable controls whilst the cursor is showing. ''true'' implies controls are disabled, ''false'' implies controls remain enabled. | |||
}} | |||
</section> | </section> | ||
Revision as of 22:21, 9 February 2009
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, [ bool toggleControls = true ] )
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.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- toggleControls: A boolean value determining whether to disable controls whilst the cursor is showing. true implies controls are disabled, false implies controls remain enabled.
bool showCursor ( bool show, [ bool toggleControls = true ] )
Required Arguments
- show: A boolean value determining whether to show (true) or hide (false) the cursor.
Optional Arguments
NOTE: When using optional arguments, you might need to supply all arguments before the one you wish to use. For more information on optional arguments, see optional arguments.
- toggleControls: A boolean value determining whether to disable controls whilst the cursor is showing. true implies controls are disabled, false implies controls remain enabled.
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
This example shows the cursor all the time
showCursor ( true ) -- Shows cursor showCursor ( false ) -- Doesnt Show Cursor
See Also