diff --git a/core/PlayerManager.cpp b/core/PlayerManager.cpp index d9528ee2..ae749461 100644 --- a/core/PlayerManager.cpp +++ b/core/PlayerManager.cpp @@ -38,13 +38,13 @@ #include "MenuStyle_Radio.h" #include "sm_stringutil.h" #include "CoreConfig.h" -#include -#include #include "TimerSys.h" #include "Translator.h" #include "Logger.h" #include "ChatTriggers.h" #include "HalfLife2.h" +#include +#include PlayerManager g_Players; bool g_OnMapStarted = false; @@ -1001,6 +1001,7 @@ void CPlayer::DumpAdmin(bool deleting) void CPlayer::Kick(const char *str) { + MarkAsBeingKicked(); INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(m_iIndex)); IClient *pClient = static_cast(pNetChan->GetMsgHandler()); pClient->Disconnect("%s", str); diff --git a/core/smn_banning.cpp b/core/smn_banning.cpp index d3244ca1..2cf5888e 100644 --- a/core/smn_banning.cpp +++ b/core/smn_banning.cpp @@ -34,8 +34,6 @@ #include "HalfLife2.h" #include "PlayerManager.h" #include "ForwardSys.h" -#include -#include #define BANFLAG_AUTO (1<<0) /**< Auto-detects whether to ban by steamid or IP */ #define BANFLAG_IP (1<<1) /**< Always ban by IP address */ @@ -265,9 +263,6 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params) ban_flags = params[3]; ban_source = params[7]; - INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(params[1])); - IClient *pClient = static_cast(pNetChan->GetMsgHandler()); - /* Check how we should ban the player */ if ((ban_flags & BANFLAG_AUTO) == BANFLAG_AUTO) { @@ -347,7 +342,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params) /* Kick, then ban */ if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK) { - pClient->Disconnect("%s", kick_message); + pPlayer->Kick(kick_message); } engine->ServerCommand(command); @@ -371,7 +366,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params) /* Kick, then ban */ if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK) { - pClient->Disconnect("%s", kick_message); + pPlayer->Kick(kick_message); } engine->ServerCommand(command); @@ -384,7 +379,7 @@ static cell_t BanClient(IPluginContext *pContext, const cell_t *params) } else if ((ban_flags & BANFLAG_NOKICK) != BANFLAG_NOKICK) { - pClient->Disconnect("%s", kick_message); + pPlayer->Kick(kick_message); } diff --git a/core/smn_player.cpp b/core/smn_player.cpp index 8b1da987..3e9d1425 100644 --- a/core/smn_player.cpp +++ b/core/smn_player.cpp @@ -1013,9 +1013,6 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params) return 1; } - INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(client)); - IClient *pClient = static_cast(pNetChan->GetMsgHandler()); - g_SourceMod.SetGlobalTarget(client); char buffer[256]; @@ -1026,7 +1023,7 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params) return 0; } - pClient->Disconnect("%s", buffer); + pPlayer->Kick(buffer); return 1; }