-
-
Notifications
You must be signed in to change notification settings - Fork 470
Added server side weapon related checks #3272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
bfdaa16
21b705f
8cf40e0
63ac284
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2443,6 +2443,10 @@ void CGame::Packet_Bulletsync(CBulletsyncPacket& Packet) | |
CPlayer* pPlayer = Packet.GetSourcePlayer(); | ||
if (pPlayer && pPlayer->IsJoined()) | ||
{ | ||
// Early return when the player attempts to fire a weapon they do not have | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be nice to add a comment explaining what could cause this (Cheaters, etc). |
||
if (!pPlayer->HasWeaponType(Packet.m_WeaponType)) | ||
return; | ||
|
||
// Relay to other players | ||
RelayNearbyPacket(Packet); | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,12 @@ bool CPlayerPuresyncPacket::Read(NetBitStreamInterface& BitStream) | |
// Set weapon slot | ||
if (bWeaponCorrect) | ||
pSourcePlayer->SetWeaponSlot(uiSlot); | ||
else | ||
{ | ||
// remove invalid weapon data to prevent this from being relayed to other players | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be nice to add a comment explaining what could cause this (Cheaters, etc). |
||
ucClientWeaponType = 0; | ||
slot.data.uiSlot = 0; | ||
} | ||
|
||
if (CWeaponNames::DoesSlotHaveAmmo(uiSlot)) | ||
{ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this intentional?