Refactored to apply proper reactions
This commit is contained in:
parent
20cf0125a4
commit
52a4336ec6
@ -27,10 +27,6 @@ namespace big
|
|||||||
|
|
||||||
static bool is_valid_weapon(rage::joaat_t hash)
|
static bool is_valid_weapon(rage::joaat_t hash)
|
||||||
{
|
{
|
||||||
if ("WEAPON_TRANQUILIZER"_J == hash)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (const auto& info : g_pointers->m_gta.m_weapon_info_manager->m_item_infos)
|
for (const auto& info : g_pointers->m_gta.m_weapon_info_manager->m_item_infos)
|
||||||
{
|
{
|
||||||
@ -105,6 +101,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);
|
||||||
|
|
||||||
|
if ("WEAPON_TRANQUILIZER"_J == weaponType)
|
||||||
|
{
|
||||||
|
if (auto plyr = g_player_service->get_by_id(player->m_player_id))
|
||||||
|
g.reactions.break_game.process(plyr);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!is_valid_weapon(weaponType))
|
if (!is_valid_weapon(weaponType))
|
||||||
{
|
{
|
||||||
notify::crash_blocked(player, "invalid weapon type");
|
notify::crash_blocked(player, "invalid weapon type");
|
||||||
@ -113,7 +116,6 @@ namespace big
|
|||||||
"Blocked WEAPON_DAMAGE_EVENT from {} with invalid weapon hash {:X}",
|
"Blocked WEAPON_DAMAGE_EVENT from {} with invalid weapon hash {:X}",
|
||||||
player->get_name(),
|
player->get_name(),
|
||||||
weaponType);
|
weaponType);
|
||||||
g_pointers->m_gta.m_send_event_ack(event_manager, player, target_player, event_index, event_handled_bitset);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user