IsCursorShowing
Jump to navigation
Jump to search
This function is used to determine whether or not a player's cursor is showing.
Syntax
Click to collapse [-]
Serverbool isCursorShowing ( player thePlayer )
Required Arguments
- thePlayer: The player you want to get cursor state of.
Returns
Returns true if the player's cursor is showing, false if it isn't or if invalid parameters were passed.
Click to collapse [-]
Clientbool isCursorShowing ( )
Returns
Returns true if the player's cursor is showing, false if it isn't or if invalid parameters were passed.
Example
Click to collapse [-]
ExampleThis serverside function toggles a player's cursor state.
function toggleCursor ( thePlayer ) local currentState = isCursorShowing ( thePlayer ) -- get the current cursor state as a boolean local oppositeState = not currentState -- get the new state as its logical opposite showCursor ( thePlayer, oppositeState ) -- set it as the new cursor state end
Click to collapse [-]
Clientside ExampleWith little of tweaking this can also be used clientside
function toggleCursor () local currentState = isCursorShowing () -- get the current cursor state as a boolean local oppositeState = not currentState -- get the new state as its logical opposite showCursor ( oppositeState ) -- set it as the new cursor state end
And a more compact version
[lua] bindKey ("b", "down", -- binds B key to toggle cursor state function() showCursor( not isCursorShowing() ) end)
See Also