Files
ND_Core/client/events.lua
2023-07-16 12:28:54 +02:00

33 lines
890 B
Lua

-- updates the money on the client.
RegisterNetEvent("ND:updateMoney", function(cash, bank)
if not NDCore.player then return end
NDCore.player.cash = cash
NDCore.player.bank = bank
end)
local function removeCharacterFunctions(character)
local newData = {}
for k, v in pairs(character) do
if type(v) ~= "function" then
newData[k] = v
end
end
return newData
end
-- Sets main character.
RegisterNetEvent("ND:characterLoaded", function(character)
NDCore.player = removeCharacterFunctions(character)
end)
-- Update main character info.
RegisterNetEvent("ND:updateCharacter", function(character)
NDCore.player = removeCharacterFunctions(character)
end)
-- Updates last lcoation.
RegisterNetEvent("ND:updateLastLocation", function(location)
if not NDCore.player then return end
NDCore.player.lastLocation = location
end)