tweak: remove character functions on server

This commit is contained in:
Andyyy7666
2023-09-24 04:45:37 +02:00
parent 82bc4c6d6b
commit 7a97816570
2 changed files with 22 additions and 18 deletions

View File

@@ -5,24 +5,14 @@ RegisterNetEvent("ND:updateMoney", function(cash, bank)
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)
NDCore.player = character
end)
-- Update main character info.
RegisterNetEvent("ND:updateCharacter", function(character)
NDCore.player = removeCharacterFunctions(character)
NDCore.player = character
end)
-- Updates last lcoation.
@@ -30,3 +20,7 @@ RegisterNetEvent("ND:updateLastLocation", function(location)
if not NDCore.player then return end
NDCore.player.lastLocation = location
end)
RegisterNetEvent("ND:revivePlayer", function()
NDCore.revivePlayer(true)
end)