Skip to main content
Server Proxied to ug-core.

Register

string
required
Starts with a lowercase letter, then letters, digits and underscores, up to 32 characters. Registers /name.
UgCommandOptions
required
fun(source, args)
required
args is keyed by argument name. source is 0 for the console.
Registering the same name twice raises.

Who can use it

Prefer permission in resources you share: owners decide which groups get it in config/permissions.lua. Use groups for commands tied to your own server’s staff ranks.
A group missing from config/permissions.lua logs a warning at registration and matches nobody. It does not raise, so renaming a group never breaks a resource.

Argument types

Each argument has name, type, and optional optional, max and help. Optional arguments MUST be trailing.

Checks

For players, in order: ug-core is ready, rate limit, requirePlayer, permission and groups, arguments, handler. The console skips the first four checks. Console failures print the error code and the usage instead of emitting an event.

CanUse

True when the player passes the command’s permission and groups. Use it to show only usable commands in chat suggestions and menus. Rate limits, requirePlayer and arguments are not checked. Unknown commands return false. Source 0 is the console.

Chat suggestions

When the cfx chat resource runs, ug-core suggests commands in chat. Each player sees only the commands they may use, with help and one hint per argument: the argument’s help, or its type. Optional arguments show as [name]. Suggestions are sent when the player loads, when a resource registers commands, and when a group changes. Commands a player loses, or whose resource stops, are removed. They are hints only: every command checks access again when it runs.

GetAll

Commands sorted by name, with name, help, permission, groups and args.

Errors

ug-core shows nothing to players. A failed command emits ug-core:Commands:Failed so a chat or notification resource can display it: Rate limited commands are dropped silently. Invalid options raise at registration.

Events

Example

A moderation command that respects ranks: