my-greeter, a resource that:
- answers a client callback with data only the server knows,
- registers a chat command with typed, validated arguments,
- reacts when a player’s death state changes.
You need a server with
ug-core running. See Installation.1
Create the manifest
Create
resources/my-greeter/fxmanifest.lua:fxmanifest.lua
@ug-core/import.lua defines the global UgCore in your resource. lua54 'yes' is required.2
Register a callback
Create UgCore registers it as
server.lua. The schema accepts one optional string of up to 32 characters. The rate limit allows 3 calls per 5 seconds per player:server.lua
my-greeter:Greet. Before your handler runs, the server checks the global budget, the concurrency cap, the rate limit and the schema.3
Call it from the client
Create
client.lua. Callback.Await blocks the current thread until the server answers, for up to 10 seconds:client.lua
4
Add a validated chat command
Back in
server.lua, add a command with typed arguments. Requires the commands module, enabled by default:server.lua
type = 'player' only accepts the id of a connected player. Bad input emits ug-core:Commands:Failed for your chat resource to display. The core itself shows nothing to players.5
Listen to an event
UgCore emits events when things happen. Events from
ug-core are only accepted when ug-core itself sent them:server.lua
6
Start it
Add
ensure my-greeter after ensure ug-core in server.cfg, restart, then type /greet happy in game. F8 shows:F8
Try breaking it
Send bad input on purpose and watch the server handle it:
Run
ug guard <your id> in the server console to see your score and the recent flags.
Next steps
Importing UgCore
What runs in your resource and what goes through exports.
Callbacks
Options, errors, and server-to-client callbacks.
Schemas
Every validator, with its bounds and rules.
Hooks
Cancel or change core actions before they happen.