mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +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
|
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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user