diff --git a/docs/ox_lib/AddKeybind/Client.md b/docs/ox_lib/AddKeybind/Client.md new file mode 100644 index 0000000000..446030b6ed --- /dev/null +++ b/docs/ox_lib/AddKeybind/Client.md @@ -0,0 +1,33 @@ +```lua +lib.addKeybind(data) +``` +* data: `table` + * name: `string` + * description: `string` + * defaultKey?: `string` + * Default: None + * keybind: `string` + * disabled?: `boolean` + * disable?: `function`(self: `table`, toggle: `boolean`) + * onPressed?: `function`(self: `table`) + * onReleased?: `function`(self: `table`) + +```lua +local keybind = lib.addKeybind({ + name = 'respects', + description = 'press F to pay respects', + defaultKey = 'F', + onPressed = function(self) + print(('pressed %s (%s)'):format(self.keybind, self.name)) + end, + onReleased = function(self) + print(('released %s (%s)'):format(self.keybind, self.name)) + end, +}) +``` + +Keybinds can be enabled/disabled by using the disable method. +```lua +keybind:disable(true) -- disable +keybind:disable(false) -- enable +``` \ No newline at end of file