This is a simple script that lets you create bindings for keys, as well as mouse and controller buttons.
It only works clientside, since on serverside you can use the numpad library.
Use it for whatever you want, and have fun!
bind.Add( KEY_R, "<UNIQUE_NAME>", function()
notification.AddLegacy( "This script works!", NOTIFY_GENERIC, 2 )
end )
bind.Add( MOUSE_LEFT, "<UNIQUE_NAME>", function()
notification.AddLegacy( "Left clicked!", NOTIFY_GENERIC, 2 )
end )
bind.Remove( KEY_R, "<UNIQUE_NAME>" )
PrintTable( bind.GetTable() )
For people who only want to bind a single key.
local FirstPressed = false
hook.Add( "Think", "CallBinding", function()
local cache = input.IsButtonDown( <BUTTON> )
if cache and FirstPressed then
<CODE>
end
FirstPressed = not cache
end )