Less noticeable multi-kick => smart-kick (#3066)

This commit is contained in:
Muhammad007228 2024-05-10 12:51:14 +03:00 committed by GitHub
parent 3a7cad7f72
commit dada469c55
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
12 changed files with 23 additions and 22 deletions

View File

@ -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{};

View File

@ -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))
{

View File

@ -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())
{

View File

@ -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{};

View File

@ -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))
{

View File

@ -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("breakup"_J))->call(player, {});
}
else
{
if (player->is_host())
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())
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);
}

View File

@ -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, {});
}
});
}

View File

@ -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, {});
});
}

View File

@ -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)));
}

View File

@ -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;
}

View File

@ -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);
}},

View File

@ -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());