Skip to content

Commit

Permalink
Revert "refactor(character): Use tutorial natives instead of manual b…
Browse files Browse the repository at this point in the history
…ucket se…"

This reverts commit b26bd2c.
  • Loading branch information
Manason committed Jun 5, 2024
1 parent cb4eca3 commit 2dfa60b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 2 additions & 6 deletions client/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,6 @@ local function spawnDefault() -- We use a callback to make the server wait on th
Wait(0)
end

NetworkEndTutorialSession()

destroyPreviewCam()

pcall(function() exports.spawnmanager:spawnPlayer({
Expand Down Expand Up @@ -298,8 +296,6 @@ local function spawnLastLocation()
Wait(0)
end

NetworkEndTutorialSession()

destroyPreviewCam()

pcall(function() exports.spawnmanager:spawnPlayer({
Expand Down Expand Up @@ -377,7 +373,8 @@ local function chooseCharacter()
Wait(1000)
SetEntityCoords(cache.ped, randomLocation.pedCoords.x, randomLocation.pedCoords.y, randomLocation.pedCoords.z, false, false, false, false)
SetEntityHeading(cache.ped, randomLocation.pedCoords.w)
NetworkStartSoloTutorialSession()
---@diagnostic disable-next-line: missing-parameter
lib.callback('qbx_core:server:setCharBucket', false)
Wait(1500)
ShutdownLoadingScreen()
ShutdownLoadingScreenNui()
Expand Down Expand Up @@ -488,7 +485,6 @@ RegisterNetEvent('qbx_core:client:spawnNoApartments', function() -- This event i
Wait(500)
destroyPreviewCam()
SetEntityVisible(cache.ped, true, false)
NetworkEndTutorialSession()
Wait(500)
DoScreenFadeIn(250)
TriggerServerEvent('QBCore:Server:OnPlayerLoaded')
Expand Down
9 changes: 9 additions & 0 deletions server/character.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ lib.callback.register('qbx_core:server:loadCharacter', function(source, citizenI
local success = Login(source, citizenId)
if not success then return end

SetPlayerBucket(source, 0)
logger.log({
source = 'qbx_core',
webhook = config.logging.webhook['joinleave'],
Expand All @@ -67,11 +68,19 @@ lib.callback.register('qbx_core:server:createCharacter', function(source, data)
if not success then return end

giveStarterItems(source)
if GetResourceState('qbx_spawn') == 'missing' then
SetPlayerBucket(source, 0)
end

lib.print.info(('%s has created a character'):format(GetPlayerName(source)))
return newData
end)

lib.callback.register('qbx_core:server:setCharBucket', function(source)
SetPlayerBucket(source, source)
assert(GetPlayerRoutingBucket(source) == source, 'Multicharacter bucket not set.')
end)

RegisterNetEvent('qbx_core:server:deleteCharacter', function(citizenId)
local src = source
DeleteCharacter(src --[[@as number]], citizenId)
Expand Down

0 comments on commit 2dfa60b

Please sign in to comment.