💡Old QBCore Adapt

The necessary codes for old 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


  • 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

TriggerEvent('wais:sendNewCharacterData', PlayerData.source, PlayerData.cid, PlayerData.citizenid)

After pasting the code above, it should look like below.

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

    self.Functions.Save = function()
        QBCore.Player.Save(self.PlayerData.source)
    end

    QBCore.Players[self.PlayerData.source] = self
    QBCore.Player.Save(self.PlayerData.source)

    -- At this point we are safe to emit new instance to third party resource for load handling
    TriggerEvent('QBCore:Server:PlayerLoaded', self)
    self.Functions.UpdatePlayerData()
    TriggerEvent('wais:sendNewCharacterData', PlayerData.source, PlayerData.cid, PlayerData.citizenid)
end

If you have a newer player lua file it should look like below.

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)

        -- At this point we are safe to emit new instance to third party resource for load handling
        TriggerEvent('QBCore:Server:PlayerLoaded', self)
        self.Functions.UpdatePlayerData()
    end

    TriggerEvent('wais:sendNewCharacterData', PlayerData.source, PlayerData.cid, PlayerData.citizenid)
end

Last updated