Files
ND_Core/client/events.lua

86 lines
2.5 KiB
Lua
Raw Normal View History

RegisterNetEvent("ND:notifyClient", function(...)
NDCore.notify(...)
end)
2022-10-04 00:31:22 +02:00
-- updates the money on the client.
RegisterNetEvent("ND:updateMoney", function(cash, bank)
2026-03-16 05:36:53 +01:00
if source == "" or 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)
2026-03-16 05:36:53 +01:00
if source == "" then return end
NDCore.player = character
2022-10-04 00:31:22 +02:00
end)
-- Update main character info.
RegisterNetEvent("ND:updateCharacter", function(character)
2026-03-16 05:36:53 +01:00
if source == "" or not NDCore.player then return end
NDCore.player = character
2022-10-04 00:31:22 +02:00
end)
-- Updates last lcoation.
RegisterNetEvent("ND:updateLastLocation", function(location)
2026-03-16 05:36:53 +01:00
if source == "" or not NDCore.player then return end
2023-07-09 03:07:46 +02:00
NDCore.player.lastLocation = location
2022-10-04 00:31:22 +02:00
end)
2026-03-16 05:36:53 +01:00
-- Unsets main character.
RegisterNetEvent("ND:characterUnloaded", function()
if source == "" or not NDCore.player then return end
NDCore.player = nil
end)
RegisterNetEvent("ND:revivePlayer", function()
2024-02-12 23:27:43 +01:00
if source == "" then return end
local oldPed = cache.ped
local veh = GetVehiclePedIsIn(oldPed)
2024-02-12 23:27:43 +01:00
local seat = cache.seat
local coords = GetEntityCoords(oldPed)
local armor = GetPedArmour(oldPed)
NetworkResurrectLocalPlayer(coords.x, coords.y, coords.z, GetEntityHeading(oldPed), true, true, false)
2024-02-12 23:27:43 +01:00
local ped = PlayerPedId()
if oldPed ~= ped then
DeleteEntity(oldPed)
2024-02-12 23:27:43 +01:00
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)
SetPedArmour(ped, armor)
2024-02-12 23:27:43 +01:00
if veh and veh ~= 0 then
SetPedIntoVehicle(ped, veh, seat)
end
end)
2024-02-04 16:44:55 +01:00
RegisterNetEvent("ND:clothingMenu", function()
if GetResourceState("fivem-appearance") ~= "started" then return end
local function customize(appearance)
if not appearance then return end
TriggerServerEvent("ND:updateClothing", appearance)
end
exports["fivem-appearance"]:startPlayerCustomization(customize, {
ped = false,
headBlend = true,
faceFeatures = true,
headOverlays = true,
components = true,
props = true,
tattoos = true
})
end)