mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2025-01-04 00:23:27 +08:00
parent
4b73b46053
commit
e5581a6f03
@ -20,6 +20,9 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
if (!g_player_service->get_self()->is_host())
|
||||
return;
|
||||
|
||||
rage::snMsgRemoveGamersFromSessionCmd cmd{};
|
||||
cmd.m_session_id = gta_util::get_network()->m_game_session_ptr->m_rline_session.m_session_id;
|
||||
cmd.m_num_peers = 1;
|
||||
|
28
src/backend/commands/player/kick/host_kick.cpp
Normal file
28
src/backend/commands/player/kick/host_kick.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "natives.hpp"
|
||||
|
||||
namespace big
|
||||
{
|
||||
class host_kick : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level()
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const std::vector<std::uint64_t>& _args, const std::shared_ptr<command_context> ctx)
|
||||
{
|
||||
if (!g_player_service->get_self()->is_host())
|
||||
{
|
||||
g_notification_service->push_error("Host kick", "Host kick failed");
|
||||
return;
|
||||
}
|
||||
|
||||
NETWORK::NETWORK_SESSION_KICK_PLAYER(player->id());
|
||||
}
|
||||
};
|
||||
|
||||
host_kick g_host_kick("hostkick", "Host Kick", "Host kick that only works when host", 0, false);
|
||||
}
|
@ -14,7 +14,9 @@ namespace big
|
||||
g_player_service->iterate([](auto& plyr) {
|
||||
if (plyr.second->is_host())
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr.second, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("bailkick")))->call(plyr.second, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("nfkick")))->call(plyr.second, {});
|
||||
//dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr.second, {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -39,14 +39,18 @@ namespace big
|
||||
if (kick)
|
||||
{
|
||||
g_fiber_pool->queue_job([player] {
|
||||
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("bailkick")))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("nfkick")))->call(player, {});
|
||||
script::get_current()->yield(700ms);
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(player, {});
|
||||
if(g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(player, {}),
|
||||
NETWORK::NETWORK_SESSION_KICK_PLAYER(player->id());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void reaction::process(player_ptr player)
|
||||
{
|
||||
if (!player->is_valid())
|
||||
|
@ -109,13 +109,25 @@ namespace big
|
||||
}
|
||||
if (plyr->block_join)
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr, {});
|
||||
g_notification_service->push_warning("Block Join",
|
||||
std::format("Block Join method failed for {}, sending breakup kick instead...",
|
||||
plyr->get_net_data()->m_name));
|
||||
LOG(WARNING) << "Sending Breakup Kick due to block join failure... ";
|
||||
if (g_player_service->get_self()->is_host())
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr, {});
|
||||
g_notification_service->push_warning("Block Join",
|
||||
std::format("Block Join method failed for {}, sending breakup kick instead...",
|
||||
plyr->get_net_data()->m_name));
|
||||
LOG(WARNING) << "Sending Breakup Kick due to block join failure... ";
|
||||
}
|
||||
else
|
||||
{
|
||||
g_notification_service->push_warning("Block Join",
|
||||
std::format("Block Join method failed for {}, can't send breakup without host...\n trying Desync",
|
||||
plyr->get_net_data()->m_name));
|
||||
LOG(WARNING) << "Failed blocking join due to not being host... trying Desync ";
|
||||
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("desync")))->call(plyr, {});
|
||||
}
|
||||
}
|
||||
if (lock_session)
|
||||
if (lock_session && g_player_service->get_self()->is_host())
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(plyr, {});
|
||||
g_notification_service->push_warning("Lock Session",
|
||||
|
@ -117,7 +117,12 @@ namespace big
|
||||
player->is_spammer = true;
|
||||
if (g.session.kick_chat_spammers)
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(player, {});
|
||||
if(g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("breakup")))->call(player, {}),
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("hostkick")))->call(player, {});
|
||||
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("bailkick")))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("nfkick")))->call(player, {});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -126,9 +126,14 @@ namespace big
|
||||
}
|
||||
|
||||
components::sub_title("Lobby Lock");
|
||||
ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
|
||||
|
||||
ImGui::Checkbox("Lock", &g.session.lock_session);
|
||||
if (ImGui::IsItemHovered())
|
||||
ImGui::SetTooltip("Blocks all players from joining. May not work on some modders.");
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
components::sub_title("DECLOAK"_T);
|
||||
components::script_patch_checkbox("REVEAL_OTR_PLAYERS"_T, &g.session.decloak_players);
|
||||
|
||||
|
@ -12,9 +12,16 @@ namespace big
|
||||
return gta_util::get_network()->m_game_session_ptr->is_host();
|
||||
};
|
||||
|
||||
//components::player_command_button<"breakup">(g_player_service->get_selected());
|
||||
//ImGui::SameLine();
|
||||
//components::command_checkbox<"breakupcheating">();
|
||||
ImGui::Text("Host/breakup kick require Host");
|
||||
ImGui::BeginDisabled(!g_player_service->get_self()->is_host());
|
||||
|
||||
components::player_command_button<"hostkick">(g_player_service->get_selected());
|
||||
components::player_command_button<"breakup">(g_player_service->get_selected());
|
||||
|
||||
ImGui::EndDisabled();
|
||||
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"breakupcheating">();
|
||||
|
||||
components::player_command_button<"bailkick">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
|
Loading…
x
Reference in New Issue
Block a user