-
Notifications
You must be signed in to change notification settings - Fork 14
/
lib.lua
24 lines (21 loc) · 709 Bytes
/
lib.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
-- _
-- | |
-- _____ _| | _____ ___ _ __
-- / __\ \ /\ / / |/ / _ \/ _ \ '_ \
-- \__ \\ V V /| < __/ __/ |_) |
-- |___/ \_/\_/ |_|\_\___|\___| .__/
-- | |
-- |_|
-- https://github.com/swkeep
-- this is qb-core's implementation of callbacks all credits to them
ServerCallbacks = {}
function TriggerCallback(name, cb, ...)
ServerCallbacks[name] = cb
TriggerServerEvent('Server:TriggerCallback', name, ...)
end
RegisterNetEvent('Client:TriggerCallback', function(name, ...)
if ServerCallbacks[name] then
ServerCallbacks[name](...)
ServerCallbacks[name] = nil
end
end)