mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-16 21:46:03 +01:00
35 lines
972 B
Lua
35 lines
972 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)
|
|
if not NDCore.player then return end
|
|
NDCore.player = removeCharacterFunctions(character)
|
|
end)
|
|
|
|
-- Update main character info.
|
|
RegisterNetEvent("ND:updateCharacter", function(character)
|
|
if not NDCore.player then return end
|
|
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)
|