chore: oxmysql and ox_lib clean-up (#134)

* oxmysql and some lib interface fixes

- Various fixes throughout oxmysql
- started ox_lib audit

* chore: More clean up

- Reword some confusing descriptions
- Add some descriptions
- Type fixes
- Spelling and grammar fixes
- Swapping in `-` where `*` used to be for 
bullet point consistency

ox_lib
- Interface, ACL through GetClosestVehicle audited

* chore: Finishing up ox_lib
This commit is contained in:
Jag authored and GitHub committed 2023-07-03 13:13:56 +10:00
1 parent 7495414c9c
commit 74227cc262
39 files changed
+533 -247

No files matched your search

+47 -14
View File
@@ -1,17 +1,48 @@
Registers keybinds and simplifies interactions of the keybinds.
### CKeybind
A table representing a keybind with the following properties.
- name: `string`
- description: `string`
- currentKey: `string`
- Key that the current user has this keybind set to
- disabled: `boolean`
- Whether or not the keybind is currently disabled
- hash: `number`
- Internal hash of the keybind that is used to reference it within the game itself
- defaultKey?: `string`
- Default key to set the keybind to for new players
- NOTE: Changing this will not change the key for existing players
- defaultMapper?: `string`
- See [Input Mapper Ids](https://docs.fivem.net/docs/game-references/input-mapper-parameter-ids/) for more information
- disable: `function(self: CKeybind, disable: boolean)`
- Built-in function to enable / disable a keybind
- onPressed?: `function(self: CKeybind)`
- User-defined function triggered on keybind press
- onReleased?: `function(self: CKeybind)`
- User-defined function triggered on keybind release
### lib.addKeybind
```lua
lib.addKeybind(data)
```
* data: `table`
* name: `string`
* description: `string`
* defaultKey?: `string`
* Default: None
* currentKey: `string`
* disabled?: `boolean`
* disable?: `function`(self: `table`, toggle: `boolean`)
* onPressed?: `function`(self: `table`)
* onReleased?: `function`(self: `table`)
- data: `table`
- name: `string`
- description: `string`
- defaultKey?: `string`
- Default: `None`
- defaultMapper?: `string`
- Default: `keyboard`
- disabled?: `boolean`
- Whether or not the keybind should be disabled by default
- onPressed?: `function(self: CKeybind)`
- Function triggered on keybind press
- onReleased?: `function(self: CKeybind)`
- Function triggered on keybind release
```lua
local keybind = lib.addKeybind({
@@ -23,13 +54,15 @@ local keybind = lib.addKeybind({
end,
onReleased = function(self)
print(('released %s (%s)'):format(self.currentKey, self.name))
end,
end
})
```
Keybinds can be enabled/disabled by using the disable method.
### Enable / Disable Keybinds
Keybinds can be enabled / disabled by using the disable method.
```lua
keybind:disable(true) -- disable
keybind:disable(false) -- enable
keybind:disable(true) -- disables the keybind
keybind:disable(false) -- enables the keybind
```