fix(MultiKick): check against player nullptr (#2057)
* fix(MultiKick): check player ptr before using it * fix(Kick): guard other commands against nullptr player ptr
This commit is contained in:
parent
4871dbd705
commit
4c6226d022
@ -18,6 +18,9 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
const size_t arg_count = 3;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::NetworkBail,
|
||||
(int64_t)self::id,
|
||||
|
@ -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 (!g_player_service->get_self()->is_host() || !player->get_net_data())
|
||||
if (!player || !g_player_service->get_self()->is_host() || !player->get_net_data())
|
||||
return;
|
||||
|
||||
rage::snMsgRemoveGamersFromSessionCmd cmd{};
|
||||
|
@ -19,6 +19,8 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (gta_util::get_network()->m_game_session_ptr->is_host())
|
||||
{
|
||||
gta_util::get_network()->m_game_complaint_mgr.raise_complaint(player->get_net_data()->m_host_token);
|
||||
|
@ -17,6 +17,8 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (!scripts::force_host(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
g_notification_service->push_error("Kick", "Force script host failed!");
|
||||
|
@ -14,6 +14,8 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (!g_player_service->get_self()->is_host())
|
||||
{
|
||||
g_notification_service->push_error("Host kick", "Host kick failed");
|
||||
|
@ -25,7 +25,7 @@ namespace big
|
||||
if (g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("hostkick")))->call(player, {});
|
||||
|
||||
if (!player->is_host() && !g_player_service->get_self()->is_host())
|
||||
if (player && !player->is_host() && !g_player_service->get_self()->is_host())
|
||||
dynamic_cast<player_command*>(command::get(RAGE_JOAAT("desync")))->call(player, {});
|
||||
|
||||
if (g_player_service->get_self()->is_host())
|
||||
|
@ -16,6 +16,8 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
const size_t arg_count = 15;
|
||||
int64_t args[arg_count] = {(int64_t)eRemoteEvent::InteriorControl, (int64_t)self::id, (int64_t)(int)-1};
|
||||
|
||||
|
@ -20,6 +20,8 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
packet msg{};
|
||||
|
||||
msg.write_message(rage::eNetMessage::MsgRadioStationSyncRequest);
|
||||
|
@ -17,6 +17,8 @@ namespace big
|
||||
|
||||
virtual void execute(player_ptr player, const command_arguments& _args, const std::shared_ptr<command_context> ctx) override
|
||||
{
|
||||
if (!player)
|
||||
return;
|
||||
if (!scripts::force_host(RAGE_JOAAT("freemode")))
|
||||
{
|
||||
g_notification_service->push_error("Kick", "Force script host failed!");
|
||||
|
Reference in New Issue
Block a user