numpad.Register

From Garry's Mod
Revision as of 18:08, 26 February 2013 by Garry Newman (Talk | contribs)
Jump to: navigation, search
 numpad.Register( )

Contents

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.

Examples

Example

Demonstrates the use of this function.

numpad.Register("my_action", function(ply, arg1) print(ply, arg1) end
ents.FindByClass( "prop_physics" )[1].myAct = numpad.OnDown(player.GetByID(1), 38, "my_action", "arg1")

Output:

When player 1 presses his Numpad 1 key, something like this will be printed in console: "Player [1][Robot] arg1"
Personal tools
Navigation