BE fixes and additions (#3706)
* feat: add BE kick and ban * fix: use correct player ptr
This commit is contained in:
parent
99e7104b3c
commit
899c116eca
60
src/backend/commands/player/kick/battleye.cpp
Normal file
60
src/backend/commands/player/kick/battleye.cpp
Normal file
@ -0,0 +1,60 @@
|
||||
#include "backend/player_command.hpp"
|
||||
#include "gta_util.hpp"
|
||||
#include "pointers.hpp"
|
||||
|
||||
#include <network/Network.hpp>
|
||||
|
||||
#include "packet.hpp"
|
||||
#include <network/snSession.hpp>
|
||||
|
||||
namespace big
|
||||
{
|
||||
class battleye_kick : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
packet msg{};
|
||||
|
||||
msg.write_message(rage::eNetMessage::MsgKickPlayer);
|
||||
msg.write<KickReason>(KickReason::BATTLEYE_KICK, 5);
|
||||
msg.write<int>(0, 32);
|
||||
msg.write<bool>(false, 1);
|
||||
|
||||
auto msg_id = player->get_session_player()->m_msg_id;
|
||||
msg.send(msg_id);
|
||||
}
|
||||
};
|
||||
|
||||
class battleye_ban : player_command
|
||||
{
|
||||
using player_command::player_command;
|
||||
|
||||
virtual CommandAccessLevel get_access_level() override
|
||||
{
|
||||
return CommandAccessLevel::TOXIC;
|
||||
}
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
packet msg{};
|
||||
|
||||
msg.write_message(rage::eNetMessage::MsgKickPlayer);
|
||||
msg.write<KickReason>(KickReason::BATTLEYE_BAN, 5);
|
||||
msg.write<int>(0, 32);
|
||||
msg.write<bool>(false, 1);
|
||||
|
||||
auto msg_id = player->get_session_player()->m_msg_id;
|
||||
msg.send(msg_id);
|
||||
}
|
||||
};
|
||||
|
||||
battleye_kick g_battleye_kick("battlekick", "BATTLEYE_KICK", "BATTLEYE_KICK_DESC", 0);
|
||||
battleye_ban g_battleye_ban("battleban", "BATTLEYE_FAKE_BAN", "BATTLEYE_FAKE_BAN_DESC", 0);
|
||||
}
|
@ -534,6 +534,9 @@ enum class KickReason : uint8_t
|
||||
NAT_TYPE,
|
||||
SCADMIN,
|
||||
SCADMIN_BLACKLIST,
|
||||
UNK,
|
||||
BATTLEYE_KICK,
|
||||
BATTLEYE_BAN,
|
||||
NUM_REASONS
|
||||
};
|
||||
|
||||
|
@ -370,7 +370,7 @@ namespace big
|
||||
}
|
||||
case rage::eNetMessage::MsgKickPlayer:
|
||||
{
|
||||
KickReason reason = buffer.Read<KickReason>(3);
|
||||
KickReason reason = buffer.Read<KickReason>(5);
|
||||
|
||||
if (!is_host_of_session(gta_util::get_network()->m_game_session_ptr, event->m_peer_id))
|
||||
{
|
||||
@ -378,13 +378,16 @@ namespace big
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGF(stream::net_messages, VERBOSE, "{} sent us a MsgKickPlayer, reason = {}", peer->m_info.name, (int)reason);
|
||||
|
||||
if (reason == KickReason::VOTED_OUT)
|
||||
{
|
||||
g_notification_service.push_warning("PROTECTIONS"_T.data(), "YOU_HAVE_BEEN_KICKED"_T.data());
|
||||
return true;
|
||||
}
|
||||
|
||||
LOGF(stream::net_messages, VERBOSE, "{} sent us a MsgKickPlayer, reason = {}", peer->m_info.name, (int)reason);
|
||||
if (reason == KickReason::BATTLEYE_KICK || reason == KickReason::BATTLEYE_BAN)
|
||||
return true;
|
||||
break;
|
||||
}
|
||||
case rage::eNetMessage::MsgRadioStationSyncRequest:
|
||||
|
@ -35,8 +35,6 @@ namespace big
|
||||
|
||||
// TODO: the logic is incorrect
|
||||
|
||||
attributes->m_param_values[0] = -0x22F37A9E;
|
||||
|
||||
if (g.spoofing.spoof_session_bad_sport_status == 1)
|
||||
attributes->m_param_values[0] |= (1 << 14); // Bad Sport
|
||||
|
||||
|
@ -13,6 +13,10 @@ namespace big
|
||||
components::player_command_button<"hostkick">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
components::player_command_button<"breakup">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
components::player_command_button<"battlekick">(g_player_service->get_selected());
|
||||
ImGui::SameLine();
|
||||
components::player_command_button<"battleban">(g_player_service->get_selected());
|
||||
ImGui::EndDisabled();
|
||||
|
||||
components::player_command_button<"smartkick">(g_player_service->get_selected());
|
||||
|
Reference in New Issue
Block a user