diff --git a/Client/mods/deathmatch/logic/CClientGame.cpp b/Client/mods/deathmatch/logic/CClientGame.cpp index 49343f0c9e2..230baa6204f 100644 --- a/Client/mods/deathmatch/logic/CClientGame.cpp +++ b/Client/mods/deathmatch/logic/CClientGame.cpp @@ -2648,6 +2648,7 @@ void CClientGame::AddBuiltInEvents() m_Events.AddEvent("onClientPlayerRadioSwitch", "", NULL, false); m_Events.AddEvent("onClientPlayerDamage", "attacker, weapon, bodypart", NULL, false); m_Events.AddEvent("onClientPlayerWeaponFire", "weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement", NULL, false); + m_Events.AddEvent("onClientPlayerWeaponReload", "weapon, clip, ammo", nullptr, false); m_Events.AddEvent("onClientPlayerWasted", "ammo, killer, weapon, bodypart, isStealth, animGroup, animID", nullptr, false); m_Events.AddEvent("onClientPlayerChoke", "", NULL, false); m_Events.AddEvent("onClientPlayerVoiceStart", "", NULL, false); @@ -2666,6 +2667,7 @@ void CClientGame::AddBuiltInEvents() m_Events.AddEvent("onClientPedVehicleEnter", "vehicle, seat", NULL, false); m_Events.AddEvent("onClientPedVehicleExit", "vehicle, seat", NULL, false); m_Events.AddEvent("onClientPedWeaponFire", "weapon, ammo, ammoInClip, hitX, hitY, hitZ, hitElement", NULL, false); + m_Events.AddEvent("onClientPedWeaponReload", "weapon, clip, ammo", nullptr, false); m_Events.AddEvent("onClientPedWasted", "", NULL, false); m_Events.AddEvent("onClientPedChoke", "", NULL, false); m_Events.AddEvent("onClientPedHeliKilled", "heli", NULL, false); diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index aac04570792..285ae3ea040 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -6119,6 +6119,21 @@ bool CClientPed::ReloadWeapon() noexcept if (!CanReloadWeapon() || (task && task->GetTaskType() == TASK_SIMPLE_USE_GUN)) return false; + CLuaArguments args; + args.PushNumber(weapon->GetType()); + args.PushNumber(weapon->GetAmmoInClip()); + args.PushNumber(weapon->GetAmmoTotal()); + + bool result = false; + + if (IS_PLAYER(this)) + result = CallEvent("onClientPlayerWeaponReload", args, true); + else + result = CallEvent("onClientPedWeaponReload", args, true); + + if (!result) + return false; + weapon->SetState(WEAPONSTATE_RELOADING); return true; }