feat(server): set character if not using multi character

This commit is contained in:
Andyyy7666
2023-10-16 00:28:36 +02:00
parent b8bb98b20d
commit a3279ea5c8
2 changed files with 23 additions and 1 deletions

View File

@@ -88,6 +88,10 @@ function NDCore.getDiscordInfo(discordUserId)
return data return data
end end
function NDCore.enableMultiCharacter(enable)
Config.multiCharacter = enable
end
for name, func in pairs(NDCore) do for name, func in pairs(NDCore) do
if type(func) == "function" then if type(func) == "function" then
exports(name, func) exports(name, func)

View File

@@ -21,7 +21,8 @@ Config = {
disableVehicleAirControl = GetConvarInt("core:disableVehicleAirControl", 1) == 1, disableVehicleAirControl = GetConvarInt("core:disableVehicleAirControl", 1) == 1,
useInventoryForKeys = GetConvarInt("core:useInventoryForKeys", 1) == 1, useInventoryForKeys = GetConvarInt("core:useInventoryForKeys", 1) == 1,
groups = json.decode(GetConvar("core:groups", "[]")), groups = json.decode(GetConvar("core:groups", "[]")),
admins = json.decode(GetConvar("core:admins", "[]")) admins = json.decode(GetConvar("core:admins", "[]")),
multiCharacter = false
} }
SetConvarServerInfo("Discord", Config.discordInvite) SetConvarServerInfo("Discord", Config.discordInvite)
@@ -45,6 +46,23 @@ AddEventHandler("playerJoining", function(oldId)
local src = source local src = source
PlayersInfo[src] = tempPlayersInfo[oldId] PlayersInfo[src] = tempPlayersInfo[oldId]
tempPlayersInfo[oldId] = nil tempPlayersInfo[oldId] = nil
if Config.multiCharacter then return end
Wait(3000)
local characters = NDCore.fetchAllCharacters(src)
local id = next(characters)
if id then
return NDCore.setActiveCharacter(src, id)
end
local player = NDCore.newCharacter(src, {
firstname = GetPlayerName(src),
lastname = "",
dob = "",
gender = ""
})
NDCore.setActiveCharacter(src, player.id)
end) end)
local function checkDiscordIdentifier(identifiers) local function checkDiscordIdentifier(identifiers)