Admin Tools
Console commands for server administration and recovery.
mdt_setadmin
Promotes a player to department admin from the server console. Handles every edge case — missing departments, missing ranks, inactive staff, offline players — so you never need to touch raw SQL.
mdt_setadmin <identifier> <job>| Parameter | Description |
|---|---|
identifier | Player's framework identifier (e.g. citizen ID, license, etc.) |
job | Job name matching a key in your departments config (e.g. police, bcso, ambulance) |
This command only works from the server console (source 0). It cannot be run by players in-game.
What it does
- Resolves the department — looks up the job in the database. If it doesn't exist yet but is defined in your config, the department is auto-created (including its default admin rank, templates, and licenses).
- Finds or creates an admin rank — searches for a rank with the wildcard (
*) permission. If none exists, creates an "Admin" rank at the highest priority. - Resolves the staff record — if the player already has a staff record that is fired, suspended, on leave, or inactive, it reactivates them. If no staff record exists, it creates one (using the player's real name if they're online, or a placeholder "Admin Recovery" if offline).
- Promotes to admin — sets the staff member's rank to the admin rank.
- Syncs live state — if the player is online, updates their rank via state bags immediately. Invalidates all rank and permission caches.
Examples
mdt_setadmin license:abc123 police
mdt_setadmin AB12CD34 bcsoEdge cases
| Scenario | Behavior |
|---|---|
| Job not in config or database | Prints error, no changes made |
| Job in config but not in database | Auto-creates department with defaults |
No rank with * permission exists | Creates "Admin" rank at top priority |
| Staff record doesn't exist + player offline | Creates staff with placeholder name "Admin Recovery" |
| Staff record doesn't exist + player online | Creates staff with player's real character name |
| Staff is fired / suspended / on leave / inactive | Reactivates to "active" then promotes |
| Player is online | Live rank sync via state bags |
| Player is offline | Database updated, sync applies on next join |