2022-10-04 00:31:22 +02:00
|
|
|
-- updates the money on the client.
|
|
|
|
|
RegisterNetEvent("ND:updateMoney", function(cash, bank)
|
2023-07-13 01:22:24 +02:00
|
|
|
if not NDCore.player then return end
|
2023-07-09 03:07:46 +02:00
|
|
|
NDCore.player.cash = cash
|
|
|
|
|
NDCore.player.bank = bank
|
2022-10-04 00:31:22 +02:00
|
|
|
end)
|
|
|
|
|
|
2023-07-13 01:22:24 +02:00
|
|
|
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
|
|
|
|
|
|
2022-10-04 00:31:22 +02:00
|
|
|
-- Sets main character.
|
2023-07-13 01:22:24 +02:00
|
|
|
RegisterNetEvent("ND:characterLoaded", function(character)
|
|
|
|
|
NDCore.player = removeCharacterFunctions(character)
|
2022-10-04 00:31:22 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- Update main character info.
|
|
|
|
|
RegisterNetEvent("ND:updateCharacter", function(character)
|
2023-07-13 01:22:24 +02:00
|
|
|
NDCore.player = removeCharacterFunctions(character)
|
2022-10-04 00:31:22 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- Updates last lcoation.
|
|
|
|
|
RegisterNetEvent("ND:updateLastLocation", function(location)
|
2023-07-09 03:07:46 +02:00
|
|
|
if not NDCore.player then return end
|
|
|
|
|
NDCore.player.lastLocation = location
|
2022-10-04 00:31:22 +02:00
|
|
|
end)
|