Skip to content
This repository has been archived by the owner on Oct 3, 2024. It is now read-only.

Commit

Permalink
fix crash
Browse files Browse the repository at this point in the history
  • Loading branch information
lfuelling committed May 9, 2020
1 parent f30e9a8 commit 9e65ef7
Showing 1 changed file with 16 additions and 27 deletions.
43 changes: 16 additions & 27 deletions client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 9e65ef7

Please sign in to comment.