mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-16 21:46:03 +01:00
feat(server): set character if not using multi character
This commit is contained in:
@@ -88,6 +88,10 @@ function NDCore.getDiscordInfo(discordUserId)
|
||||
return data
|
||||
end
|
||||
|
||||
function NDCore.enableMultiCharacter(enable)
|
||||
Config.multiCharacter = enable
|
||||
end
|
||||
|
||||
for name, func in pairs(NDCore) do
|
||||
if type(func) == "function" then
|
||||
exports(name, func)
|
||||
|
||||
@@ -21,7 +21,8 @@ Config = {
|
||||
disableVehicleAirControl = GetConvarInt("core:disableVehicleAirControl", 1) == 1,
|
||||
useInventoryForKeys = GetConvarInt("core:useInventoryForKeys", 1) == 1,
|
||||
groups = json.decode(GetConvar("core:groups", "[]")),
|
||||
admins = json.decode(GetConvar("core:admins", "[]"))
|
||||
admins = json.decode(GetConvar("core:admins", "[]")),
|
||||
multiCharacter = false
|
||||
}
|
||||
|
||||
SetConvarServerInfo("Discord", Config.discordInvite)
|
||||
@@ -45,6 +46,23 @@ AddEventHandler("playerJoining", function(oldId)
|
||||
local src = source
|
||||
PlayersInfo[src] = tempPlayersInfo[oldId]
|
||||
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)
|
||||
|
||||
local function checkDiscordIdentifier(identifiers)
|
||||
|
||||
Reference in New Issue
Block a user