@@ -34,7 +34,7 @@ void CWeaponRPCs::GiveWeapon ( CClientEntity* pSource, NetBitStreamInterface& bi
3434 SWeaponAmmoSync ammo ( weaponType.data .ucWeaponType , true , false );
3535 if ( bitStream.Read ( &ammo ) )
3636 {
37- bool bGiveWeapon = bitStream.ReadBit ();
37+ bool bSetAsCurrent = bitStream.ReadBit ();
3838 unsigned char ucWeaponID = weaponType.data .ucWeaponType ;
3939 unsigned short usAmmo = ammo.data .usTotalAmmo ;
4040
@@ -51,12 +51,9 @@ void CWeaponRPCs::GiveWeapon ( CClientEntity* pSource, NetBitStreamInterface& bi
5151 if ( usAmmo > 9999 ) usAmmo = 9999 ;
5252
5353 // Give the local player the weapon
54- CWeapon* pPlayerWeapon = NULL ;
5554 if ( ucWeaponID != 0 )
5655 {
57- pPlayerWeapon = pPed->GiveWeapon ( static_cast < eWeaponType > ( ucWeaponID ), usAmmo );
58- if ( pPlayerWeapon && bGiveWeapon )
59- pPlayerWeapon->SetAsCurrentWeapon ();
56+ pPed->GiveWeapon ( static_cast < eWeaponType > ( ucWeaponID ), usAmmo, bSetAsCurrent );
6057
6158 // Store the ammo so it's not lost if a ped is streamed out
6259 if ( pPed->GetType () == CCLIENTPED )
@@ -76,7 +73,7 @@ void CWeaponRPCs::GiveWeapon ( CClientEntity* pSource, NetBitStreamInterface& bi
7673 {
7774 eWeaponType unarmedWeapon = oldWeapon->GetType ();
7875 pPed->RemoveWeapon ( unarmedWeapon );
79- if ( bGiveWeapon || pPed->GetCurrentWeaponSlot () == WEAPONSLOT_TYPE_UNARMED )
76+ if ( bSetAsCurrent || pPed->GetCurrentWeaponSlot () == WEAPONSLOT_TYPE_UNARMED )
8077 {
8178 oldWeapon = NULL ;
8279 if ( unarmedWeapon == WEAPONTYPE_BRASSKNUCKLE )
@@ -107,7 +104,7 @@ void CWeaponRPCs::GiveWeapon ( CClientEntity* pSource, NetBitStreamInterface& bi
107104 {
108105 // Probably the ped is streamed out
109106 pPed->GiveWeapon ( WEAPONTYPE_UNARMED, 1 );
110- if ( bGiveWeapon )
107+ if ( bSetAsCurrent )
111108 pPed->SetCurrentWeaponSlot ( WEAPONSLOT_TYPE_UNARMED );
112109 }
113110 }
0 commit comments