Files
Elite-Gaming-FiveM/resources/[EGRP-Discord-Integration]/Discord-WepRestriction/server.lua
T
Jacob 3bd8365ca5 feat: overall QOL improvements
+ Updated to latest server artifacts
+ Updated vMenu to the latest v3.6
+ Replaced Discord Weapon restrictions with a better fork of the repository.
+ Restructured the server config, and updated the dlc build to the latest San Andreas Mercenaries dlc.
+ Attempted to fix missing radios in the wheel.
2023-12-02 02:40:09 +00:00

47 lines
1.6 KiB
Lua

-------------------------------
-- ImprovedDiscordWeaponPerms -
--------IC-Technologies--------
-------------------------------
RegisterNetEvent("ImprovedDiscordWeaponPerms:CheckPerms")
AddEventHandler("ImprovedDiscordWeaponPerms:CheckPerms", function()
local src = source
local userRoles = {}
for k, v in ipairs(GetPlayerIdentifiers(src)) do
if string.sub(v, 1, string.len("discord:")) == "discord:" then
identifierDiscord = v
end
end
if identifierDiscord then
local roleIDs = exports.Badger_Discord_API:GetDiscordRoles(src)
if not (roleIDs == false) then
for i = 1, #roleIDs do
for role, PEDs in pairs(Config.WeaponRestrictions) do
if exports.Badger_Discord_API:CheckEqual(role, roleIDs[i]) then
userRoles[role] = true;
print("[ImprovedDiscordWeaponPerms] " .. GetPlayerName(src) .. " has received permission for role: " .. tostring(role) );
if Config.InheritanceEnabled then
local inheritedRoles = Config.Inheritances[role];
if inheritedRoles ~= nil then
--There are inherited roles
for j = 1, #inheritedRoles do
userRoles[ inheritedRoles[j] ] = true;
print("[ImprovedDiscordWeaponPerms] " .. GetPlayerName(src) .. " has inherited role: " .. tostring(inheritedRoles[j]));
end
end
end
end
end
end
else
print("[ImprovedDiscordWeaponPerms] " .. GetPlayerName(src) .. " has not gotten their permissions because roleIDs == false")
end
elseif identifierDiscord == nil then
print("[ImprovedDiscordWeaponPerms] " .. "identifierDiscord == nil")
end
TriggerClientEvent('ImprovedDiscordWeaponPerms:CheckPerms:Return', src, userRoles)
end)