ESX.TriggerServerCallback¶
1 | ESX.TriggerServerCallback(name, cb, args) |
This function triggers a server callback. See ESX.RegisterServerCallback on registering server callbacks.
Warning
This is an async function and must be treated as one, xxamples on how to properly use the async function callback is shown below.
Arguments¶
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
name | string | No | - | A valid server callback name |
cb | function | No | - | The returned function when the async task has completed. The invoked function a varied size of arguments depending on how many arguments are parsed from the server |
args | any | Yes | - | Any arguments to parse to the async function |
ESX.TriggerServerCallback Exemplo¶
1 2 3 4 5 6 7 8 | local myAgument = 'hello' ESX.TriggerServerCallback('esx_example:test', function(isBusy, numKills) print(isBusy, numKills) print('this code is an asynchronous task') end, myAgument) print('this code is running in sync') |