mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
REFACTORRRRRR
fuck you
This commit is contained in:
@@ -5,8 +5,8 @@ NDCore = exports["ND_Core"]:GetCoreObject()
|
||||
function validateDepartment(player, department)
|
||||
local departmentExists = config.departments[department]
|
||||
if departmentExists then
|
||||
local discordUserId = string.gsub(NDCore.functions:GetPlayerIdentifierFromType("discord", player), "discord:", "")
|
||||
local roles = NDCore.functions:getUserDiscordInfo(discordUserId).roles
|
||||
local discordUserId = string.gsub(NDCore.Functions.GetPlayerIdentifierFromType("discord", player), "discord:", "")
|
||||
local roles = NDCore.Functions.GetUserDiscordInfo(discordUserId).roles
|
||||
|
||||
-- validate that the player actually has the role that they selected on the client.
|
||||
for _, roleId in pairs(departmentExists) do
|
||||
@@ -28,7 +28,7 @@ AddEventHandler("ND_CharacterSelection:newCharacter", function(newCharacter)
|
||||
if not departmentCheck then return end
|
||||
|
||||
-- Create the character if the player has permission to the department.
|
||||
NDCore.functions:createCharacter(player, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.twt, newCharacter.job, newCharacter.cash, newCharacter.bank)
|
||||
NDCore.Functions.CreateCharacter(player, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.twt, newCharacter.job, newCharacter.cash, newCharacter.bank)
|
||||
end)
|
||||
|
||||
-- Update the character info when edited.
|
||||
@@ -41,18 +41,18 @@ AddEventHandler("ND_CharacterSelection:editCharacter", function(newCharacter)
|
||||
if not departmentCheck then return end
|
||||
|
||||
-- Updating the character information in the database.
|
||||
NDCore.functions:updateCharacterData(newCharacter.id, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.twt, newCharacter.job)
|
||||
NDCore.Functions.UpdateCharacterData(newCharacter.id, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.twt, newCharacter.job)
|
||||
|
||||
-- Updating characters on the client.
|
||||
TriggerClientEvent("ND:returnCharacters", player, NDCore.functions:getPlayerCharacters(player))
|
||||
TriggerClientEvent("ND:returnCharacters", player, NDCore.Functions.GetPlayerCharacters(player))
|
||||
end)
|
||||
|
||||
RegisterNetEvent("ND_CharacterSelection:checkPerms")
|
||||
AddEventHandler("ND_CharacterSelection:checkPerms", function()
|
||||
local player = source
|
||||
local discordUserId = string.gsub(NDCore.functions:GetPlayerIdentifierFromType("discord", player), "discord:", "")
|
||||
local discordUserId = string.gsub(NDCore.Functions.GetPlayerIdentifierFromType("discord", player), "discord:", "")
|
||||
local allowedRoles = {}
|
||||
local roles = NDCore.functions:getUserDiscordInfo(discordUserId).roles
|
||||
local roles = NDCore.Functions.GetUserDiscordInfo(discordUserId).roles
|
||||
|
||||
-- Check if the players discord roles will grant them permission to the department.
|
||||
for dept, roleTable in pairs(config.departments) do
|
||||
|
||||
Reference in New Issue
Block a user