How to become Admin on qbCore

maxresdefault 4

Configuring Permissions in QBCore for Your Server

Introduction

Permissions in QBCore are essential for controlling access to various server features, commands, and resources. This tutorial will guide you through the process of setting up and managing permissions in your QBCore server. We will cover what ace permissions are, configuring server permissions in the server.cfg file, handling different types of identifiers, and creating custom commands with restricted access.

What Are Ace Permissions?
Ace permissions in QBCore determine who can perform specific actions or access particular resources on your server. They allow you to finely control the level of access each player has.

Configuring Server Permissions in server.cfg:
To configure permissions, open your server.cfg file and locate the permissions section. Here’s an example of what it might look like:

## Permissions ##
add_ace group.admin command allow # Allow all commands
{{addPrincipalsMaster}} # This is how txAdmin assigns permissions to the server owner

# Resources
add_ace resource.qb-core command allow # Allow qb-core to execute commands

# Gods
add_ace qbcore.god command allow # Allow all commands

# Inheritance
add_principal qbcore.god group.admin # Allow gods access to the main admin group used to get all default permissions
add_principal qbcore.god qbcore.admin # Allow gods access to admin commands
add_principal qbcore.admin qbcore.mod # Allow admins access to mod commands

This example includes configurations for admin groups, resources, gods, and inheritance of permissions.

Handling Different Types of Identifiers:
QBCore supports various types of identifiers to identify players, such as FiveM IDs, Rockstar licenses, and Discord IDs. You can obtain these identifiers from your txAdmin web panel. Once you have them, add player-specific permissions in your server.cfg:

# Players
add_principal identifier.license:xxxxxx qbcore.god # Player Name
add_principal identifier.license:xxxxxx qbcore.admin # Player Name
add_principal identifier.license:xxxxxx qbcore.mod # Player Name

Replace xxxxxx with the appropriate identifier and specify the desired permissions for each player.

Setting User Permissions:
With permissions configured, you can set user permissions either through commands or the admin menu:

Setting Permissions Using Commands:
You can use the add_principal command to assign permissions to players directly.

Setting Permissions Through the Admin Menu:
You can use the admin menu to assign and manage permissions for players interactively.

Allowing Commands to Specific Permissions:
To restrict specific commands to players with certain permissions, follow these steps:

  1. In the qb-core/config.lua file, locate QBConfig.Server.Permissions:
QBConfig.Server.Permissions = {'god', 'admin', 'mod'}
  1. Add your custom group, e.g., 'leo', to the permissions list:
QBConfig.Server.Permissions = {'god', 'admin', 'mod', 'leo'}
  1. In your server.cfg, add principals for players with the 'leo' permission:
add_principal identifier.license:xxxxxxx qbcore.leo # Player's Name
  1. Create a command restricted to 'leo':
QBCore.Commands.Add('spikes', 'Place spike strips', {}, false, function(source)
  -- Run code
end, 'leo')

Now, the 'spikes' command is restricted to players with the 'leo' permission.

Conclusion:
Configuring permissions in QBCore is essential for managing access to your server’s features and resources. By following this tutorial, you can control who can perform specific actions, ensuring a secure and organized server environment.

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *


pt_BRPortuguês do Brasil