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)
|
|
|
|
|
|
|
|
|
|
-- Sets main character.
|
2023-07-13 01:22:24 +02:00
|
|
|
RegisterNetEvent("ND:characterLoaded", function(character)
|
2023-09-24 04:45:37 +02:00
|
|
|
NDCore.player = character
|
2022-10-04 00:31:22 +02:00
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
-- Update main character info.
|
|
|
|
|
RegisterNetEvent("ND:updateCharacter", function(character)
|
2023-09-24 04:45:37 +02:00
|
|
|
NDCore.player = 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)
|
2023-09-24 04:45:37 +02:00
|
|
|
|
|
|
|
|
RegisterNetEvent("ND:revivePlayer", function()
|
2024-02-12 23:27:43 +01:00
|
|
|
if source == "" then return end
|
|
|
|
|
local veh = GetVehiclePedIsIn(cache.ped)
|
|
|
|
|
local seat = cache.seat
|
|
|
|
|
local coords = GetEntityCoords(cache.ped)
|
|
|
|
|
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, GetEntityHeading(cache.ped), true, true, false)
|
|
|
|
|
|
|
|
|
|
local ped = PlayerPedId()
|
|
|
|
|
if cache.ped ~= ped then
|
|
|
|
|
DeleteEntity(cache.ped)
|
|
|
|
|
ClearAreaOfPeds(coords.x, coords.y, coords.z, 0.2, false)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
SetEntityInvincible(ped, false)
|
|
|
|
|
FreezeEntityPosition(ped, false)
|
|
|
|
|
SetEntityVisible(ped, true)
|
|
|
|
|
SetEveryoneIgnorePlayer(ped, false)
|
|
|
|
|
SetPedCanBeTargetted(ped, true)
|
|
|
|
|
SetEntityCanBeDamaged(ped, true)
|
|
|
|
|
SetBlockingOfNonTemporaryEvents(ped, false)
|
|
|
|
|
SetPedCanRagdollFromPlayerImpact(ped, true)
|
|
|
|
|
ClearPedTasksImmediately(ped)
|
|
|
|
|
|
|
|
|
|
if veh and veh ~= 0 then
|
|
|
|
|
SetPedIntoVehicle(ped, veh, seat)
|
|
|
|
|
end
|
2023-09-24 04:45:37 +02:00
|
|
|
end)
|
2024-02-04 16:44:55 +01:00
|
|
|
|
|
|
|
|
RegisterNetEvent("ND:characterUnloaded")
|