showCursor
This function is used to show or hide a player's cursor.
Regardless of the cursor state you set using this function, the cursor will always be visible while the menu, the chatbox input line or the console are active, or if another resource has called this function.
Be aware of that if showCursor is enabled by a resource, you can't disabled it from a different ressource! showCursor(false)
will not work, in order to make it work, disable it from the original resource that enabled it or use an export.
Client Syntax
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
- toggleControls (default: true): A boolean value determining whether to disable controls whilst the cursor is showing. true implies controls are disabled, false implies controls remain enabled.
Returns
- bool: result
Returns true if the player's cursor was shown or hidden successfully, false otherwise.
Server 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
- toggleControls (default: true): A boolean value determining whether to disable controls whilst the cursor is showing. true implies controls are disabled, false implies controls remain enabled.
Returns
- bool: result
Returns true if the player's cursor was shown or hidden successfully, false otherwise.
Code Examples
This example shows/hides the cursor:
showCursor ( true ) -- shows cursorshowCursor ( false ) -- hides cursor
This example shows the cursor for a player named "Dave", then outputs a message if it was shown successfully.
local thePlayer = getPlayerFromName ( "Dave" ) -- get the player named Daveif 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 endend