Skip to content

Commit ec41343

Browse files
solareongoogleoblivionmafewtm
authored
refactor(character): Use tutorial natives instead of manual bucket setting (#480)
* refactor(character): Use tutorial natives instead of manual bucket setting * fix: spacing --------- Co-authored-by: Robin Bird <googleoblivion@users.noreply.github.com> Co-authored-by: Matthew <22198949+mafewtm@users.noreply.github.com>
1 parent 52232c4 commit ec41343

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

client/character.lua

+5-2
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,11 @@ local function chooseCharacter()
369369
Wait(1000)
370370
SetEntityCoords(cache.ped, randomLocation.pedCoords.x, randomLocation.pedCoords.y, randomLocation.pedCoords.z, false, false, false, false)
371371
SetEntityHeading(cache.ped, randomLocation.pedCoords.w)
372-
---@diagnostic disable-next-line: missing-parameter
373-
lib.callback.await('qbx_core:server:setCharBucket')
372+
373+
if not NetworkIsInTutorialSession() then
374+
NetworkStartSoloTutorialSession()
375+
end
376+
374377
Wait(1500)
375378
ShutdownLoadingScreen()
376379
ShutdownLoadingScreenNui()

client/events.lua

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
88
NetworkSetFriendlyFireOption(true)
99
end
1010

11+
if NetworkIsInTutorialSession() then
12+
NetworkEndTutorialSession()
13+
end
14+
1115
local motd = GetConvar('qbx:motd', '')
1216
if motd ~= '' then
1317
exports.chat:addMessage({ template = motd })

server/character.lua

-9
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ lib.callback.register('qbx_core:server:loadCharacter', function(source, citizenI
4141
local success = Login(source, citizenId)
4242
if not success then return end
4343

44-
SetPlayerBucket(source, 0)
4544
logger.log({
4645
source = 'qbx_core',
4746
webhook = config.logging.webhook['joinleave'],
@@ -62,19 +61,11 @@ lib.callback.register('qbx_core:server:createCharacter', function(source, data)
6261
if not success then return end
6362

6463
giveStarterItems(source)
65-
if GetResourceState('qbx_spawn') == 'missing' then
66-
SetPlayerBucket(source, 0)
67-
end
6864

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

73-
lib.callback.register('qbx_core:server:setCharBucket', function(source)
74-
SetPlayerBucket(source, source)
75-
assert(GetPlayerRoutingBucket(source) == source, 'Multicharacter bucket not set.')
76-
end)
77-
7869
RegisterNetEvent('qbx_core:server:deleteCharacter', function(citizenId)
7970
local src = source
8071
DeleteCharacter(src --[[@as number]], citizenId)

0 commit comments

Comments
 (0)