mirror of
https://github.com/ND-Framework/ND_Core.git
synced 2026-08-17 05:56:01 +01:00
update: events and checks
This commit is contained in:
@@ -1,21 +1,30 @@
|
||||
RegisterNetEvent("ND:returnCharacters", function(characters)
|
||||
NDCore.Characters = characters
|
||||
end)
|
||||
|
||||
-- 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:setCharacter", function(character)
|
||||
NDCore.player = 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)
|
||||
NDCore.player = character
|
||||
if not NDCore.player then return end
|
||||
NDCore.player = removeCharacterFunctions(character)
|
||||
end)
|
||||
|
||||
-- Updates last lcoation.
|
||||
@@ -23,10 +32,3 @@ RegisterNetEvent("ND:updateLastLocation", function(location)
|
||||
if not NDCore.player then return end
|
||||
NDCore.player.lastLocation = location
|
||||
end)
|
||||
|
||||
-- Enable pvp for players.
|
||||
AddEventHandler("playerSpawned", function()
|
||||
print("^0ND Framework support discord: ^5https://discord.gg/Z9Mxu72zZ6")
|
||||
SetCanAttackFriendly(PlayerPedId(), true, false)
|
||||
NetworkSetFriendlyFireOption(true)
|
||||
end)
|
||||
|
||||
Reference in New Issue
Block a user