register
-- ARGUMENTS
-- name: string
-- callback: function (
-- source: number,
-- callback: function,
-- any: ...
-- )
-- RETURNS
-- nil
ti.callbacks.register("getMoney",function(source,cb,accountName)
print("Get account money")
-- It's imporant to handle error cases correctly here,
-- otherwise you may be blocking a client script from continuing.
-- NOTE: This is not a "bug", this is the intended behavior of sync callbacks.
if type(accountName) ~= "string" then
return cb(0)
end
cb( ti.players.getAccountMoney(accountName) )
end)
Last updated