DiscordAcePerms [Release]

Documentation moved [refer to following for instructions]: DiscordAcePerms - Badger Docs

Archived Documentation Below:

Version 1.0

This is another one of my discord scripts! :slight_smile: If used properly along with my other scripts, you can fully make your server use only discord roles for permissions and chat roles :wink:

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).

Example of how to set it up:

roleList = {
{1, "group.tc"}, --[[ Trusted-Civ --- ]] 
{1, "group.faa"}, --[[ FAA --- ]]
{1, "group.donator"}, --[[ Donator --- ]]
{1, "group.trialModerator"}, --[[ T-Mod --- ]] 
{1, "group.moderator"}, --[[ Moderator --- ]]
{1, "group.admin"}, --[[ Admin --- ]]
{1, "group.admin"}, --[[ Management --- ]]
{1, "group.owner"}, --[[ Owner --- ]]
}

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
  1. Download DiscordAcePerms
  2. Extract the .zip and place the folder in your /resources/ of your Fivem server
  3. Put add_ace resource.DiscordAcePerms command.add_principal allow and add_ace resource.DiscordAcePerms command.remove_principal allow in server.cfg
  4. Make sure you add ā€œstart DiscordAcePermsā€ in your server.cfg
  5. Enjoy :slight_smile:

My Other Work

DiscordChatRoles

DiscordAcePerms

SandyVehiclesRestrict

DiscordTagIDs

DiscordVehiclesRestrict

DiscordPedPerms

BadgerAnims

DiscordWeaponPerms

BadgerTools

BadgerBankRobbery

VehicleTrustSystem

Download

18 Likes

I have been looking for a script like this for a long time now, Thanks a lot dude

2 Likes

Enjoy!

2 Likes

i f***ing love you

Suggestion make one that whitelist esx jobs and ill literally love you forever

3 Likes

Thank you, glad you enjoy my work! What script is that? I could look into it.

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.

2 Likes

So does it check for multiple roles, or does it stop when it has found A role.

Good work!

1 Like

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!

It checks for multiple roles! That way you can assign people multiple roles of course :slight_smile: Thank you!

1 Like

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 :slight_smile:

playerConnecting

Is the event you need to use to check on connect.

Edit: reeeeeeee didnt see above postā€¦

1 Like

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.

That doesnā€™t seem to make any sense to me as discord id is used and not the name :stuck_out_tongue:

1 Like

I know rightā€¦
This is what console showed for the moderator
missing identifier š™Žš™©š™§š™šš™šš™©š™¤ has not gotten their permissions cause roleIDs == false
Then, I take away the role from him on discord, give him it back, then he joins with his perms again.

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.

Oh ok, well, thatā€™s a shame. Iā€™m gonna try find it over on discord_perms forum.
Thanks for your time.

Iā€™ve removed your Discord link as it is against our rules, as linked below.

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.

roleList = {
{552026701731725313, "Fax.AOP"}, --[[ STAFF --- ]] 
{552026701731725313, "command.announce"}, --[[ STAFF --- ]]
{569487387554742302, "group.admin"}, --[[ Asst. Director --- ]]
{551199744161087498, "group.admin"}, --[[ Deputy Director --- ]]
{551199533829193748, "group.admin"}, --[[ Director --- ]]
add_ace Fax.AOP faxes.aopcmds allow
add_ace w.reset w.reset allow
add_ace group.admin command.announce allow
add_ace resource.DiscordAcePerms command.add_principal allow