mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-06-23 01:02:23 +08:00

* feat(Commands): Prototype command system * feat(Commands): Chat commands * refactor(Toxic): convert most options into commands * feat(Protections): block breakup kicks on other players as host * refactor(Kicks): convert most options into commands * refactor(Commands): add labels and descriptions to all commands * feat(Commands): cleanup on unload * refactor(Troll): convert most options into commands * refactor(Misc): convert most options into commands * refactor(Teleport): convert most options into commands * feat(Commands): Variadic commands and toggleable bools * feat(Hotkeys): hotkeys now use commands * fix(Chat): fix the chat window locking up when a message is sent * fix(Commands): properly handle spoofed username * fix(Spam): update filter Co-authored-by: Yimura <24669514+Yimura@users.noreply.github.com>
47 lines
1.8 KiB
C++
47 lines
1.8 KiB
C++
#include "backend/looped/looped.hpp"
|
|
#include "fiber_pool.hpp"
|
|
#include "natives.hpp"
|
|
#include "script.hpp"
|
|
#include "services/players/player_service.hpp"
|
|
#include "gta_util.hpp"
|
|
#include <network/Network.hpp>
|
|
|
|
namespace big
|
|
{
|
|
void looped::system_desync_kick_protection()
|
|
{
|
|
if (g_player_service->get_self()->is_valid() && g_player_service->get_self()->is_host())
|
|
return;
|
|
|
|
memset(>a_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained, 0, 64 * sizeof(std::uint64_t));
|
|
if (!g_player_service->m_player_to_use_complaint_kick || !g_player_service->m_player_to_use_complaint_kick->get()->get_net_data())
|
|
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 0;
|
|
else
|
|
{
|
|
gta_util::get_network()->m_game_complaint_mgr.m_num_tokens_complained = 1;
|
|
gta_util::get_network()->m_game_complaint_mgr.m_host_tokens_complained[0] = g_player_service->m_player_to_use_complaint_kick->get()->get_net_data()->m_host_token;
|
|
}
|
|
|
|
auto old = gta_util::get_network()->m_game_complaint_mgr.m_host_token;
|
|
|
|
if (gta_util::get_network()->m_game_session_state > 3 && gta_util::get_network()->m_game_session_state < 6)
|
|
{
|
|
for (auto& [_, plyr] : g_player_service->players())
|
|
{
|
|
if (plyr->get_net_data())
|
|
{
|
|
gta_util::get_network()->m_game_complaint_mgr.m_host_token = plyr->get_net_data()->m_host_token;
|
|
g_pointers->m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr);
|
|
}
|
|
}
|
|
|
|
if (g_player_service->get_self() && g_player_service->get_self()->get_net_data())
|
|
{
|
|
gta_util::get_network()->m_game_complaint_mgr.m_host_token = g_player_service->get_self()->get_net_data()->m_host_token;
|
|
g_pointers->m_reset_network_complaints(>a_util::get_network()->m_game_complaint_mgr);
|
|
}
|
|
}
|
|
|
|
gta_util::get_network()->m_game_complaint_mgr.m_host_token = old;
|
|
}
|
|
} |