Commands
zdiscord comes preloaded with a fairly sizable set of default command with their own permission levels
Table of Contents:
Included Commands (52)
Key: [required] (optional)
Standalone Commands: (25)
/announcement [message]
- mod+
/embed complex [channel] [json]
- god
/embed simple [channel] [message] (title) (image) (thumbnail) (footer) (color)
- god
/identifiers [id]
- admin+
/kick [id] (message)
- mod+
/kickall [message]
- admin+
/kill [id]
- admin+
/message [id] [message]
- mod+
/onlinecount
/players
- mod+
/resource ensure [resource]
- god
/resource inspect [resource]
- god
/resource list
- god
/resource refresh
- god
/resource start [resource]
- god
/resource stop [resource]
- god
/server
/screenshot [id]
- god
/teleport coords [id] [x] [y] [z] (keepVehicle)
- mod+
/teleport preset [id] [location] (keepVehicle)
- mod+
/teleport-all coords [x] [y] [z]
- god
/teleport-all preset [location]
- god
/whitelist toggle [true/false]
- god
/whitelist addrole [role]
- god
/whitelist removerole [role]
- god
QBCore Commands: (27)
/ban [id] [time] [reason]
- admin+
/clothing-menu [id]
- admin+
/gang kick [id]
- admin+
/gang inspect [id]
- admin+
/gang set [id] [gang] [grade]
- admin+
/inventory give [id] [item] [count]
- admin+
/inventory inspect [id]
- admin+
/inventory take [id] [item] [count]
- admin+
/jail free [id]
- mod+
/jail sentence [id] [time]
- mod+
/job fire [id]
- admin+
/job inspect [id]
- admin+
/job set [id] [job] [grade]
- admin+
/logout [id]
- admin+
/money add [id] [type] [amount]
- admin+
/money inspect [id]
- admin+
/money remove [id] [type] [amount]
- admin+
/money set [id] [type] [amount]
- admin+
/permissions add [id] [permission]
- god
/permissions remove [id]
- god
/revive [id]
- admin+
/revive-all
- god
/time [hour]
- admin+
/vehicle give [id] [spawncode] (plate)
- god
/vehicle lookup [plate]
- god
/weather blackout
- admin+
/weather set [weather]
- admin+
Change permissions
I tried to make all the permissions as fair and even as I could with my experience with servers and staffing, if you disagree with them it’s quite easy to change.
There’s currently only 3 permission tiers (mod, admin, god). Permissions are granted by a hierarchy so “mod” will also mean “admin” and “god” can access them but a command with “god” will only be usable by someone with the “god” role.
- Go to the
/commands/command-name.js
you want to modify and open it in a text/code editor. - Fine the line that looks like
role: "mod",
near the top (usually around line 26) - Change what is in the quotes
" "
to the permission you want to access the command. ie.role: "admin",
- save and restart the resource or server.
Please note that permissions are synced across whole base commands so if you wanted /money inspect
to be mod+ and /money add
to be admin+ you’d need to separate them into separate commands to achieve that.
Add commands
Adding commands can be really simple if you’re familiar with javascript but very confusing otherwise. continue at your own risk and if you do make something cool, consider submitting a pull request and maybe it’ll become a part of the default zdiscord commands :)
-
create a new javascript file under
/commands
with the name of your command (all lowercase, no spaces).
Note: If the command filename starts withqb-
it will only load if QBCore is detected -
Paste in the following base. this is everything REQUIRED for a command to work properly:
module.exports = { name: "commandname", description: "description of command", run: async (client, interaction, args) => { return interaction.reply({ content: "The Message that will be sent to back when the command is run" }); }, };
-
If you wanted to make it so only admin or god could run your command you’d add the following 2 lines under your description line:
role: "admin",
-
If you wanted to be able to accept input from the person submitting the command like an id and a message you’d add the following:
options: [ { name: "id", description: "Player's current id", required: true, type: "INTEGER", // This forces this value to be a number only }, { name: "message", description: "description for what this message is for", required: true, // Setting this to false will make it optional type: "STRING", }, ], run: async (client, interaction, args) => { // You should already have this from the first part // args will be named after the name in options (`args.id`, `args.message`) // Do what you want with id and message from here on
-
If you need further guidance these links should help:
discord.js guide - Great for beginners to discord.js
discord.js docs - Has almost everything you need to know
discord.com command docs - specific details about how things work
FiveM server functions for JS - Everything you can do with FiveM from a command
This resource itself - Honestly there’s so many features and practices being used actively here in commands and utils that you can take note from or in many cases just copy and paste and use so have at it and don’t be afraid to break things to help learn more.. as long as you’re not working on a live server while you’re breaking things ;)