QB框架如何设置管理员权限

什么是ACE权限

Ace 是 CFX 提供的内置权限系统。它们允许创建附加了 ace 的新节点。这个权限系统由王牌和委托人组成。基本上可以想象一棵有树枝的树。我们有我们创建的 ace,然后每个分支都将成为我们的 principal,它继承了 ace 的权限

服务器配置

在 server.cfg 文件的底部,您将看到一个 permissions 部分

## Permissions ##
add_ace group.admin command allow # allow all commands
{{addPrincipalsMaster}} # This is the way 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

不同类型的标识符

  • FiveM ID

  •  

    Rockstar 许可证(qbcore 使用)

  •  

    Discord ID

要获得 FiveM 或 GTA 许可证,您可以在 txAdmin Web 面板上查找播放器

如果它们当前已连接到服务器,您将获取所有可用的标识符

收集所需的标识符后,转到 server.cfg 并添加如下所示的部分Players

qbcore.god 和 group.admin 共享相同的权限,您可以使用其中任何一个。

## Permissions ##
add_ace group.admin command allow # allow all commands
{{addPrincipalsMaster}} # This is the way 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

# 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

在服务器中设置用户权限

当您拥有权限时,您可以使用命令或管理员菜单设置用户权限
在服务器中键入命令/addpermission [id] [addpermissions]
它看起来像这样/addpermission 1 god
在聊天中输入命令/admin
访问“玩家管理”选项卡,然后选择要授予权限的玩家
找到一个名为 “Permissions” 的菜单项
为该用户设置用户组,然后按“提交”
允许命令具有特定权限
在 qb-core/config.lua 中找到QBConfig.Server.Permissions = {‘god’, ‘admin’, ‘mod’}

20250520170654423-image

在这里,您可以添加更多组,假设我想为警察创建一个QBConfig.Server.Permissions = {'god', 'admin', 'mod', 'leo'}

然后在我的 server.cfg 中,我会像这样将其放在 admins 下面add_principal identifier.license:xxxxxxx qbcore.leo #players name

温馨提示: 本文最后更新于2025-05-21 20:24:38,某些文章具有时效性,若有错误或已失效,请在下方留言或联系RedM新手社区
本站代码模板仅供学习交流使用请勿商业运营,严禁从事违法,侵权等任何非法活动,否则后果自负!
THE END
喜欢就支持一下吧
点赞14 分享
评论 共11条

请登录后发表评论