mri-fivem-skills
All skills

mri-txadmin

Server commands through txAdmin

Runs ensure, restart, start or stop on a resource of a local FiveM server through the txAdmin API (no rcon) and shows what fxserver.log recorded.

No rcon: txAdmin runs locally and its panel has an API. The script logs in, sends the command and prints the new lines of fxserver.log.

Set up once: copy config.example.json to config.json (kept out of git) and fill in the URL, the txAdmin login, the server folder (base, where txData lives) and the profile.

Run from the skill folder, Node 18+:

node scripts/tx.mjs ensure rpemotes-reborn
node scripts/tx.mjs restart my_resource
node scripts/tx.mjs stop my_resource
node scripts/tx.mjs ensure job_a job_b job_c   # several at once, on the same login
node scripts/tx.mjs refresh                    # rescan resources (new folder)
Action What it does
ensure <res> Starts it, or restarts if running. The default to reload a change.
restart <res> Restarts (fails if stopped).
start <res> / stop <res> Starts / stops.
refresh Server refresh, to see a new resource or a changed fxmanifest.lua (new file in client_scripts or server_scripts): without it ensure starts with the old manifest and the client or the server gets attempt to index a nil value on the missing file's global. Run it before the ensure whenever the manifest file lists changed.
say <message> txAdmin announcement to every player. Only when asked.

Login: txAdmin blocks login for 15 minutes after about 10 attempts in a row (error 429). The script keeps the session in %TEMP%\mri-txadmin-<url>.json and only logs in again when it expires. For several resources, pass them all in one command instead of looping calls. On a 429, wait the 15 minutes: retrying doesn't help.

Flags: --base <folder> and --profile <profile> (defaults in config.json), --url if txAdmin isn't on port 40120, --no-log to skip reading the log.

After the command

Errors