mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-16 22:46:03 +01:00
Update README.md
This commit is contained in:
@@ -11,7 +11,7 @@ version '1.0.0'
|
||||
lua54 'yes'
|
||||
use_fxv2_oal 'yes'
|
||||
|
||||
shared_script '@library/init.lua'
|
||||
shared_script '@pe-lualib/init.lua'
|
||||
|
||||
files {
|
||||
'client.lua',
|
||||
@@ -36,3 +36,10 @@ ServerCallback.Register('eventname', function(source, cb, data)
|
||||
cb(data..'. general kenobi')
|
||||
end)
|
||||
```
|
||||
|
||||
Target a registered ServerCallback in any resource by setting the first parameter to that resource name, then utilise whatever event name you desire.
|
||||
For my test, I utilised `test` and `testevent`, which registers an event with the name `__cb_test:testevent`.
|
||||
|
||||
The third parameter sets a delay for how often the client can trigger the callback (to prevent spam in certain situations).
|
||||
|
||||
There's also ServerCallback.Await which halts the thread and returns the values rather than using a callback (I haven't tested it since refactoring all this code, though).
|
||||
|
||||
Reference in New Issue
Block a user