IsCursorShowing: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
m (Added template, sections) |
||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
{{Server client function}} | |||
This function is used to determine whether or not a player's cursor is showing. | This function is used to determine whether or not a player's cursor is showing. | ||
Line 5: | Line 6: | ||
==Syntax== | ==Syntax== | ||
<section name="Server" class="server"> | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool isCursorShowing ( player thePlayer ) | bool isCursorShowing ( player thePlayer ) | ||
Line 14: | Line 16: | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the player's cursor is showing, ''false'' if it isn't or if invalid parameters were passed. | Returns ''true'' if the player's cursor is showing, ''false'' if it isn't or if invalid parameters were passed. | ||
</section> | |||
<section name="Client" class="client"> | |||
<syntaxhighlight lang="lua"> | |||
bool isCursorShowing ( ) | |||
</syntaxhighlight> | |||
===Returns=== | |||
Returns ''true'' if the player's cursor is showing, ''false'' if it isn't or if invalid parameters were passed. | |||
</section> | |||
==Example== | ==Example== | ||
This function toggles a player's cursor state. | <section name="Example" class="server" show="true"> | ||
This serverside function toggles a player's cursor state. | |||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
function toggleCursor ( thePlayer ) | function toggleCursor ( thePlayer ) | ||
Line 24: | Line 37: | ||
end | end | ||
</syntaxhighlight> | </syntaxhighlight> | ||
</section> | |||
==See Also== | ==See Also== | ||
{{Cursor_functions}} | {{Cursor_functions}} |
Revision as of 22:05, 12 August 2007
This function is used to determine whether or not a player's cursor is showing.
Note that this retrieves the cursor state that has been set using showCursor, and thus doesn't take into account the cursor shown while the chatbox, menu or console are open. Also, keep in mind that while the client is aware of cursor states set from the server, the server doesn't know about cursor states set from the client.
Syntax
Click to expand [+]
ServerClick to expand [+]
ClientExample
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
See Also