Skip to content

Commit 3b1a082

Browse files
committed
fixes
1 parent d5c0e0a commit 3b1a082

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

Client/mods/deathmatch/logic/rpc/CWeaponRPCs.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,20 +188,19 @@ void CWeaponRPCs::TakeWeapon(CClientEntity* pSource, NetBitStreamInterface& bitS
188188

189189
void CWeaponRPCs::TakeWeapons(CClientEntity* pSource, NetBitStreamInterface& bitStream)
190190
{
191-
std::uint8_t count = 0;
191+
std::uint32_t count = 0;
192192
if (!bitStream.Read(count))
193193
return;
194194

195195
CClientPed* pPed = m_pPedManager->Get(pSource->GetID(), true);
196196
if (!pPed)
197197
return;
198198

199-
for (std::uint8_t i = 0; i < count; i++)
199+
for (std::uint32_t i = 0; i < count; i++)
200200
{
201-
unsigned char weaponID, ammo, slot;
202-
if (!bitStream.Read(weaponID)) continue;
203-
if (!bitStream.Read(ammo)) continue;
204-
if (!bitStream.Read(slot)) continue;
201+
unsigned char weaponID;
202+
if (!bitStream.Read(weaponID))
203+
return;
205204

206205
if (!CClientPickupManager::IsValidWeaponID(weaponID))
207206
continue;

Server/mods/deathmatch/logic/CStaticFunctionDefinitions.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4943,7 +4943,7 @@ bool CStaticFunctionDefinitions::TakeAllWeapons(CElement* pElement)
49434943
CPed* pPed = static_cast<CPed*>(pElement);
49444944
if (pPed->IsSpawned())
49454945
{
4946-
std::vector<std::tuple<unsigned char, unsigned char, unsigned char>> weapons;
4946+
std::vector<unsigned char> weapons;
49474947

49484948
for (unsigned char ucWeaponSlot = 0; ucWeaponSlot < WEAPON_SLOTS; ++ucWeaponSlot)
49494949
{
@@ -4963,7 +4963,7 @@ bool CStaticFunctionDefinitions::TakeAllWeapons(CElement* pElement)
49634963

49644964
if (shouldTake)
49654965
{
4966-
weapons.push_back({ucWeaponID, ucAmmo, ucWeaponSlot});
4966+
weapons.push_back(ucWeaponID);
49674967

49684968
pPed->SetWeaponType(0, ucWeaponSlot);
49694969
pPed->SetWeaponAmmoInClip(0, ucWeaponSlot);
@@ -4975,15 +4975,13 @@ bool CStaticFunctionDefinitions::TakeAllWeapons(CElement* pElement)
49754975
if (!weapons.empty())
49764976
{
49774977
CBitStream BitStream;
4978-
std::size_t weaponsTaken = (std::size_t)weapons.size();
4978+
std::uint32_t weaponsTaken = (std::uint32_t)weapons.size();
49794979

49804980
BitStream.pBitStream->Write(weaponsTaken);
49814981

4982-
for (auto& w : weapons)
4982+
for (auto& weaponID : weapons)
49834983
{
4984-
BitStream.pBitStream->Write(std::get<0>(w));
4985-
BitStream.pBitStream->Write(std::get<1>(w));
4986-
BitStream.pBitStream->Write(std::get<2>(w));
4984+
BitStream.pBitStream->Write(weaponID);
49874985
}
49884986

49894987
m_pPlayerManager->BroadcastOnlyJoined(CElementRPCPacket(pPed, TAKE_WEAPONS, *BitStream.pBitStream));

Shared/sdk/net/rpc_enums.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,6 @@ enum eElementRPCFunctions
101101

102102
GIVE_WEAPON,
103103
TAKE_WEAPON,
104-
TAKE_WEAPONS,
105104
TAKE_ALL_WEAPONS,
106105
SET_WEAPON_AMMO,
107106
SET_WEAPON_SLOT,
@@ -294,5 +293,7 @@ enum eElementRPCFunctions
294293

295294
SET_ELEMENT_ON_FIRE,
296295

296+
TAKE_WEAPONS,
297+
297298
NUM_RPC_FUNCS // Add above this line
298299
};

0 commit comments

Comments
 (0)