added steamid auth functions
added better bot detection added gameframe hook for timer renamed more playermanager stuff --HG-- extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%40454
This commit is contained in:
+21
-21
@@ -18,37 +18,37 @@ static cell_t sm_GetClientCount(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
if (params[1])
|
||||
{
|
||||
return g_PlayerManager.NumPlayers();
|
||||
return g_Players.NumPlayers();
|
||||
}
|
||||
|
||||
int maxplayers = g_PlayerManager.MaxClients();
|
||||
int maxplayers = g_Players.MaxClients();
|
||||
int count = 0;
|
||||
for (int i=1; i<=maxplayers; ++i)
|
||||
{
|
||||
CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(i);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
|
||||
if ((pPlayer->IsConnected()) && !(pPlayer->IsInGame()))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return (g_PlayerManager.NumPlayers() + count);
|
||||
return (g_Players.NumPlayers() + count);
|
||||
}
|
||||
|
||||
static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
return g_PlayerManager.MaxClients();
|
||||
return g_Players.MaxClients();
|
||||
}
|
||||
|
||||
static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
return pCtx->ThrowNativeError("Client %d is not connected.", index);
|
||||
@@ -61,12 +61,12 @@ static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
|
||||
static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
return pCtx->ThrowNativeError("Client %d is not connected.", index);
|
||||
@@ -87,12 +87,12 @@ static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
|
||||
static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
return pCtx->ThrowNativeError("Client %d is not connected.", index);
|
||||
@@ -105,45 +105,45 @@ static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
|
||||
static cell_t sm_IsPlayerConnected(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
return (g_PlayerManager.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
|
||||
return (g_Players.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t sm_IsPlayerIngame(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
return (g_PlayerManager.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
|
||||
return (g_Players.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t sm_IsPlayerAuthorized(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
return (g_PlayerManager.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
|
||||
return (g_Players.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
|
||||
}
|
||||
|
||||
static cell_t sm_IsPlayerFakeClient(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
|
||||
if (!pPlayer->IsConnected())
|
||||
{
|
||||
return pCtx->ThrowNativeError("Client %d is not connected.", index);
|
||||
@@ -172,12 +172,12 @@ static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
|
||||
static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
|
||||
{
|
||||
int index = params[1];
|
||||
if ((index < 1) || (index > g_PlayerManager.GetMaxClients()))
|
||||
if ((index < 1) || (index > g_Players.GetMaxClients()))
|
||||
{
|
||||
return pCtx->ThrowNativeError("Invalid client index %d.", index);
|
||||
}
|
||||
|
||||
CPlayer *pPlayer = g_PlayerManager.GetPlayerByIndex(index);
|
||||
CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
|
||||
if (!pPlayer->IsInGame())
|
||||
{
|
||||
return pCtx->ThrowNativeError("Client %d is not in game.", index);
|
||||
|
||||
Reference in New Issue
Block a user