Skip to content

Real time discord perms for FiveM

Notifications You must be signed in to change notification settings

VikingTheDev/sPerms

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

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 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!


Installation

  • Clone or download resource into your resources folder
  • Config the config to your liking
  • Add sPerms to your server.cfg

Exports

getUserRoles (server)

The getUserRoles takes the server id of the player and returns the permission 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);
});

About

Real time discord perms for FiveM

Resources

Stars

Watchers

Forks

Languages

  • JavaScript 93.8%
  • Lua 6.2%