AMMO_BALL protection (#2733)

This commit is contained in:
Quentin 2024-02-20 20:27:34 +01:00 committed by GitHub
parent 3a8aed2d00
commit 9e6559b304
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -25,7 +25,8 @@ namespace big
id.m_instance_id = buffer.Read<int32_t>(8); id.m_instance_id = buffer.Read<int32_t>(8);
} }
void scan_weapon_damage_event(CNetGamePlayer* player, rage::datBitBuffer* buffer) // Returns true if bad event
bool scan_weapon_damage_event(rage::netEventMgr* event_manager, CNetGamePlayer* player, CNetGamePlayer* target_player, int event_index, int event_handled_bitset, rage::datBitBuffer* buffer)
{ {
uint8_t damageType; uint8_t damageType;
uint32_t weaponType; // weaponHash uint32_t weaponType; // weaponHash
@ -71,6 +72,13 @@ namespace big
damageType = buffer->Read<uint8_t>(2); damageType = buffer->Read<uint8_t>(2);
weaponType = buffer->Read<uint32_t>(32); weaponType = buffer->Read<uint32_t>(32);
const auto is_crash_weapon = weaponType == RAGE_JOAAT("AMMO_BALL");
if (is_crash_weapon)
{
g_pointers->m_gta.m_send_event_ack(event_manager, player, target_player, event_index, event_handled_bitset);
return true;
}
overrideDefaultDamage = buffer->Read<uint8_t>(1); overrideDefaultDamage = buffer->Read<uint8_t>(1);
hitEntityWeapon = buffer->Read<uint8_t>(1); hitEntityWeapon = buffer->Read<uint8_t>(1);
hitWeaponAmmoAttachment = buffer->Read<uint8_t>(1); hitWeaponAmmoAttachment = buffer->Read<uint8_t>(1);
@ -214,6 +222,8 @@ namespace big
player->get_ped()->m_navigation->get_position()); player->get_ped()->m_navigation->get_position());
}); });
} }
return false;
} }
void scan_explosion_event(CNetGamePlayer* player, rage::datBitBuffer* buffer) void scan_explosion_event(CNetGamePlayer* player, rage::datBitBuffer* buffer)
@ -705,7 +715,10 @@ namespace big
} }
case eNetworkEvents::WEAPON_DAMAGE_EVENT: case eNetworkEvents::WEAPON_DAMAGE_EVENT:
{ {
scan_weapon_damage_event(source_player, buffer); if (scan_weapon_damage_event(event_manager, source_player, target_player, event_index, event_handled_bitset, buffer))
{
return;
}
break; break;
} }
default: break; default: break;