mirror of
https://github.com/Mr-X-GTA/YimMenu.git
synced 2024-12-22 20:17:24 +08:00
Less noticeable multi-kick => smart-kick (#3066)
This commit is contained in:
parent
ce310f34a8
commit
c77ffe1788
@ -20,7 +20,7 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player || !g_player_service->get_self()->is_host() || !player->get_net_data())
|
||||
if (!player || !g_player_service->get_self()->is_host() || !player->get_net_data() || !player->is_valid())
|
||||
return;
|
||||
|
||||
rage::snMsgRemoveGamersFromSessionCmd cmd{};
|
||||
|
@ -17,7 +17,7 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
if (!player || !player->is_valid())
|
||||
return;
|
||||
if (!scripts::force_host("freemode"_J))
|
||||
{
|
||||
|
@ -14,7 +14,7 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
if (!player || !player->is_valid())
|
||||
return;
|
||||
if (!g_player_service->get_self()->is_host())
|
||||
{
|
||||
|
@ -20,7 +20,7 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
if (!player || !player->is_valid())
|
||||
return;
|
||||
packet msg{};
|
||||
|
||||
|
@ -17,7 +17,7 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
if (!player || !player->is_valid())
|
||||
return;
|
||||
if (!scripts::force_host("freemode"_J))
|
||||
{
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
namespace big
|
||||
{
|
||||
class multi_kick : player_command
|
||||
class smart_kick : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
@ -18,17 +18,18 @@ namespace big
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get("breakup"_J))->call(player, {}),
|
||||
dynamic_cast<player_command*>(command::get("hostkick"_J))->call(player, {});
|
||||
|
||||
dynamic_cast<player_command*>(command::get("oomkick"_J))->call(player, {});
|
||||
script::get_current()->yield(700ms);
|
||||
|
||||
|
||||
if (player && !g_player_service->get_self()->is_host() && player->is_valid() && !player->is_host())
|
||||
dynamic_cast<player_command*>(command::get("desync"_J))->call(player, {});
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get("breakup"_J))->call(player, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (player->is_host())
|
||||
dynamic_cast<player_command*>(command::get("oomkick"_J))->call(player, {});
|
||||
else
|
||||
dynamic_cast<player_command*>(command::get("desync"_J))->call(player, {});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
multi_kick g_multi_kick("multikick", "MULTI_KICK", "MULTI_KICK_DESC", 0, false);
|
||||
smart_kick g_smart_kick("smartkick", "SMART_KICK", "SMART_KICK_DESC", 0, false);
|
||||
}
|
@ -18,7 +18,7 @@ namespace big
|
||||
|
||||
if (plyr.second->is_host())
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get("multikick"_J))->call(plyr.second, {});
|
||||
dynamic_cast<player_command*>(command::get("smartkick"_J))->call(plyr.second, {});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ namespace big
|
||||
if (kick)
|
||||
{
|
||||
g_fiber_pool->queue_job([player] {
|
||||
dynamic_cast<player_command*>(command::get("multikick"_J))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get("smartkick"_J))->call(player, {});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ namespace big
|
||||
}
|
||||
else
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get("multikick"_J))->call(plyr, {});
|
||||
dynamic_cast<player_command*>(command::get("smartkick"_J))->call(plyr, {});
|
||||
g_notification_service.push_warning("LOBBY_LOCK"_T.data(),
|
||||
std::vformat("LOBBY_LOCK_DENIED"_T.data(), std::make_format_args(plyr->get_net_data()->m_name)));
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ namespace big
|
||||
if (g.session.kick_chat_spammers
|
||||
&& !(player->is_trusted || (player->is_friend() && g.session.trust_friends) || g.session.trust_session))
|
||||
{
|
||||
dynamic_cast<player_command*>(command::get("multikick"_J))->call(player, {});
|
||||
dynamic_cast<player_command*>(command::get("smartkick"_J))->call(player, {});
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
@ -204,7 +204,7 @@ namespace big
|
||||
}},
|
||||
{"KICK",
|
||||
[this] {
|
||||
static player_command* command = dynamic_cast<player_command*>(command::get("multikick"_J));
|
||||
static player_command* command = dynamic_cast<player_command*>(command::get("smartkick"_J));
|
||||
command->call(ped::get_player_from_ped(m_handle), {});
|
||||
script::get_current()->yield(500ms);
|
||||
}},
|
||||
|
@ -27,7 +27,7 @@ namespace big
|
||||
ImGui::SameLine();
|
||||
components::command_checkbox<"breakupcheating">();
|
||||
|
||||
components::player_command_button<"multikick">(g_player_service->get_selected());
|
||||
components::player_command_button<"smartkick">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
components::player_command_button<"oomkick">(g_player_service->get_selected());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user