in first sorry for my bad English
guys , i have a warzone script for fivem , everything is ok , like enter battle , exit battle , counting and … you know everything is ok BUT
if player want to disconnect the server OR Close the game (ALT+F4) The source CANT detect that player is not in the battle and wont count as a EXITED player , still count as a live player in battle
SO , in client , i have a OnResourseStop
AddEventHandler("onResourceStop", function(resource) if resource == GetCurrentResourceName() then for k, v in pairs(itemObj) do ESX.Game.DeleteObject(v) end TriggerServerEvent('pmc-battleroyale:leave:game', source) TriggerEvent('DiscordBot:ToDiscord', 'warzone', 'WarZone' , "```css\n" .. GetPlayerName(PlayerPedId()) .. " ALT+F4\n```",'user', source, true, false) SetEntityAsMissionEntity(pilot, false, true) DeleteEntity(pilot) SetEntityAsMissionEntity(aircraft, false, true) DeleteEntity(aircraft) DeleteEntity(parachute) DeleteEntity(crate) RemovePickup(pickup) RemoveBlip(blip) StopSound(soundID) ReleaseSoundId(soundID) for i = 1, #requiredModels do Wait(0) SetModelAsNoLongerNeeded(GetHashKey(requiredModels[i])) end end end)
I think that is saying , if anyway player left the battle , SOURCE get STOP for him
but nothing happend !!!
PLEASE HELP ME , TNX