cityrp.plugin
Revamped plugin system with legacy support, adapted from Helix.
Functions
cityrp.plugin.RunLoadData()
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Runs the LoadData
and PostLoadData
hooks for the gamemode, schema, and plugins. Any plugins that error during the
hook will have their SaveData
and PostLoadData
hooks removed to prevent them from saving junk data.
hook.SafeRun(name, ...)
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Runs the given hook in a protected call so that the calling function will continue executing even if any errors occur
while running the hook. This function is much more expensive to call than hook.Run
, so you should avoid using it unless
you absolutely need to avoid errors from stopping the execution of your function.
Parameters
-
name
string
Name of the hook to run
-
...
Arguments to pass to the hook functions
Returns
-
table
Table of error data if an error occurred while running
-
...
Any arguments returned by the hook functions
Example Usage
local errors, bCanSpray = hook.SafeRun("PlayerSpray", Entity(1))
if (!errors) then
-- do stuff with bCanSpray
else
PrintTable(errors)
end