Skip to content

Commit 8fb4efc

Browse files
committed
Fixes
1 parent 141d776 commit 8fb4efc

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

Server/mods/deathmatch/logic/CGame.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ void CGame::AddBuiltInEvents()
16541654
m_Events.AddEvent("onPlayerChangesProtectedData", "element, key, value", nullptr, false);
16551655
m_Events.AddEvent("onPlayerChangesWorldSpecialProperty", "property, enabled", nullptr, false);
16561656
m_Events.AddEvent("onPlayerTeleport", "previousX, previousY, previousZ, currentX, currentY, currentZ", nullptr, false);
1657-
m_Events.AddEvent("onPlayerWeaponGiven", "weaponID", nullptr, false);
1657+
m_Events.AddEvent("onPlayerWeaponGiven", "weaponID, weaponAmmo, weaponSlot", nullptr, false);
16581658
m_Events.AddEvent("onPlayerWeaponTaken", "weaponID, weaponAmmo, weaponSlot", nullptr, false);
16591659

16601660
// Ped events
@@ -1664,7 +1664,7 @@ void CGame::AddBuiltInEvents()
16641664
m_Events.AddEvent("onPedWeaponSwitch", "previous, current", NULL, false);
16651665
m_Events.AddEvent("onPedWeaponReload", "weapon, clip, ammo", nullptr, false);
16661666
m_Events.AddEvent("onPedDamage", "loss", NULL, false);
1667-
m_Events.AddEvent("onPedWeaponGiven", "weaponID", nullptr, false);
1667+
m_Events.AddEvent("onPedWeaponGiven", "weaponID, weaponAmmo, weaponSlot", nullptr, false);
16681668
m_Events.AddEvent("onPedWeaponTaken", "weaponID, weaponAmmo, weaponSlot", nullptr, false);
16691669

16701670
// Element events

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4828,12 +4828,8 @@ bool CStaticFunctionDefinitions::GiveWeapon(CElement* pElement, unsigned char uc
48284828
arguments.PushNumber(ucWeaponID);
48294829
arguments.PushNumber(usAmmo);
48304830
arguments.PushNumber(ucWeaponSlot);
4831-
if (IS_PLAYER(pElement))
4832-
if (!pPed->CallEvent("onPlayerWeaponGiven", arguments))
4833-
return false;
4834-
else
4835-
if (!pPed->CallEvent("onPedWeaponGiven", arguments))
4836-
return false;
4831+
if (!pPed->CallEvent(IS_PLAYER(pElement) ? "onPlayerWeaponGiven" : "onPedWeaponGiven", arguments))
4832+
return false;
48374833

48384834
pPed->SetWeaponType(ucWeaponID, ucWeaponSlot);
48394835
if (bSetAsCurrent)
@@ -4963,19 +4959,11 @@ bool CStaticFunctionDefinitions::TakeAllWeapons(CElement* pElement)
49634959
arguments.PushNumber(ucAmmo);
49644960
arguments.PushNumber(ucWeaponSlot);
49654961

4966-
bool bTake = true;
4967-
if (IS_PLAYER(pElement))
4968-
{
4969-
if (!pPed->CallEvent("onPlayerWeaponTaken", arguments))
4970-
bTake = false;
4971-
}
4972-
else
4973-
{
4974-
if (!pPed->CallEvent("onPedWeaponTaken", arguments))
4975-
bTake = false;
4976-
}
4962+
bool shouldTake = true;
4963+
if (!pPed->CallEvent(IS_PLAYER(pElement) ? "onPlayerWeaponTaken" : "onPedWeaponTaken", arguments))
4964+
shouldTake = false;
49774965

4978-
if (bTake)
4966+
if (shouldTake)
49794967
{
49804968
CBitStream BitStream;
49814969
SWeaponTypeSync weaponType;

0 commit comments

Comments
 (0)