Squirrel/Client/Events/GUI/onClientClickCheckbox

From Liberty Unleashed Wiki
(Difference between revisions)
Jump to: navigation, search
(Created page with '{{Squirrel/Title|onClientClickCheckbox}} {{ScriptingChangesIn0.1.0.9}} This event is called when the local player clicks a checkbox. == Syntax == <code>function onClientClickCh…')
 
(Added examples)
 
Line 19: Line 19:
 
== Example ==
 
== Example ==
  
Some explanation here
+
This code will tell a player they pressed a checkbox.
{{Squirrel/NeedsExample}}
+
  
 
<code lang="squirrel">
 
<code lang="squirrel">
-- todo
+
function onClientClickCheckbox( checkID, down )
 +
{
 +
    Message("You just clicked on a checkbox.");
 +
    return 1;
 +
}
 +
</code>
 +
 
 +
This code will stop a player from enabling (or disabling) a checkbox.
 +
 
 +
<code lang="squirrel">
 +
function onClientClickCheckbox( checkID, down )
 +
{
 +
    Message("I'm afraid I can't let you do that.");
 +
    return 0;
 +
}
 
</code>
 
</code>
  
 
=== Notes ===
 
=== Notes ===
  
-- List of used functions and other notes here.
+
The function [[Squirrel/Client/Functions/Messages/Message|Message]] was used in both examples and has more information on the corresponding page.
  
 
== Related Events ==
 
== Related Events ==
  
 
{{Squirrel/Client/Events/GUI}}
 
{{Squirrel/Client/Events/GUI}}

Latest revision as of 02:50, 2 August 2011

Home   |   Squirrel Scripting   |   Server Functions   |   Server Events   |   Client Functions   |   Client Events

This event is called when the local player clicks a checkbox.

[edit] Syntax

  1. function onClientClickCheckbox( int checkID, bool down )

[edit] Arguments

  • checkID - The ID of the checkbox in question
  • down - Was the mouse button pressed down or released

[edit] Returns

  • 1 - Let the checkbox be checked/unchecked normally
  • 0 - Returning 0 locks the status of the checkbox (if the mouse button is released)

[edit] Example

This code will tell a player they pressed a checkbox.

  1.  
  2. function onClientClickCheckbox( checkID, down )
  3. {
  4. Message("You just clicked on a checkbox.");
  5. return 1;
  6. }
  7.  

This code will stop a player from enabling (or disabling) a checkbox.

  1.  
  2. function onClientClickCheckbox( checkID, down )
  3. {
  4. Message("I'm afraid I can't let you do that.");
  5. return 0;
  6. }
  7.  

[edit] Notes

The function Message was used in both examples and has more information on the corresponding page.

[edit] Related Events

Personal tools
Namespaces

Variants
Actions
Navigation
scripting
Toolbox