feat(client/events): event reliablity

This commit is contained in:
Andyyy7666
2026-03-16 05:36:53 +01:00
parent 3d5c1c32bb
commit 075fb087f2

View File

@@ -4,27 +4,35 @@ end)
-- updates the money on the client. -- updates the money on the client.
RegisterNetEvent("ND:updateMoney", function(cash, bank) RegisterNetEvent("ND:updateMoney", function(cash, bank)
if not NDCore.player then return end if source == "" or not NDCore.player then return end
NDCore.player.cash = cash NDCore.player.cash = cash
NDCore.player.bank = bank NDCore.player.bank = bank
end) end)
-- Sets main character. -- Sets main character.
RegisterNetEvent("ND:characterLoaded", function(character) RegisterNetEvent("ND:characterLoaded", function(character)
if source == "" then return end
NDCore.player = character NDCore.player = character
end) end)
-- Update main character info. -- Update main character info.
RegisterNetEvent("ND:updateCharacter", function(character) RegisterNetEvent("ND:updateCharacter", function(character)
if source == "" or not NDCore.player then return end
NDCore.player = character NDCore.player = character
end) end)
-- Updates last lcoation. -- Updates last lcoation.
RegisterNetEvent("ND:updateLastLocation", function(location) RegisterNetEvent("ND:updateLastLocation", function(location)
if not NDCore.player then return end if source == "" or not NDCore.player then return end
NDCore.player.lastLocation = location NDCore.player.lastLocation = location
end) end)
-- Unsets main character.
RegisterNetEvent("ND:characterUnloaded", function()
if source == "" or not NDCore.player then return end
NDCore.player = nil
end)
RegisterNetEvent("ND:revivePlayer", function() RegisterNetEvent("ND:revivePlayer", function()
if source == "" then return end if source == "" then return end
local oldPed = cache.ped local oldPed = cache.ped
@@ -57,8 +65,6 @@ RegisterNetEvent("ND:revivePlayer", function()
end end
end) end)
RegisterNetEvent("ND:characterUnloaded")
RegisterNetEvent("ND:clothingMenu", function() RegisterNetEvent("ND:clothingMenu", function()
if GetResourceState("fivem-appearance") ~= "started" then return end if GetResourceState("fivem-appearance") ~= "started" then return end