Introduction
RSG Framework provides a robust command system that allows you to create custom commands with permission levels, argument validation, and suggestions. Commands can be restricted to specific permission groups like admin, mod, or user. Location:resources/[framework]/rsg-core/server/commands.lua
Core Features
🔐 Permission-based Access
- User: Available to all players
- Mod: Moderator-only commands
- Admin: Administrator commands
- God: Super admin commands
📝 Argument Handling
- Required/Optional: Control if arguments are mandatory
- Help Text: Descriptions shown in suggestions
- Type Validation: Validate argument types in callbacks
⚡ Auto-completion
- Dynamic Suggestions: Commands show based on permissions
- Argument Hints: Display help text for each argument
- Refresh System: Update suggestions when permissions change
Creating Commands
RSGCore.Commands.Add
This function allows you to register a command with a specified user level-
name:
string -
help:
string -
arguments:
table -
argsrequired:
boolean -
callback:
function -
permission:
string
RSGCore.Commands.Refresh
This function will trigger a refresh of all commands suggestions. This is helpful for when setting permissions to a higher level, it will refresh the suggestions list so the player can now see the new commands they have access to!- source:
number
Practical Examples
Example 1: Basic User Command
Example 2: Admin Command with Arguments
Example 3: Command with Optional Arguments
Built-in Commands
AdminMenu
/tp [id / x ] [opt: y] [opt: z]- teleport to player or location
/tp [id / x ] [opt: y] [opt: z]- teleport to player or location
id or to a given x, y, z locationPermission level: admin- id or x - (required) The player id or x coordinate
- y - (optional) The y coordinate (required if using x for the first argument)
- z - (optional) The z coordinate (required if using x for the first argument)
/tpm - teleport to a marked location
/tpm - teleport to a marked location
/noclip - toggle noclip on/off
/noclip - toggle noclip on/off
/togglepvp - toggle PVP on server
/togglepvp - toggle PVP on server
/addpermission [id] [permission] - gives a player permission
/addpermission [id] [permission] - gives a player permission
/removepermission [id] [permission] - removes a player permission
/removepermission [id] [permission] - removes a player permission
permission from the player with the given id. The player must be online.Permission level: god/openserver - open server for everyone
/openserver - open server for everyone
/closeserver - close the server for people without permission
/closeserver - close the server for people without permission
reason in the kick message.Permission level: admin/wagon [mode] - spawns a wagon
/wagon [mode] - spawns a wagon
model type.Permission level: admin/horse [model] - spawns a horse
/horse [model] - spawns a horse
model type.Permission level: admin/dv - delete vehicle
/dv - delete vehicle
/givemoney [id] [type] [amount] - give money to the player
/givemoney [id] [type] [amount] - give money to the player
-
id - (required) The
idof the player - type - (required) The money type [cash, bank etc…]
- amount - (required) The amount to give
/setmoney [id] [type] [amount] - set the amount a player has
/setmoney [id] [type] [amount] - set the amount a player has
-
id - (required) The
idof the player - type - (required) The money type [cash, bank etc…]
- amount - (required) The amount to set
/job - display your current job
/job - display your current job
/setjob [id] [job] [grade] - sets a players job
/setjob [id] [job] [grade] - sets a players job
/gang - display your current gang
/gang - display your current gang
/setgang [id] [gang] [grade] - sets a players gang
/setgang [id] [gang] [grade] - sets a players gang
id to be part of the given gang with the given gradePermission level: admin-
id - (required) The
idof the player - gang - (required) The gang name
- grade (required) The gang grade
/clearinv [opt: id] - clears a players inventory
/clearinv [opt: id] - clears a players inventory
id to be part of the given gang with the given gradePermission level: admin-
id - (required) The
idof the player - gang - (required) The gang name
- grade (required) The gang grade
/giveitem [id] [item] [amount] - gives a player items
/giveitem [id] [item] [amount] - gives a player items
- id - The id of a player
- item - The itenm of shared/items.lua
- amount - (optional) The amount item receive of a player
/randomitems - give random items to players inventory
/randomitems - give random items to players inventory
/resetinv [type] [id] -reset inventory
/resetinv [type] [id] -reset inventory
- type - The type of stash / trunk / glovebox
- id - The id of stash or license plate
/id - notify of your server ID
/id - notify of your server ID
/cid - notify you of your Citizen ID
/cid - notify you of your Citizen ID
/rob - rob a player
/rob - rob a player
/loadskin - Refresh Skin
/loadskin - Refresh Skin
/customweapon - custom weapon skin
/customweapon - custom weapon skin
/w_inspect - inspect a weapon
/w_inspect - inspect a weapon
/loadweapon - Refresh skin weapon player
/loadweapon - Refresh skin weapon player
/addressbook - Player addressbook
/addressbook - Player addressbook
Best Practices
Permission Levels
When choosing permission levels, follow these guidelines:| Level | Use For |
|---|---|
user | Safe commands any player can use (view own data, cosmetic) |
mod | Commands that affect other players but not severely |
admin | Commands that modify game state, spawn items, teleport |
god | Dangerous commands that can break things or affect all players |
Next Steps
- Server Functions Reference - Complete function reference
- Player Data - Access player data in commands
- Callbacks - Client-server communication
- Configuration - Configure permission levels
Need help? Join the RSG Framework Discord!