RSG RedM Framework
  • 👋Introduction
  • 🛠️RSG RedM Server Build
  • 🔑Keybinds
  • ❗Commands
  • 📩Contact Me
  • RSG Callback Function
Powered by GitBook
On this page

RSG Callback Function

RSGCore.Functions.TriggerCallback

Function used to call from the client to the server and receive a value back

function RSGCore.Functions.TriggerCallback(name, cb, ...)
    RSGCore.ServerCallbacks[name] = cb
    TriggerServerEvent('RSGCore:Server:TriggerCallback', name, ...)
end

-- Example

RSGCore.Functions.TriggerCallback('callbackName', function(result)
    print('I got this from the CreateCallBack -->  '..result)
end, 'my_parameter_name')

RSGCore.Functions.CreateCallback

Creates a callback which is used on the client-side code with RSGCore.Functions.TriggerCallback

function RSGCore.Functions.CreateCallback(name, cb)
    RSGCore.ServerCallbacks[name] = cb
end

-- Example

RSGCore.Functions.CreateCallback('callbackName', function(source, cb)
    cb('Ok')
end)
PreviousContact Me

Last updated 1 year ago