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:
@@ -19,8 +19,8 @@ function SetDisplay(bool, typeName, bg)
|
||||
type = typeName,
|
||||
background = background,
|
||||
status = bool,
|
||||
serverName = NDCore.config.serverName,
|
||||
characterAmount = tablelength(NDCore.characters) .. "/" .. NDCore.config.characterLimit
|
||||
serverName = NDCore.Config.serverName,
|
||||
characterAmount = tablelength(NDCore.characters) .. "/" .. NDCore.Config.characterLimit
|
||||
})
|
||||
if config.characterSelectionAopDisplay then
|
||||
SendNUIMessage({
|
||||
@@ -32,7 +32,7 @@ end
|
||||
|
||||
function start(switch)
|
||||
TriggerServerEvent("ND_CharacterSelection:checkPerms")
|
||||
TriggerServerEvent("ND:getCharacters")
|
||||
TriggerServerEvent("ND:GetCharacters")
|
||||
if switch then
|
||||
local ped = PlayerPedId()
|
||||
SwitchOutPlayer(ped, 0, 1)
|
||||
@@ -41,8 +41,8 @@ function start(switch)
|
||||
end
|
||||
SendNUIMessage({
|
||||
type = "onStart",
|
||||
maxStartingBank = NDCore.config.startingBank,
|
||||
maxStartingCash = NDCore.config.startingCash
|
||||
maxStartingBank = NDCore.Config.startingBank,
|
||||
maxStartingCash = NDCore.Config.startingCash
|
||||
})
|
||||
if config.characterSelectionAopDisplay then
|
||||
SendNUIMessage({
|
||||
@@ -100,10 +100,10 @@ end)
|
||||
|
||||
-- Selecting a player from the iu.
|
||||
RegisterNUICallback("setMainCharacter", function(data)
|
||||
NDCore.functions:getCharacters(function(characters)
|
||||
NDCore.selectedCharacter = characters[data.id]
|
||||
NDCore.Functions.GetCharacters(function(characters)
|
||||
NDCore.SelectedCharacter = characters[data.id]
|
||||
end)
|
||||
for _, spawn in pairs(config.spawns[NDCore.selectedCharacter.job]) do
|
||||
for _, spawn in pairs(config.spawns[NDCore.SelectedCharacter.job]) do
|
||||
SendNUIMessage({
|
||||
type = "setSpawns",
|
||||
x = spawn.x,
|
||||
@@ -112,12 +112,12 @@ RegisterNUICallback("setMainCharacter", function(data)
|
||||
name = spawn.name
|
||||
})
|
||||
end
|
||||
TriggerServerEvent("ND:setCharacterOnline", NDCore.selectedCharacter.id)
|
||||
TriggerServerEvent("ND:setCharacterOnline", NDCore.SelectedCharacter.id)
|
||||
end)
|
||||
|
||||
-- Creating a character from the ui.
|
||||
RegisterNUICallback("newCharacter", function(data)
|
||||
if tablelength(NDCore.characters) < NDCore.config.characterLimit then
|
||||
if tablelength(NDCore.characters) < NDCore.Config.characterLimit then
|
||||
TriggerServerEvent("ND_CharacterSelection:newCharacter", {
|
||||
firstName = data.firstName,
|
||||
lastName = data.lastName,
|
||||
|
||||
@@ -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