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:
parent
4c4b89a403
commit
2c5cd63552
@ -805,6 +805,7 @@ CPlayer::CPlayer()
|
|||||||
m_TempAdmin = false;
|
m_TempAdmin = false;
|
||||||
m_Info = NULL;
|
m_Info = NULL;
|
||||||
m_bAdminCheckSignalled = false;
|
m_bAdminCheckSignalled = false;
|
||||||
|
m_bIsInKickQueue = false;
|
||||||
m_LastPassword.clear();
|
m_LastPassword.clear();
|
||||||
m_LangId = LANGUAGE_ENGLISH;
|
m_LangId = LANGUAGE_ENGLISH;
|
||||||
}
|
}
|
||||||
@ -876,6 +877,7 @@ void CPlayer::Disconnect()
|
|||||||
m_Info = NULL;
|
m_Info = NULL;
|
||||||
m_bAdminCheckSignalled = false;
|
m_bAdminCheckSignalled = false;
|
||||||
m_UserId = -1;
|
m_UserId = -1;
|
||||||
|
m_bIsInKickQueue = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPlayer::SetName(const char *name)
|
void CPlayer::SetName(const char *name)
|
||||||
@ -1082,3 +1084,13 @@ int CPlayer::GetUserId()
|
|||||||
|
|
||||||
return m_UserId;
|
return m_UserId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CPlayer::IsInKickQueue()
|
||||||
|
{
|
||||||
|
return m_bIsInKickQueue;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CPlayer::MarkAsBeingKicked()
|
||||||
|
{
|
||||||
|
m_bIsInKickQueue = true;
|
||||||
|
}
|
||||||
|
@ -68,6 +68,8 @@ public:
|
|||||||
public:
|
public:
|
||||||
void NotifyPostAdminChecks();
|
void NotifyPostAdminChecks();
|
||||||
void DoBasicAdminChecks();
|
void DoBasicAdminChecks();
|
||||||
|
bool IsInKickQueue();
|
||||||
|
void MarkAsBeingKicked();
|
||||||
private:
|
private:
|
||||||
void Initialize(const char *name, const char *ip, edict_t *pEntity);
|
void Initialize(const char *name, const char *ip, edict_t *pEntity);
|
||||||
void Connect();
|
void Connect();
|
||||||
@ -81,6 +83,7 @@ private:
|
|||||||
bool m_IsConnected;
|
bool m_IsConnected;
|
||||||
bool m_IsInGame;
|
bool m_IsInGame;
|
||||||
bool m_IsAuthorized;
|
bool m_IsAuthorized;
|
||||||
|
bool m_bIsInKickQueue;
|
||||||
String m_Name;
|
String m_Name;
|
||||||
String m_Ip;
|
String m_Ip;
|
||||||
String m_IpNoPort;
|
String m_IpNoPort;
|
||||||
|
@ -1002,6 +1002,8 @@ static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
|
|||||||
return pContext->ThrowNativeError("Client %d is not connected", client);
|
return pContext->ThrowNativeError("Client %d is not connected", client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pPlayer->MarkAsBeingKicked();
|
||||||
|
|
||||||
if (pPlayer->IsFakeClient())
|
if (pPlayer->IsFakeClient())
|
||||||
{
|
{
|
||||||
char kickcmd[40];
|
char kickcmd[40];
|
||||||
@ -1091,6 +1093,24 @@ static cell_t NotifyPostAdminCheck(IPluginContext *pContext, const cell_t *param
|
|||||||
return 1;
|
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)
|
REGISTER_NATIVES(playernatives)
|
||||||
{
|
{
|
||||||
{"AddUserFlags", AddUserFlags},
|
{"AddUserFlags", AddUserFlags},
|
||||||
@ -1140,6 +1160,7 @@ REGISTER_NATIVES(playernatives)
|
|||||||
{"KickClient", KickClient},
|
{"KickClient", KickClient},
|
||||||
{"RunAdminCacheChecks", RunAdminCacheChecks},
|
{"RunAdminCacheChecks", RunAdminCacheChecks},
|
||||||
{"NotifyPostAdminCheck", NotifyPostAdminCheck},
|
{"NotifyPostAdminCheck", NotifyPostAdminCheck},
|
||||||
|
{"IsClientInKickQueue", IsClientInKickQueue},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -205,11 +205,22 @@ native bool:IsClientConnected(client);
|
|||||||
/**
|
/**
|
||||||
* Returns if a certain player has entered the game.
|
* Returns if a certain player has entered the game.
|
||||||
*
|
*
|
||||||
* @param client Player index.
|
* @param client Player index (index does not have to be connected).
|
||||||
* @return True if player has entered the game, false otherwise.
|
* @return True if player has entered the game, false otherwise.
|
||||||
|
* @error Invalid client index.
|
||||||
*/
|
*/
|
||||||
native bool:IsClientInGame(client);
|
native bool:IsClientInGame(client);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns if a client is in the "kick queue" (i.e. the client will be kicked
|
||||||
|
* shortly and thus they should not appear as valid).
|
||||||
|
*
|
||||||
|
* @param client Player index (must be connected).
|
||||||
|
* @return True if in the kick queue, false otherwise.
|
||||||
|
* @error Invalid client index.
|
||||||
|
*/
|
||||||
|
native bool:IsClientInKickQueue(client);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Backwards compatibility stock - use IsClientInGame
|
* Backwards compatibility stock - use IsClientInGame
|
||||||
* @deprecated Renamed to IsClientInGame
|
* @deprecated Renamed to IsClientInGame
|
||||||
|
Loading…
Reference in New Issue
Block a user