numpad/Register

From Garry's Mod
(Difference between revisions)
Jump to: navigation, search
(Added arguments for the func.)
 
(2 intermediate revisions by one user not shown)
Line 1: Line 1:
 
{{Func
 
{{Func
|Name=Register
 
|Parent=numpad
 
 
|Description=Registers a numpad library action for use with {{LibraryFunction|numpad|OnDown}} and {{LibraryFunction|numpad|OnUp}}
 
|Description=Registers a numpad library action for use with {{LibraryFunction|numpad|OnDown}} and {{LibraryFunction|numpad|OnUp}}
 
|Realm=Server
 
|Realm=Server
 
|IsClass=No
 
|IsClass=No
 +
|Name=Register
 +
|Parent=numpad
 
}}
 
}}
 
{{Arg
 
{{Arg
Line 16: Line 16:
 
|desc=The function to be executed.
 
|desc=The function to be executed.
  
func's arguments are:
+
Arguments are:<br>
Player,
+
{{FuncArg|Player|ply|The player who pressed the button}}<br>
Ent,
+
{{FuncArg|vararg|...|The 4th and all subsequent arguments passed from {{LibraryFunction|numpad|OnDown}} and/or {{LibraryFunction|numpad|OnUp}}}}<br>
OnOff
+
<br>
 +
 
 +
Returning <b>false</b> in this function will remove the listener which triggered this function (example: return false if one of your varargs is an entity which is no longer valid)
 
}}
 
}}

Latest revision as of 06:45, 17 July 2016

 numpad.Register( )

Description

Registers a numpad library action for use with numpad.OnDown and numpad.OnUp

Arguments

string id

The unique id of your action.

Arguments

function func

The function to be executed.

Arguments are:
Player ply - The player who pressed the button
vararg ... - The 4th and all subsequent arguments passed from numpad.OnDown and/or numpad.OnUp

Returning false in this function will remove the listener which triggered this function (example: return false if one of your varargs is an entity which is no longer valid)
Personal tools
Navigation