added IsClientInKickQueue() to deal with a bot issue

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%401515
This commit is contained in:
David Anderson
2007-10-01 18:41:39 +00:00
parent 4c4b89a403
commit 2c5cd63552
4 changed files with 48 additions and 1 deletions
+12
View File
@@ -805,6 +805,7 @@ CPlayer::CPlayer()
m_TempAdmin = false;
m_Info = NULL;
m_bAdminCheckSignalled = false;
m_bIsInKickQueue = false;
m_LastPassword.clear();
m_LangId = LANGUAGE_ENGLISH;
}
@@ -876,6 +877,7 @@ void CPlayer::Disconnect()
m_Info = NULL;
m_bAdminCheckSignalled = false;
m_UserId = -1;
m_bIsInKickQueue = false;
}
void CPlayer::SetName(const char *name)
@@ -1082,3 +1084,13 @@ int CPlayer::GetUserId()
return m_UserId;
}
bool CPlayer::IsInKickQueue()
{
return m_bIsInKickQueue;
}
void CPlayer::MarkAsBeingKicked()
{
m_bIsInKickQueue = true;
}
+3
View File
@@ -68,6 +68,8 @@ public:
public:
void NotifyPostAdminChecks();
void DoBasicAdminChecks();
bool IsInKickQueue();
void MarkAsBeingKicked();
private:
void Initialize(const char *name, const char *ip, edict_t *pEntity);
void Connect();
@@ -81,6 +83,7 @@ private:
bool m_IsConnected;
bool m_IsInGame;
bool m_IsAuthorized;
bool m_bIsInKickQueue;
String m_Name;
String m_Ip;
String m_IpNoPort;
+21
View File
@@ -1002,6 +1002,8 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
return pContext->ThrowNativeError("Client %d is not connected", client);
}
pPlayer->MarkAsBeingKicked();
if (pPlayer->IsFakeClient())
{
char kickcmd[40];
@@ -1091,6 +1093,24 @@ static cell_t NotifyPostAdminCheck(IPluginContext *pContext, const cell_t *param
return 1;
}
static cell_t IsClientInKickQueue(IPluginContext *pContext, const cell_t *params)
{
int client = params[1];
CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
if (!pPlayer)
{
return pContext->ThrowNativeError("Client index %d is invalid", client);
}
else if (!pPlayer->IsConnected())
{
return pContext->ThrowNativeError("Client %d is not in game", client);
}
return pPlayer->IsInKickQueue() ? 1 : 0;
}
REGISTER_NATIVES(playernatives)
{
{"AddUserFlags", AddUserFlags},
@@ -1140,6 +1160,7 @@ REGISTER_NATIVES(playernatives)
{"KickClient", KickClient},
{"RunAdminCacheChecks", RunAdminCacheChecks},
{"NotifyPostAdminCheck", NotifyPostAdminCheck},
{"IsClientInKickQueue", IsClientInKickQueue},
{NULL, NULL}
};