diff --git a/client/main.lua b/client/main.lua index 941b7f3..3909a19 100644 --- a/client/main.lua +++ b/client/main.lua @@ -57,6 +57,7 @@ function doRespawn() Citizen.Wait(10) end ESX.TriggerServerCallback('esx_nicedeath:onDeath', function() + isDead = false ESX.SetPlayerData('loadout', {}) RespawnPed(PlayerPedId(), Config.RespawnPoint.coords, Config.RespawnPoint.heading) StopScreenEffect('DeathFailOut') @@ -108,42 +109,30 @@ end function PlaySoundAndShowMessage() Citizen.CreateThread(function() - while isDead do - if not soundPlaying then - PlaySoundFrontend(-1, "Bed", "WastedSounds", 1) - soundPlaying = true - end - - local wastedMessage = RequestScaleformMovie("MP_BIG_MESSAGE_FREEMODE") - if HasScaleformMovieLoaded(wastedMessage) then - Citizen.Wait(0) + PlaySoundFrontend(-1, "Bed", "WastedSounds", 1) - PushScaleformMovieFunction(wastedMessage, "SHOW_SHARD_WASTED_MP_MESSAGE") - BeginTextComponent("STRING") - AddTextComponentString("~r~" .. _U('wasted')) - EndTextComponent() - PopScaleformMovieFunctionVoid() + local wastedMessage = RequestScaleformMovie("MP_BIG_MESSAGE_FREEMODE") - Citizen.Wait(500) + while not HasScaleformMovieLoaded(wastedMessage) do + Citizen.Wait(0) + end + PushScaleformMovieFunction(wastedMessage, "SHOW_SHARD_WASTED_MP_MESSAGE") + BeginTextComponent("STRING") + AddTextComponentString("~r~" .. _U('wasted')) + EndTextComponent() + PopScaleformMovieFunctionVoid() - PlaySoundFrontend(-1, "TextHit", "WastedSounds", 1) - while isDead do - DrawScaleformMovieFullscreen(wastedMessage, 255, 255, 255, 255) - Citizen.Wait(0) - end + Citizen.Wait(500) - soundPlaying = false - end + PlaySoundFrontend(-1, "TextHit", "WastedSounds", 1) + while isDead do + DrawScaleformMovieFullscreen(wastedMessage, 255, 255, 255, 255) + Citizen.Wait(0) end end) end ---- Respawn event handler -AddEventHandler('esx:onPlayerSpawn', function() - isDead = false -end) - --- Death event handler AddEventHandler('esx:onPlayerDeath', function(data) isDead = true