REFACTORRRRRR

fuck you
This commit is contained in:
Niko
2022-07-16 00:12:02 -04:00
parent 68721a4633
commit 44b21a1398
19 changed files with 136 additions and 143 deletions

View File

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