sPerms
This resource offers real time perms using discord roles. It takes a object of roles and return the same object, but true of false depending on if the they have the role. This also offer a feature to disallow people joining if they don’t have discord linked. That is set to false by default, but can be changed in the config. This doesn’t work with most common discord perms resources, but it can with some work. You NEED this resource in order for this resource to work!
Video
Installation
- Clone or download resource into your
resources
folder - Configure the config to your liking
- Add
sPerms
to your server.cfg
Exports
getUserRoles (server)
The getUserRoles export takes the server id of the player and returns their permissions object.
Example Usage
LUA
print(exports['sPerms']:getPlayerPerms(soruce))
JS
console.log(exports.sPerms.getPlayerPerms(source));
Events
sPerms:setPerms (client)
The event sPerms:setPerms will fire whenever a discord member roles changes, or when the player spawns in. It will return the permission object. This will only send the data to the client that had updated perms, not everyone. Note: It will only update when a roles are updated in the guild you have set in the sDiscord
resource.
Example Usage
LUA
RegisterNetEvent('sPerms:setPerms')
AddEventHandler('sPerms:setPerms', function(perms)
if perms.category.fivem then
print('You have the FiveM role!')
end
end)
JS
onNet('sPerms:setPerms', (perms) => {
console.log(perms);
});
Download
You can download this resource here