diff --git a/ND_CharacterSelection/config.lua b/ND_CharacterSelection/config.lua deleted file mode 100644 index 3525c44..0000000 --- a/ND_CharacterSelection/config.lua +++ /dev/null @@ -1,66 +0,0 @@ --- For support join my discord: https://discord.gg/Z9Mxu72zZ6 - -config = { - changeCharacterCommand = "changecharacter", -- this is the command to open the ui again and change your character. - enableAppearance = true, -- you need to install fivem-appearance - characterSelectionAopDisplay = true, - aopExport = function() - return exports["SimpleHUD"]:getAOP() -- exports["ModernHUD"]:getAOP() - end, - - -- set your backgrounds, if you have more than 1 then it will randomly change everytime you open the ui. - backgrounds = { - "https://i.imgur.com/E51ckFx.png", -- Credits: Fuzzman270#0270 - "https://i.imgur.com/SeZD7TP.png", -- Credits: Fuzzman270#0270 - "https://i.imgur.com/ZWKfYD9.png" -- Credits: 2XRondo#6374 - }, - - departments = { -- these are the required discord role ids to be able to access these departments (enable developer mode in discord's advanced settings and right click the role) - ["CIV"] = {"0"}, - ["SAHP"] = {"0"}, - ["LSPD"] = {"0"}, - ["BCSO"] = {"872921520719142932"}, - ["LSFD"] = {"872921520719142932"} - }, - - departmentPaychecks = false, -- if you would like salaries to be paid out to the departments, set this to true - paycheckInterval = 24, -- this is how often (in minutes) paychecks are to be paid out if departmentPaychecks is set to true - departmentSalaries = { -- the amount given to the character per interval of time set via paycheckInterval - ["CIV"] = 300, - ["SAHP"] = 700, - ["LSPD"] = 600, - ["BCSO"] = 500, - ["LSFD"] = 650 - }, - - -- DEFAULT is the spawns that every character with any job will have but you can also add a job and spawns for them. - spawns = { - ["DEFAULT"] = { - {x = -102.78, y = 6336.28, z = 31.49, name = "Dream View Motel (Paleto Bay)"}, - {x = 343.53, y = 2636.94, z = 43.94, name = "Eastern Motel (Sandy Shores)"}, - {x = 196.96, y = -934.54, z = 29.69, name = "Legion Square"}, - {x = -1616.69, y = -1073.81, z = 12.15, name = "Del Perro Pier"}, - {x = -1039.65, y = -2741.02, z = 12.89, name = "LSIA"} - }, - ["SAHP"] = { - {x = -447.2, y = 6009.4, z = 30.72, name = "Paleto Bay Sheriff"}, - {x = 1849.4, y = 3688.6, z = 33.27, name = "Sandy Shores Sheriff"}, - {x = 437.6, y = -986.6, z = 29.69, name = "Mission Row PD"} - }, - ["LSPD"] = { - {x = -447.2, y = 6009.4, z = 30.72, name = "Paleto Bay Sheriff"}, - {x = 1849.4, y = 3688.6, z = 33.27, name = "Sandy Shores Sheriff"}, - {x = 437.6, y = -986.6, z = 29.69, name = "Mission Row PD"} - }, - ["BCSO"] = { - {x = -447.2, y = 6009.4, z = 30.72, name = "Paleto Bay Sheriff"}, - {x = 1849.4, y = 3688.6, z = 33.27, name = "Sandy Shores Sheriff"}, - {x = 437.6, y = -986.6, z = 29.69, name = "Mission Row Police "} - }, - ["LSFD"] = { - {x = -384.07, y = 6117.9, z = 30.48, name = "Fire Station No1 (Paleto Bay)"}, - {x = 1691.5, y = 3597.95, z = 34.56, name = "Fire Station No2 (Sandy Shores)"}, - {x = 1194.71, y = -1474.14, z = 33.86, name = "Fire Station No7 (Los Santos)"} - }, - } -} diff --git a/ND_CharacterSelection/fxmanifest.lua b/ND_CharacterSelection/fxmanifest.lua deleted file mode 100644 index f445401..0000000 --- a/ND_CharacterSelection/fxmanifest.lua +++ /dev/null @@ -1,25 +0,0 @@ --- For support join my discord: https://discord.gg/Z9Mxu72zZ6 - -author "Andyyy#7666, N1K0#0001" -description "ND Character Selection (DOJ Based)" -version "2.3.0" - -fx_version "cerulean" -game "gta5" -lua54 "yes" - -files { - "source/ui/index.html", - "source/ui/script.js", - "source/ui/style.css" -} -ui_page "source/ui/index.html" - -shared_script "config.lua" -server_script "source/server.lua" -client_script "source/client.lua" - -dependencies { - "ND_Core", - -- "fivem-appearance" [TODO] to be implemented properly later -} diff --git a/ND_CharacterSelection/source/client.lua b/ND_CharacterSelection/source/client.lua deleted file mode 100644 index 1f614e7..0000000 --- a/ND_CharacterSelection/source/client.lua +++ /dev/null @@ -1,262 +0,0 @@ --- For support join my discord: https://discord.gg/Z9Mxu72zZ6 - -NDCore = exports["ND_Core"]:GetCoreObject() -local changeAppearence = false -local started = false -local firstSpawn = true - -function startChangeAppearence() - local config = { - ped = true, - headBlend = true, - faceFeatures = true, - headOverlays = true, - components = true, - props = true, - tattoos = false - } - - exports["fivem-appearance"]:startPlayerCustomization(function(appearance) - if appearance then - local ped = PlayerPedId() - local clothing = { - model = GetEntityModel(ped), - tattoos = exports["fivem-appearance"]:getPedTattoos(ped), - appearance = exports["fivem-appearance"]:getPedAppearance(ped) - } - Wait(4000) - TriggerServerEvent("ND:updateClothes", clothing) - else - start(true) - end - changeAppearence = false - end, config) -end - --- Set the player to creating the ped if they haven't already. -function setCharacterClothes(character) - if config.enableAppearance then - if not character.clothing or next(character.clothing) == nil then - changeAppearence = true - else - changeAppearence = false - exports["fivem-appearance"]:setPlayerModel(character.clothing.model) - local ped = PlayerPedId() - exports["fivem-appearance"]:setPedTattoos(ped, character.clothing.tattoos) - exports["fivem-appearance"]:setPedAppearance(ped, character.clothing.appearance) - end - end -end - -function tablelength(table) - local count = 0 - for _ in pairs(table) do - count = count + 1 - end - return count -end - -function SetDisplay(bool, typeName, bg, characters) - local characterAmount = characters - if not characterAmount then - characterAmount = NDCore.Functions.GetCharacters() - end - if not bg then - background = config.backgrounds[math.random(1, #config.backgrounds)] - end - SetNuiFocus(bool, bool) - SendNUIMessage({ - type = typeName, - background = background, - status = bool, - serverName = NDCore.Config.serverName, - characterAmount = tablelength(characterAmount) .. "/" .. NDCore.Config.characterLimit - }) - Wait(500) - if config.characterSelectionAopDisplay then - SendNUIMessage({ - type = "aop", - aop = config.aopExport() - }) - end -end - -function start(switch) - TriggerServerEvent("ND:GetCharacters") - if not started then - TriggerServerEvent("ND_CharacterSelection:checkPerms") - started = true - end - if switch then - local ped = PlayerPedId() - SwitchOutPlayer(ped, 0, 1) - FreezeEntityPosition(ped, true) - SetEntityVisible(ped, false, 0) - end - if config.characterSelectionAopDisplay then - SendNUIMessage({ - type = "aop", - aop = config.aopExport() - }) - end -end - -AddEventHandler("onResourceStart", function(resourceName) - if (GetCurrentResourceName() ~= resourceName) then - return - end - Wait(2000) - start(false) -end) - -AddEventHandler("playerSpawned", function() - start(true) -end) - --- This is used to add department drop down on the ui. -RegisterNetEvent("ND_CharacterSelection:permsChecked", function(allowedRoles) - SendNUIMessage({ - type = "givePerms", - deptRoles = json.encode(allowedRoles) - }) -end) - --- Gets all the characters and displays them on the ui. -RegisterNetEvent("ND:returnCharacters", function(characters) - local playerCharacters = {} - for id, characterInfo in pairs(characters) do - playerCharacters[tostring(id)] = characterInfo - end - SendNUIMessage({ - type = "refresh", - characters = json.encode(playerCharacters) - }) - SetDisplay(true, "ui", background, characters) -end) - --- Selecting a player from the iu. -RegisterNUICallback("setMainCharacter", function(data) - local characters = NDCore.Functions.GetCharacters() - local defaultSpawns = config.spawns["DEFAULT"] - local jobSpawns = config.spawns[characters[data.id].job] - local spawns = {} - for _, spawn in pairs(defaultSpawns) do - spawns[#spawns + 1] = spawn - end - if jobSpawns then - for _, newSpawn in pairs(jobSpawns) do - spawns[#spawns + 1] = newSpawn - end - end - SendNUIMessage({ - type = "setSpawns", - spawns = json.encode(spawns), - id = characters[data.id].id - }) - Wait(1000) - TriggerServerEvent("ND:setCharacterOnline", data.id) -end) - --- Creating a character from the ui. -RegisterNUICallback("newCharacter", function(data) - if tablelength(NDCore.Characters) < NDCore.Config.characterLimit then - TriggerServerEvent("ND_CharacterSelection:newCharacter", { - firstName = data.firstName, - lastName = data.lastName, - dob = data.dateOfBirth, - gender = data.gender, - twt = data.twtName, - job = data.department, - cash = data.startingCash, - bank = data.startingBank - }) - end -end) - --- editing a character from the ui. -RegisterNUICallback("editCharacter", function(data) - TriggerServerEvent("ND_CharacterSelection:editCharacter", { - id = data.id, - firstName = data.firstName, - lastName = data.lastName, - dob = data.dateOfBirth, - gender = data.gender, - twt = data.twtName, - job = data.department - }) -end) - --- deleting a character from the ui. -RegisterNUICallback("delCharacter", function(data) - TriggerServerEvent("ND:deleteCharacter", data.character) -end) - --- Quit button from ui. -RegisterNUICallback("exitGame", function() - TriggerServerEvent("ND:exitGame") -end) - --- Teleporting using ui. -RegisterNUICallback("tpToLocation", function(data) - local ped = PlayerPedId() - SetEntityCoords(ped, tonumber(data.x), tonumber(data.y), tonumber(data.z), false, false, false, false) - FreezeEntityPosition(ped, true) - SwitchInPlayer(ped) - Wait(500) - SetDisplay(false, "ui") - Wait(500) - FreezeEntityPosition(ped, false) - SetEntityVisible(ped, true, 0) - setCharacterClothes(NDCore.Functions.GetSelectedCharacter()) - if config.enableAppearance and changeAppearence then - startChangeAppearence() - end - if firstSpawn then - firstSpawn = false - SendNUIMessage({ - type = "firstSpawn" - }) - end -end) - --- Choosing the do not tp button. -RegisterNUICallback("tpDoNot", function(data) - local ped = PlayerPedId() - if firstSpawn then - local character = NDCore.Functions.GetCharacters()[data.id] - if character.lastLocation and next(character.lastLocation) ~= nil then - SetEntityCoords(ped, character.lastLocation.x, character.lastLocation.y, character.lastLocation.z, false, false, false, false) - FreezeEntityPosition(ped, true) - end - firstSpawn = false - SendNUIMessage({ - type = "firstSpawn" - }) - else - FreezeEntityPosition(ped, true) - end - SwitchInPlayer(ped) - Wait(500) - SetDisplay(false, "ui") - Wait(500) - SetEntityVisible(ped, true, 0) - FreezeEntityPosition(ped, false) - Wait(100) - setCharacterClothes(NDCore.Functions.GetSelectedCharacter()) - if config.enableAppearance and changeAppearence then - startChangeAppearence() - end -end) - --- Change character command -RegisterCommand(config.changeCharacterCommand, function() - local ped = PlayerPedId() - SwitchOutPlayer(ped, 0, 1) - Wait(2000) - FreezeEntityPosition(ped, true) - SetEntityVisible(ped, false, 0) - SetDisplay(true, "ui") -end, false) - --- chat suggestions -TriggerEvent("chat:addSuggestion", "/" .. config.changeCharacterCommand, "Switch your framework character.") diff --git a/ND_CharacterSelection/source/server.lua b/ND_CharacterSelection/source/server.lua deleted file mode 100644 index 7822639..0000000 --- a/ND_CharacterSelection/source/server.lua +++ /dev/null @@ -1,83 +0,0 @@ --- For support join my discord: https://discord.gg/Z9Mxu72zZ6 - -NDCore = exports["ND_Core"]:GetCoreObject() - -function validateDepartment(player, department) - local departmentExists = config.departments[department] - if departmentExists then - local discordUserId = NDCore.Functions.GetPlayerIdentifierFromType("discord", player):gsub("discord:", "") - local discordInfo = NDCore.Functions.GetUserDiscordInfo(discordUserId) - - -- validate that the player actually has the role that they selected on the client. - for _, roleId in pairs(departmentExists) do - if roleId == 0 or roleId == "0" or (discordInfo and discordInfo.roles[roleId]) then - return true - end - end - end - return false -end - --- Creating a new character. -RegisterNetEvent("ND_CharacterSelection:newCharacter", function(newCharacter) - local player = source - - -- validate that the person has permission to use the department. - local departmentCheck = validateDepartment(player, newCharacter.job) - 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) -end) - --- Update the character info when edited. -RegisterNetEvent("ND_CharacterSelection:editCharacter", function(newCharacter) - local player = source - - -- check if player owns the character. - local characters = NDCore.Functions.GetPlayerCharacters(player) - if not characters[newCharacter.id] then return end - - -- validate that the person has permission to use the department. - local departmentCheck = validateDepartment(player, newCharacter.job) - 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) - - -- Updating characters on the client. - TriggerClientEvent("ND:returnCharacters", player, NDCore.Functions.GetPlayerCharacters(player)) -end) - -RegisterNetEvent("ND_CharacterSelection:checkPerms", function() - local player = source - local discordUserId = NDCore.Functions.GetPlayerIdentifierFromType("discord", player):gsub("discord:", "") - local allowedRoles = {} - local discordInfo = NDCore.Functions.GetUserDiscordInfo(discordUserId) - - -- Check if the players discord roles will grant them permission to the department. - for dept, roleTable in pairs(config.departments) do - for _, roleId in pairs(roleTable) do - if roleId == 0 or roleId == "0" or (discordInfo and discordInfo.roles[roleId]) then - table.insert(allowedRoles, dept) - end - end - end - TriggerClientEvent("ND_CharacterSelection:permsChecked", player, allowedRoles) -end) - -if config.departmentPaychecks then - CreateThread(function() - while true do - Wait(config.paycheckInterval * 60000) - for player, playerInfo in pairs(NDCore.Functions.GetPlayers()) do - local salary = config.departmentSalaries[playerInfo.job] - NDCore.Functions.AddMoney(salary, player, "bank") - TriggerClientEvent("chat:addMessage", player, { - color = {0, 255, 0}, - args = {"Salary", "Received $" .. salary .. "."} - }) - end - end - end) -end diff --git a/ND_CharacterSelection/source/ui/index.html b/ND_CharacterSelection/source/ui/index.html deleted file mode 100644 index f66e469..0000000 --- a/ND_CharacterSelection/source/ui/index.html +++ /dev/null @@ -1,166 +0,0 @@ - - -
- - - - - - - - -
- Select or create a character:
- - -Are you sure you'd like to quit the game?
-Are you sure you'd like to delete this character?
-