mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-11-22 10:58:36 +00:00
refactor(callbacks): randomise event callback and fix timer logic
Prevent any possibility of listening for server callback or conflicting event handlers on the client.
This commit is contained in:
1 parent
b8ad392692
commit
2084897785
3 files changed
+26
-20
No files matched your search
@@ -6,10 +6,10 @@ local ServerCallback = {}
|
||||
ServerCallback.Register = function(name, callback)
|
||||
name = ('__cb_%s:%s'):format(GetCurrentResourceName(), name)
|
||||
|
||||
RegisterServerEvent(name, function(...)
|
||||
RegisterServerEvent(name, function(id, ...)
|
||||
local source = source
|
||||
callback(source, function(...)
|
||||
TriggerClientEvent(name, source, ...)
|
||||
TriggerClientEvent(name..id, source, ...)
|
||||
end, ...)
|
||||
end)
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user