Skip to content

Commit c8777e1

Browse files
committed
fixes
1 parent 95f9b20 commit c8777e1

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4805,6 +4805,15 @@ bool CStaticFunctionDefinitions::GiveWeapon(CElement* pElement, unsigned char uc
48054805
if (pPed->IsSpawned())
48064806
{
48074807
unsigned char ucCurrentWeapon = pPed->GetWeaponType();
4808+
unsigned char ucWeaponSlot = CWeaponNames::GetSlotFromWeapon(ucWeaponID);
4809+
4810+
CLuaArguments arguments;
4811+
arguments.PushNumber(ucWeaponID);
4812+
arguments.PushNumber(usAmmo);
4813+
arguments.PushNumber(ucWeaponSlot);
4814+
if (!pPed->CallEvent(IS_PLAYER(pElement) ? "onPlayerWeaponGiven" : "onPedWeaponGiven", arguments))
4815+
return false;
4816+
48084817
if (ucCurrentWeapon != ucWeaponID && bSetAsCurrent)
48094818
{
48104819
// Call our weapon switch command
@@ -4821,15 +4830,7 @@ bool CStaticFunctionDefinitions::GiveWeapon(CElement* pElement, unsigned char uc
48214830
bSetAsCurrent = false;
48224831
}
48234832

4824-
unsigned char ucWeaponSlot = CWeaponNames::GetSlotFromWeapon(ucWeaponID);
48254833
unsigned char ucPreviousWeaponID = pPed->GetWeaponType(ucWeaponSlot);
4826-
4827-
CLuaArguments arguments;
4828-
arguments.PushNumber(ucWeaponID);
4829-
arguments.PushNumber(usAmmo);
4830-
arguments.PushNumber(ucWeaponSlot);
4831-
if (!pPed->CallEvent(IS_PLAYER(pElement) ? "onPlayerWeaponGiven" : "onPedWeaponGiven", arguments))
4832-
return false;
48334834

48344835
pPed->SetWeaponType(ucWeaponID, ucWeaponSlot);
48354836
if (bSetAsCurrent)
@@ -4884,15 +4885,14 @@ bool CStaticFunctionDefinitions::TakeWeapon(CElement* pElement, unsigned char uc
48844885
// Just because it's the same slot doesn't mean it's the same weapon -_- - Caz
48854886
if (pPed->IsSpawned() && pPed->GetWeapon(ucWeaponSlot) && pPed->GetWeaponType(ucWeaponSlot) == ucWeaponID)
48864887
{
4887-
CBitStream BitStream;
4888-
48894888
CLuaArguments arguments;
48904889
arguments.PushNumber(ucWeaponID);
48914890
arguments.PushNumber(usAmmo);
48924891
arguments.PushNumber(ucWeaponSlot);
48934892
if (!pPed->CallEvent(IS_PLAYER(pElement) ? "onPlayerWeaponTaken" : "onPedWeaponTaken", arguments))
48944893
return false;
4895-
4894+
4895+
CBitStream BitStream;
48964896
SWeaponTypeSync weaponType;
48974897
weaponType.data.ucWeaponType = ucWeaponID;
48984898
BitStream.pBitStream->Write(&weaponType);

0 commit comments

Comments
 (0)