The necessary codes for New QBCore frameworks are as follows.
Incomplete or incorrect installation will result in a multicharacter error and will not save your new characters.
qb-multicharacter should be disabled or deprecated.
Visit this folder for the changes we will make.
qb-core/server/player.lua
Find the specified function
function QBCore.Player.Login(source, citizenid, newData)
Function should be found. else part of if citizenid then query should be opened
the function QBCore.Player.CheckPlayerData(source, newData) should be made as follows.
local required = QBCore.Player.CheckPlayerData(source, newData)
TriggerEvent('wais:sendNewCharacterData', required.source, required.cid, required.citizenid)
After pasting the code above, it should look like below.
function QBCore.Player.Login(source, citizenid, newData)
if source and source ~= '' then
if citizenid then
local license = QBCore.Functions.GetIdentifier(source, 'license')
local PlayerData = MySQL.prepare.await('SELECT * FROM players where citizenid = ?', { citizenid })
if PlayerData and license == PlayerData.license then
-- THESE PLACES ARE ACTUALLY FULL OF CODES
else
-- THESE PLACES ARE ACTUALLY FULL OF CODES
end
else
local required = QBCore.Player.CheckPlayerData(source, newData)
TriggerEvent('wais:sendNewCharacterData', required.source, required.cid, required.citizenid)
end
return true
else
-- THESE PLACES ARE ACTUALLY FULL OF CODES
return false
end
end
After this section is made as above, the following path should be followed.
function QBCore.Player.CreatePlayer(PlayerData, Offline) The specified function must be found and go to the last line of this function.
Then the following codes should be pasted
return Offline and self or {
source = PlayerData.source,
cid = PlayerData.cid,
citizenid = PlayerData.citizenid
}
After pasting the code above, it should look like below.
Only the return code content in the last line is important. Pay no attention to other lines of code.
function QBCore.Player.CreatePlayer(PlayerData, Offline)
local self = {}
self.Functions = {}
self.PlayerData = PlayerData
self.Offline = Offline
-- THESE PLACES ARE ACTUALLY FULL OF CODES
-- THESE PLACES ARE ACTUALLY FULL OF CODES
-- THESE PLACES ARE ACTUALLY FULL OF CODES
if self.Offline then
return self
else
QBCore.Players[self.PlayerData.source] = self
QBCore.Player.Save(self.PlayerData.source)
TriggerEvent('QBCore:Server:PlayerLoaded', self)
self.Functions.UpdatePlayerData()
end
return Offline and self or {
source = PlayerData.source,
cid = PlayerData.cid,
citizenid = PlayerData.citizenid
}
end