
The main goal was improving the readability of the original code however some ugliness remains. - Swapped from pointer singleton to instance singleton - Actually make use of the alpha logic that used to be present - Added a counter to notifications to indicate if something is being spammed - Notification timeouts reset if they're sent to the queue again
29 lines
943 B
C++
29 lines
943 B
C++
#include "hooking/hooking.hpp"
|
|
#include "pointers.hpp"
|
|
#include "services/players/player_service.hpp"
|
|
|
|
#include <network/CNetGamePlayer.hpp>
|
|
#include <player/CNonPhysicalPlayerData.hpp>
|
|
|
|
namespace big
|
|
{
|
|
bool hooks::send_non_physical_player_data(CNetGamePlayer* player, __int64 message, int flags, void* a4, CNetGamePlayer* a5)
|
|
{
|
|
auto plyr = g_player_service->get_by_id(player->m_player_id);
|
|
auto data = *(CNonPhysicalPlayerData**)(message + 0x10);
|
|
int old_bubble_id = data->m_bubble_id;
|
|
|
|
if (plyr && plyr->block_join && *g_pointers->m_gta.m_is_session_started)
|
|
{
|
|
data->m_bubble_id = 10;
|
|
g_notification_service.push("BLOCK_JOIN"_T.data(), std::vformat("BLOCK_JOIN_PREVENT_PLAYER_JOIN"_T, std::make_format_args(plyr->get_name())));
|
|
}
|
|
|
|
bool result = g_hooking->get_original<hooks::send_non_physical_player_data>()(player, message, flags, a4, a5);
|
|
|
|
data->m_bubble_id = old_bubble_id;
|
|
|
|
return result;
|
|
}
|
|
}
|