Skip to content

spectrumdevofficial/sd_playergroups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sd_playergroups

Server-side ESX helper that syncs a player's ESX group from their Discord roles.

Features

  • Map Discord role IDs to ESX groups (admin, senior, staff, trial, …).
  • Priority-based resolution if a player has multiple roles.
  • Auto-update on player load and manual full reload via console command.

Requirements

  • ESX Legacy (es_extended).
  • Discord bot in your guild with a valid token.
  • Bot must have the Server Members (Guild Members) intent enabled in the Developer Portal.
  • Players must have a Discord identifier.

Installation

  1. Place this resource into your server resources.
  2. In server.cfg, start it after ESX and set the bot token convar:
    ensure es_extended
    ensure sd_playergroups
    set discordBotToken "YOUR_BOT_TOKEN_HERE"
  3. Configure config.lua.
  4. Done.

Usage

  • On esx:playerLoaded, the script:
    • Reads the player's discord: identifier.
    • Calls Discord API to get member's roles.
    • Picks the highest-priority group from the member's roles.
    • Sets player's group to that value, or user if none match.

Commands

  • Console only: /reloadplayergroups (or the name you set in Config.ReloadCommand):
    • Reloads all online players' groups.

Notes

  • Config.Token is read from the discordBotToken convar; keep tokens out of source control.
  • Ensure your bot is in the guild, token is valid, and the Server Members intent is enabled. Discord API must return HTTP 200.

Credits

  • Author: fashion.demon