mirror of
https://github.com/darksaid98/overextended.github.io.git
synced 2026-12-02 14:38:50 +00:00
WIP ox_lib documentation
This commit is contained in:
1 parent
f9aa5347e3
commit
86fa21d64a
8 files changed
+75
-2
No files matched your search
File renamed without changes.
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
title: lib.disableControls
|
||||||
|
---
|
||||||
|
|
||||||
|
```lua
|
||||||
|
lib.disableControls:Add(...)
|
||||||
|
lib.disableControls:Remove(...)
|
||||||
|
lib.disableControls:Clear(...)
|
||||||
|
lib.disableControls()
|
||||||
|
```
|
||||||
|
|
||||||
|
```lua
|
||||||
|
lib.disableControls:Add(23, 25, 36, 263)
|
||||||
|
|
||||||
|
CreateThread(function()
|
||||||
|
while true do
|
||||||
|
Wait(0)
|
||||||
|
lib.disableControls()
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
```
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
---
|
||||||
|
title: lib.callback.await
|
||||||
|
---
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- name: string
|
||||||
|
-- delay: number or false
|
||||||
|
lib.callback.await(name, delay, ...)
|
||||||
|
```
|
||||||
|
|
||||||
|
```lua
|
||||||
|
local count = lib.callback('ox_inventory:getItemCount', false, 'water', {type = 'fresh'})
|
||||||
|
print(count)
|
||||||
|
```
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
title: lib.callback
|
||||||
|
---
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- name: string
|
||||||
|
-- delay: number or false
|
||||||
|
-- cb: function
|
||||||
|
lib.callback(name, delay, cb, ...)
|
||||||
|
```
|
||||||
|
|
||||||
|
```lua
|
||||||
|
lib.callback('ox_inventory:getItemCount', false, function(count)
|
||||||
|
print(count)
|
||||||
|
end, 'water', {type = 'fresh'})
|
||||||
|
```
|
||||||
@@ -4,11 +4,11 @@
|
|||||||
-- callback: function
|
-- callback: function
|
||||||
-- parameters: table (optional)
|
-- parameters: table (optional)
|
||||||
-- help: string (optional)
|
-- help: string (optional)
|
||||||
lib.commands(principal, command, callback, parameters, help)
|
lib.addCommand(principal, command, callback, parameters, help)
|
||||||
```
|
```
|
||||||
|
|
||||||
```lua
|
```lua
|
||||||
lib.commands('group.admin', {'additem', 'giveitem'}, function(source, args)
|
lib.addCommand('group.admin', {'additem', 'giveitem'}, function(source, args)
|
||||||
args.item = Items(args.item)
|
args.item = Items(args.item)
|
||||||
if args.item and args.count > 0 then
|
if args.item and args.count > 0 then
|
||||||
Inventory.AddItem(args.target, args.item.name, args.count, args.metatype)
|
Inventory.AddItem(args.target, args.item.name, args.count, args.metatype)
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
---
|
||||||
|
id: register
|
||||||
|
title: lib.callback.register
|
||||||
|
---
|
||||||
|
|
||||||
|
```lua
|
||||||
|
-- name: string
|
||||||
|
-- cb: function
|
||||||
|
lib.callback.register(name, cb)
|
||||||
|
```
|
||||||
|
|
||||||
|
```lua
|
||||||
|
lib.callback.register('ox_inventory:getItemCount', function(source, item, metadata, target)
|
||||||
|
local inventory = target and Inventory(target) or Inventory(source)
|
||||||
|
return (inventory and Inventory.GetItem(inventory, item, metadata, true)) or 0
|
||||||
|
end)
|
||||||
|
```
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
title: Imports
|
||||||
|
---
|
||||||
|
|
||||||
|
These functions are loaded into the environment for the invoking resource.
|
||||||
File renamed without changes.
Reference in new issue
Block a user