mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-03 16:13:36 +08:00
Weapon events refactor. (#2622)
* Removed legacy REMOVE_ALL_WEAPONS_EVENT network event check. Added GIVE_WEAPON_EVENT check to prevent people giving us weapons.
This commit is contained in:
parent
9beaff807d
commit
7584d231df
@ -570,8 +570,8 @@ namespace big
|
||||
}
|
||||
case eNetworkEvents::REMOVE_WEAPON_EVENT:
|
||||
{
|
||||
int net_id = buffer->Read<int>(13);
|
||||
uint32_t hash = buffer->Read<uint32_t>(32);
|
||||
std::int16_t net_id = buffer->Read<std::int16_t>(13);
|
||||
Hash hash = buffer->Read<Hash>(32);
|
||||
|
||||
if (hash == RAGE_JOAAT("WEAPON_UNARMED"))
|
||||
{
|
||||
@ -582,8 +582,9 @@ namespace big
|
||||
|
||||
if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
|
||||
{
|
||||
weapon_item weapon = g_gta_data_service->weapon_by_hash(hash);
|
||||
g_notification_service->push_warning("PROTECTIONS"_T.data(),
|
||||
std::vformat("REMOVE_WEAPON_ATTEMPT"_T, std::make_format_args(source_player->get_name())));
|
||||
std::format("{} {} {}.", source_player->get_name(), "REMOVE_WEAPON_ATTEMPT_MESSAGE"_T, weapon.m_display_name));
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
@ -591,14 +592,16 @@ namespace big
|
||||
buffer->Seek(0);
|
||||
break;
|
||||
}
|
||||
case eNetworkEvents::REMOVE_ALL_WEAPONS_EVENT:
|
||||
case eNetworkEvents::GIVE_WEAPON_EVENT:
|
||||
{
|
||||
int net_id = buffer->Read<int>(13);
|
||||
std::int16_t net_id = buffer->Read<std::int16_t>(13);
|
||||
Hash hash = buffer->Read<Hash>(32);
|
||||
|
||||
if (g_local_player && g_local_player->m_net_object && g_local_player->m_net_object->m_object_id == net_id)
|
||||
{
|
||||
weapon_item weapon = g_gta_data_service->weapon_by_hash(hash);
|
||||
g_notification_service->push_warning("PROTECTIONS"_T.data(),
|
||||
std::vformat("REMOVE_ALL_WEAPONS_ATTEMPT"_T, std::make_format_args(source_player->get_name())));
|
||||
std::format("{} {} {}.", source_player->get_name(), "GIVE_WEAPON_ATTEMPT_MESSAGE"_T, weapon.m_display_name));
|
||||
g_pointers->m_gta.m_send_event_ack(event_manager, source_player, target_player, event_index, event_handled_bitset);
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user