Skip to content

Commit

Permalink
Merge pull request #31 from Uniixx/main
Browse files Browse the repository at this point in the history
Fix looping music #30
  • Loading branch information
marcostom32 authored Nov 8, 2023
2 parents 172cee9 + c7db34d commit d2d67ff
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ end)

RegisterNUICallback('closeUI', function(_, cb)
openCharMenu(false)
SendNUIMessage({
action = "stopMusic"
})
cb("ok")
end)

Expand All @@ -121,8 +124,12 @@ end)
RegisterNUICallback('selectCharacter', function(data, cb)
local cData = data.cData
DoScreenFadeOut(10)
cData.isNew = false
TriggerServerEvent('qb-multicharacter:server:loadUserData', cData)
openCharMenu(false)
SendNUIMessage({
action = "stopMusic"
})
SetEntityAsMissionEntity(charPed, true, true)
DeleteEntity(charPed)
cb("ok")
Expand Down Expand Up @@ -239,7 +246,11 @@ RegisterNUICallback('createNewCharacter', function(data, cb)
elseif cData.gender == Lang:t("ui.female") then
cData.gender = 1
end
cData.isNew = true
TriggerServerEvent('qb-multicharacter:server:createCharacter', cData)
SendNUIMessage({
action = "stopMusic"
})
Wait(500)
cb("ok")
end)
Expand Down
2 changes: 1 addition & 1 deletion server/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ RegisterNetEvent('qb-multicharacter:server:createCharacter', function(data)
repeat
Wait(10)
until hasDonePreloading[src]
if Apartments.Starting then
if data.isNew then
local randbucket = (GetPlayerPed(src) .. math.random(1,999))
SetPlayerRoutingBucket(src, randbucket)
print('^2[qb-core]^7 '..GetPlayerName(src)..' has succesfully loaded!')
Expand Down

0 comments on commit d2d67ff

Please sign in to comment.