This is another one of my discord scripts! If used properly along with my other scripts, you can fully make your server use only discord roles for permissions and chat roles
Dependency
The permissions for a user update after every restart when they first login (so long as they have the discord role ID associated with the group in the list).
The 1s should be replaced with IDs of the respective roles in your discord server. The quotes with groups should represent the groups in your permissions.cfg or server.cfg.
Installation
Download DiscordAcePerms
Extract the .zip and place the folder in your /resources/ of your Fivem server
Put add_ace resource.DiscordAcePerms command.add_principal allow and add_ace resource.DiscordAcePerms command.remove_principal allow in server.cfg
Make sure you add āstart DiscordAcePermsā in your server.cfg
Just so you know, playerSpawned fires every time the player respawns (like dying). Youāll need to add a flag to prevent permissions from being added more than once.
Oh I didnāt realize that flaw! I really want it to work on connection, but couldnāt find the event for it. Iāll add in the fix for that problem tomorrow when I get the chance! Thanks for the information!
I have now changed it so it only runs on playerConnecting event and adds them to a table that tracks if they got their perms already added so it only adds perms to a player once every server instance
You know how it adds the player to a table, then uses this table.insert(hasPermsAlready, GetPlayerName(src)), what about if one of my moderators change their name on the discord?
Because Iāve recently had that, where my moderator lost his perms on the server, just after he changed his name on discord.
GetPlayerName(src) is Fivem in-game-name, not discord name. The perms reset every restart. I could change it to every respawn if thatās what youāre requesting
So what about, if the in game was changed?
Iām not asking for any feature suggestions, I was just wondering how when the name is changed on discord, it takes away the mod perms.
Like for to fix it, we actually have to take away the moderatorās role in discord, and then reapply it to him/her. I dunno what could be the issue.
From what I remember, thatās a discord_perms issue, but it usually means the discord service was not open and Fivem could not detect discord properly. I very much doubt it had anything to do with him changing his name.
Is this correct? Below are 2 lines of code. The first one is the server.lua from the DiscordAcePerms and the second one is from my server.cfg. If their is anything incorrect please let me know. I also have my folder for my script named āDiscordAcePermsā and have started the script under that name.