fix: merge issues

This commit is contained in:
Andyyy7666
2023-12-10 19:07:06 +01:00
parent 72fb153cfc
commit d9df135abb
5 changed files with 0 additions and 228 deletions

View File

@@ -1,74 +0,0 @@
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
config = {
serverName = "Andy's Development",
characterLimit = 15, -- How many characters can a player create.
customPauseMenu = true, -- A custom pause menu will display your money, characters name and the server name in the pause menu.
enablePVP = true, -- pvp allows doing damage to other players.
-- Money related
startingCash = 2500, -- default cash the character will start with if the character creator doesn't specify it.
startingBank = 8000,-- default money in the bank account the character will start with if the character creator doesn't specify it.
-- If you'd like to whitelist certain roles on discord then set this to true and add role ids.
enableDiscordWhitelist = false,
notWhitelistedMessage = "You're not allowlisted in this server please join our discord to apply for a allowlist: https://discord.gg/Z9Mxu72zZ6",
whitelistRoles = {
"872921520719142932"
},
-- These are admins roles that will give a user permission to admin commands and more.
adminRoles = {
"872921520719142932"
},
-- Discord Rich presence
enableRichPresence = true,
updateIntervall = 60, -- how many seconds of delay until it updates status.
appId = 858146067018416128,
largeLogo = "andyyy",
smallLogo = "andyyy",
firstButtonName = "DISCORD",
firstButtonLink = "https://discord.gg/Z9Mxu72zZ6",
secondButtonName = "TEBEX",
secondButtonLink = "https://andyyy.tebex.io/category/fivem-scripts",
-- Groups can be gangs, jobs, subdivisions, etc.
groups = {
["Ballas"] = {
"Member", -- rank 1
"Boss" -- rank 2
},
["SWAT"] = {
"Member", -- rank 1
"Sniper", -- rank 2
"Team lead", -- rank 3
"Commander" -- rank 4
},
["SAHP"] = {
"Trooper",
"Senior Trooper",
"Corporal",
"Sergeant",
"Lieutenant",
"Cheif"
},
["LSPD"] = {
"Officer",
"Senior officer",
"Corporal",
"Sergeant",
"Lieutenant",
"Cheif"
},
["BCSO"] = {
"Deputy",
"Senior Deputy",
"Corporal",
"Sergeant",
"Lieutenant",
"Cheif"
}
},
}

View File

@@ -1,6 +0,0 @@
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
server_config = {
discordServerToken = "OTAwODg1MDMxMDQ2Nzc0ODQ1.GU1TSC.Ed8D2_wcU-UQ1vZhe1khahgV8J3hLahOp4N1D8", -- discord bot token for permissions
guildId = "872496972454592523", -- discord guild id
}

View File

@@ -1,117 +0,0 @@
-- For support join my discord: https://discord.gg/Z9Mxu72zZ6
-- Check if discord is connected, and if whitelist is enabled then it will only allow you to join if you have the roles.
AddEventHandler("playerConnecting", function(name, setKickReason, deferrals)
local player = source
local discordIdentifier = NDCore.Functions.GetPlayerIdentifierFromType("discord", player)
deferrals.defer()
Wait(0)
deferrals.update("Connecting to discord.")
Wait(0)
if not discordIdentifier then
deferrals.done("Your discord isn't connected to FiveM, make sure discord is open and restart FiveM.")
else
if config.enableDiscordWhitelist then
local discordUserId = discordIdentifier:gsub("discord:", "")
local discordInfo = NDCore.Functions.GetUserDiscordInfo(discordUserId)
for _, whitelistRole in pairs(config.whitelistRoles) do
if whitelistRole == 0 or whitelistRole == "0" or (discordInfo and discordInfo.roles[whitelistRole]) then
deferrals.done()
break
end
end
deferrals.done(config.notWhitelistedMessage)
else
deferrals.done()
end
end
end)
-- Getting all the characters the player has and returning them to the client.
RegisterNetEvent("ND:GetCharacters", function()
local player = source
TriggerClientEvent("ND:returnCharacters", player, NDCore.Functions.GetPlayerCharacters(player))
end)
-- Creating a new character.
RegisterNetEvent("ND:newCharacter", function(newCharacter)
local player = source
NDCore.Functions.CreateCharacter(player, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender, newCharacter.cash, newCharacter.bank)
end)
-- Update the character info when edited.
RegisterNetEvent("ND:editCharacter", function(newCharacter)
local player = source
local characters = NDCore.Functions.GetPlayerCharacters(player)
if not characters[newCharacter.id] then return end
NDCore.Functions.UpdateCharacterData(newCharacter.id, newCharacter.firstName, newCharacter.lastName, newCharacter.dob, newCharacter.gender)
end)
-- Delete character from database.
RegisterNetEvent("ND:deleteCharacter", function(characterId)
local player = source
local characters = NDCore.Functions.GetPlayerCharacters(player)
if not characters[characterId] then return end
NDCore.Functions.DeleteCharacter(characterId)
end)
-- add a player to the table.
RegisterNetEvent("ND:setCharacterOnline", function(id)
local player = source
local characters = NDCore.Functions.GetPlayerCharacters(player)
if not characters[id] then return end
NDCore.Functions.SetActiveCharacter(player, id)
end)
-- Update the characters clothes.
RegisterNetEvent("ND:updateClothes", function(clothing)
local player = source
local character = NDCore.Players[player]
NDCore.Functions.SetPlayerData(character.id, "clothing", clothing)
end)
-- Disconnecting a player
RegisterNetEvent("ND:exitGame", function()
local player = source
DropPlayer(player, "Disconnected.")
end)
-- Remove player from NDCore.Players table when they leave.
AddEventHandler("playerDropped", function()
local player = source
local character = NDCore.Players[player]
if character then
local ped = GetPlayerPed(player)
local lastLocation = GetEntityCoords(ped)
NDCore.Functions.UpdateLastLocation(character.id, {x = lastLocation.x, y = lastLocation.y, z = lastLocation.z})
end
TriggerEvent("ND:characterUnloaded", player, character)
character = nil
end)
-- Get player discord info on join.
AddEventHandler("playerJoining", function()
local src = source
local discordUserId = NDCore.Functions.GetPlayerIdentifierFromType("discord", src):gsub("discord:", "")
local discordInfo = NDCore.Functions.GetUserDiscordInfo(discordUserId)
NDCore.PlayersDiscordInfo[src] = discordInfo
end)
AddEventHandler("onResourceStart", function(resourceName)
if (GetCurrentResourceName() ~= resourceName) then
return
end
Wait(1000)
if not next(NDCore.PlayersDiscordInfo) then
for _, playerId in ipairs(GetPlayers()) do
local discordUserId = NDCore.Functions.GetPlayerIdentifierFromType("discord", playerId):gsub("discord:", "")
local discordInfo = NDCore.Functions.GetUserDiscordInfo(discordUserId)
NDCore.PlayersDiscordInfo[tonumber(playerId)] = discordInfo
end
end
end)

View File

@@ -1 +0,0 @@
NDCore = exports["ND_Core"]:GetCoreObject()

View File

@@ -1,30 +0,0 @@
local startedResources = {}
local callbacks = {}
AddEventHandler("onResourceStart", function(resourceName)
startedResources[resourceName] = true
local callback = callbacks[resourceName]
if not callback then return end
callback(true)
end)
AddEventHandler("onResourceStop", function(resourceName)
startedResources[resourceName] = nil
local callback = callbacks[resourceName]
if not callback then return end
callback(false)
end)
function isResourceStarted(resourceName, cb)
local started = GetResourceState(resourceName) == "started"
startedResources[resourceName] = started
if cb then
callbacks[resourceName] = cb
cb(started)
end
return started
end
exports("isResourceStarted", isResourceStarted)