dvander@370: /**
ds@653: * vim: set ts=4 :
ds@1330: * =============================================================================
dvander@1231: * SourceMod
dvander@1231: * Copyright (C) 2004-2007 AlliedModders LLC. All rights reserved.
ds@1330: * =============================================================================
dvander@370: *
ds@1330: * This program is free software; you can redistribute it and/or modify it under
ds@1330: * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330: * Free Software Foundation.
dvander@1231: *
ds@1330: * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330: * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
ds@1330: * details.
dvander@1231: *
ds@1330: * You should have received a copy of the GNU General Public License along with
ds@1330: * this program. If not, see .
dvander@1231: *
ds@1330: * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330: * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330: * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330: * by the Valve Corporation. You must obey the GNU General Public License in
ds@1330: * all respects for all other code used. Additionally, AlliedModders LLC grants
ds@1330: * this exception to all derivative works. AlliedModders LLC defines further
ds@1330: * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330: * or .
dvander@370: *
dvander@370: * Version: $Id$
dvander@370: */
dvander@370:
dvander@591: #include "PlayerManager.h"
dvander@458: #include "AdminCache.h"
faluco@280: #include "sm_stringutil.h"
dvander@910: #include "HalfLife2.h"
dvander@910: #include "sourcemod.h"
dvander@924: #include "ChatTriggers.h"
ds@992: #include
ds@992: #include
faluco@242:
dvander@923: ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY|FCVAR_PROTECTED, "Activity display setting (see sourcemod.cfg)");
dvander@910:
faluco@260: static cell_t sm_GetClientCount(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: if (params[1])
faluco@242: {
dvander@448: return g_Players.NumPlayers();
faluco@242: }
faluco@242:
dvander@448: int maxplayers = g_Players.MaxClients();
faluco@242: int count = 0;
faluco@242: for (int i=1; i<=maxplayers; ++i)
faluco@242: {
dvander@448: CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@435: if ((pPlayer->IsConnected()) && !(pPlayer->IsInGame()))
faluco@242: {
faluco@242: count++;
faluco@242: }
faluco@242: }
faluco@242:
dvander@448: return (g_Players.NumPlayers() + count);
faluco@242: }
faluco@242:
faluco@260: static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
dvander@448: return g_Players.MaxClients();
faluco@242: }
faluco@242:
faluco@260: static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@1049:
dvander@1049: if (index == 0)
dvander@1049: {
dvander@1049: static ConVar *hostname = NULL;
dvander@1049: if (!hostname)
dvander@1049: {
dvander@1049: hostname = icvar->FindVar("hostname");
dvander@1049: if (!hostname)
dvander@1049: {
dvander@1049: return pCtx->ThrowNativeError("Could not find \"hostname\" cvar");
dvander@1049: }
dvander@1049: }
dvander@1049: pCtx->StringToLocalUTF8(params[2], static_cast(params[3]), hostname->GetString(), NULL);
dvander@1049: return 1;
dvander@1049: }
dvander@1049:
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242: }
faluco@242:
dvander@448: CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435: if (!pPlayer->IsConnected())
faluco@260: {
ds@470: return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260: }
faluco@260:
dvander@435: pCtx->StringToLocalUTF8(params[2], static_cast(params[3]), pPlayer->GetName(), NULL);
faluco@242: return 1;
faluco@242: }
faluco@242:
faluco@260: static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242: }
faluco@242:
dvander@448: CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435: if (!pPlayer->IsConnected())
faluco@260: {
ds@470: return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260: }
faluco@260:
faluco@280: char buf[64], *ptr;
dvander@435: strcpy(buf, pPlayer->GetIPAddress());
faluco@280:
faluco@280: if (params[4] && (ptr = strchr(buf, ':')))
faluco@280: {
faluco@280: *ptr = '\0';
faluco@280: }
faluco@280:
faluco@280: pCtx->StringToLocal(params[2], static_cast(params[3]), buf);
faluco@242: return 1;
faluco@242: }
faluco@242:
faluco@260: static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242: }
faluco@242:
dvander@448: CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435: if (!pPlayer->IsConnected())
faluco@260: {
ds@470: return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260: }
faluco@260:
dvander@449: if (!pPlayer->IsAuthorized())
dvander@449: {
dvander@449: return 0;
dvander@449: }
dvander@449:
dvander@435: pCtx->StringToLocal(params[2], static_cast(params[3]), pPlayer->GetAuthString());
dvander@449:
faluco@242: return 1;
faluco@242: }
faluco@242:
ds@784: static cell_t sm_IsClientConnected(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242: }
faluco@242:
dvander@448: return (g_Players.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
faluco@242: }
faluco@242:
ds@784: static cell_t sm_IsClientInGame(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242: }
faluco@242:
dvander@448: return (g_Players.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
faluco@242: }
faluco@242:
ds@784: static cell_t sm_IsClientAuthorized(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242: }
faluco@242:
dvander@448: return (g_Players.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
faluco@242: }
faluco@242:
ds@784: static cell_t sm_IsClientFakeClient(IPluginContext *pCtx, const cell_t *params)
faluco@242: {
faluco@242: int index = params[1];
dvander@448: if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242: {
ds@994: return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@260: }
faluco@260:
dvander@448: CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435: if (!pPlayer->IsConnected())
faluco@260: {
ds@470: return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@242: }
faluco@242:
dvander@435: return (pPlayer->IsFakeClient()) ? 1 : 0;
faluco@260: }
faluco@260:
ds@1001: static cell_t IsClientObserver(IPluginContext *pContext, const cell_t *params)
ds@1001: {
ds@1001: int client = params[1];
ds@1001:
ds@1001: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
ds@1001: if (!pPlayer)
ds@1001: {
ds@1001: return pContext->ThrowNativeError("Client index %d is invalid", client);
ds@1001: } else if (!pPlayer->IsInGame()) {
ds@1001: return pContext->ThrowNativeError("Client %d is not in game", client);
ds@1001: }
ds@1001:
ds@1001: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
ds@1001: if (!pInfo)
ds@1001: {
ds@1001: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
ds@1001: }
ds@1001:
ds@1001: return pInfo->IsObserver() ? 1 : 0;
ds@1001: }
ds@1001:
dvander@456: static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
dvander@456: {
dvander@456: int client = params[1];
dvander@456: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@456: if (!pPlayer)
dvander@456: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@456: }
dvander@456: if (!pPlayer->IsConnected())
dvander@456: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@456: }
dvander@456:
dvander@456: char *key;
dvander@456: pContext->LocalToString(params[2], &key);
dvander@456:
dvander@456: const char *val = engine->GetClientConVarValue(client, key);
dvander@456: if (!val)
dvander@456: {
dvander@456: return false;
dvander@456: }
dvander@456:
dvander@456: pContext->StringToLocalUTF8(params[3], params[4], val, NULL);
dvander@456: return 1;
dvander@456: }
dvander@456:
dvander@458: static cell_t SetUserAdmin(IPluginContext *pContext, const cell_t *params)
dvander@458: {
dvander@458: int client = params[1];
dvander@458: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458: if (!pPlayer)
dvander@458: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458: }
dvander@458: if (!pPlayer->IsConnected())
dvander@458: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458: }
dvander@458: if (!g_Admins.IsValidAdmin(params[2]))
dvander@458: {
ds@994: return pContext->ThrowNativeError("AdminId %x is invalid", params[2]);
dvander@458: }
dvander@458:
dvander@458: pPlayer->SetAdminId(params[2], params[3] ? true : false);
dvander@458:
dvander@458: return 1;
dvander@458: }
dvander@458:
dvander@458: static cell_t GetUserAdmin(IPluginContext *pContext, const cell_t *params)
dvander@458: {
dvander@458: int client = params[1];
dvander@458: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458: if (!pPlayer)
dvander@458: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458: }
dvander@458: if (!pPlayer->IsConnected())
dvander@458: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458: }
dvander@458:
dvander@458: return pPlayer->GetAdminId();
dvander@458: }
dvander@458:
dvander@458: static cell_t AddUserFlags(IPluginContext *pContext, const cell_t *params)
dvander@458: {
dvander@458: int client = params[1];
dvander@458: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458: if (!pPlayer)
dvander@458: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458: }
dvander@458: if (!pPlayer->IsConnected())
dvander@458: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458: }
dvander@458:
dvander@458: AdminId id;
dvander@458: if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458: {
dvander@458: id = g_Admins.CreateAdmin(NULL);
dvander@458: pPlayer->SetAdminId(id, true);
dvander@458: }
dvander@458:
dvander@458: cell_t *addr;
dvander@458: for (int i=2; i<=params[0]; i++)
dvander@458: {
dvander@458: pContext->LocalToPhysAddr(params[i], &addr);
dvander@458: g_Admins.SetAdminFlag(id, (AdminFlag)*addr, true);
dvander@458: }
dvander@458:
dvander@458: return 1;
dvander@458: }
dvander@458:
dvander@458: static cell_t RemoveUserFlags(IPluginContext *pContext, const cell_t *params)
dvander@458: {
dvander@458: int client = params[1];
dvander@458: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458: if (!pPlayer)
dvander@458: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458: }
dvander@458: if (!pPlayer->IsConnected())
dvander@458: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458: }
dvander@458:
dvander@458: AdminId id;
dvander@458: if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458: {
dvander@458: return 0;
dvander@458: }
dvander@458:
dvander@458: cell_t *addr;
dvander@458: for (int i=2; i<=params[0]; i++)
dvander@458: {
dvander@458: pContext->LocalToPhysAddr(params[i], &addr);
dvander@458: g_Admins.SetAdminFlag(id, (AdminFlag)*addr, false);
dvander@458: }
dvander@458:
dvander@458: return 1;
dvander@458: }
dvander@458:
dvander@458: static cell_t SetUserFlagBits(IPluginContext *pContext, const cell_t *params)
dvander@458: {
dvander@458: int client = params[1];
dvander@458: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458: if (!pPlayer)
dvander@458: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458: }
dvander@458: if (!pPlayer->IsConnected())
dvander@458: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458: }
dvander@458:
dvander@458: AdminId id;
dvander@458: if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458: {
dvander@458: id = g_Admins.CreateAdmin(NULL);
dvander@458: pPlayer->SetAdminId(id, true);
dvander@458: }
dvander@458:
dvander@458: g_Admins.SetAdminFlags(id, Access_Effective, params[2]);
dvander@458:
dvander@458: return 1;
dvander@458: }
dvander@458:
dvander@458: static cell_t GetUserFlagBits(IPluginContext *pContext, const cell_t *params)
dvander@458: {
dvander@458: int client = params[1];
dvander@458: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458: if (!pPlayer)
dvander@458: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458: }
dvander@458: if (!pPlayer->IsConnected())
dvander@458: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458: }
dvander@458:
dvander@458: AdminId id;
dvander@458: if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458: {
dvander@458: return 0;
dvander@458: }
dvander@458:
dvander@458: return g_Admins.GetAdminFlags(id, Access_Effective);
dvander@458: }
dvander@458:
dvander@460: static cell_t GetClientUserId(IPluginContext *pContext, const cell_t *params)
dvander@460: {
dvander@460: int client = params[1];
dvander@460: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@460: if (!pPlayer)
dvander@460: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@460: }
dvander@460: if (!pPlayer->IsConnected())
dvander@460: {
ds@470: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@460: }
dvander@460:
dvander@460: return engine->GetPlayerUserId(pPlayer->GetEdict());
dvander@460: }
dvander@460:
dvander@540: static cell_t CanUserTarget(IPluginContext *pContext, const cell_t *params)
dvander@540: {
dvander@540: int client = params[1];
dvander@540: int target = params[2];
dvander@540:
dvander@1035: if (client == 0)
dvander@1035: {
dvander@1035: return 1;
dvander@1035: }
dvander@1035:
dvander@540: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@540: if (!pPlayer)
dvander@540: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@540: } else if (!pPlayer->IsConnected()) {
ds@994: return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@540: }
dvander@540:
dvander@540: CPlayer *pTarget = g_Players.GetPlayerByIndex(target);
dvander@540: if (!pTarget)
dvander@540: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", target);
dvander@540: } else if (!pTarget->IsConnected()) {
ds@994: return pContext->ThrowNativeError("Client %d is not connected", target);
dvander@540: }
dvander@540:
dvander@540: return g_Admins.CanAdminTarget(pPlayer->GetAdminId(), pTarget->GetAdminId()) ? 1 : 0;
dvander@540: }
dvander@540:
dvander@644: static cell_t GetClientTeam(IPluginContext *pContext, const cell_t *params)
dvander@644: {
dvander@644: int client = params[1];
dvander@644:
dvander@644: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@644: if (!pPlayer)
dvander@644: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@644: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@644: }
dvander@644:
dvander@644: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
dvander@644: if (!pInfo)
dvander@644: {
dvander@644: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
dvander@644: }
dvander@644:
dvander@644: return pInfo->GetTeamIndex();
dvander@644: }
dvander@644:
faluco@658: static cell_t GetFragCount(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: return pInfo->GetFragCount();
faluco@658: }
faluco@658:
faluco@658: static cell_t GetDeathCount(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: return pInfo->GetDeathCount();
faluco@658: }
faluco@658:
faluco@658: static cell_t GetArmorValue(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: return pInfo->GetArmorValue();
faluco@658: }
faluco@658:
faluco@658: static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: cell_t *pVec;
faluco@658: pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658:
faluco@658: Vector vec = pInfo->GetAbsOrigin();
faluco@658: pVec[0] = sp_ftoc(vec.x);
faluco@658: pVec[1] = sp_ftoc(vec.y);
faluco@658: pVec[2] = sp_ftoc(vec.z);
faluco@658:
faluco@658: return 1;
faluco@658: }
faluco@658:
faluco@658: static cell_t GetAbsAngles(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: cell_t *pAng;
faluco@658: pContext->LocalToPhysAddr(params[2], &pAng);
faluco@658:
faluco@658: QAngle ang = pInfo->GetAbsAngles();
faluco@658: pAng[0] = sp_ftoc(ang.x);
faluco@658: pAng[1] = sp_ftoc(ang.y);
faluco@658: pAng[2] = sp_ftoc(ang.z);
faluco@658:
faluco@658: return 1;
faluco@658: }
faluco@658:
faluco@658: static cell_t GetPlayerMins(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: cell_t *pVec;
faluco@658: pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658:
faluco@658: Vector vec = pInfo->GetPlayerMins();
faluco@658: pVec[0] = sp_ftoc(vec.x);
faluco@658: pVec[1] = sp_ftoc(vec.y);
faluco@658: pVec[2] = sp_ftoc(vec.z);
faluco@658:
faluco@658: return 1;
faluco@658: }
faluco@658:
faluco@658: static cell_t GetPlayerMaxs(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: cell_t *pVec;
faluco@658: pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658:
faluco@658: Vector vec = pInfo->GetPlayerMaxs();
faluco@658: pVec[0] = sp_ftoc(vec.x);
faluco@658: pVec[1] = sp_ftoc(vec.y);
faluco@658: pVec[2] = sp_ftoc(vec.z);
faluco@658:
faluco@658: return 1;
faluco@658: }
faluco@658:
faluco@658: static cell_t GetWeaponName(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@756: const char *weapon = pInfo->GetWeaponName();
faluco@756: pContext->StringToLocalUTF8(params[2], static_cast(params[3]), weapon ? weapon : "", NULL);
faluco@658:
faluco@658: return 1;
faluco@658: }
faluco@658:
faluco@658: static cell_t GetModelName(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@756: const char *model = pInfo->GetModelName();
faluco@756: pContext->StringToLocalUTF8(params[2], static_cast(params[3]), model ? model : "", NULL);
faluco@658:
faluco@658: return 1;
faluco@658: }
faluco@658:
faluco@658: static cell_t GetHealth(IPluginContext *pContext, const cell_t *params)
faluco@658: {
faluco@658: int client = params[1];
faluco@658:
faluco@658: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658: if (!pPlayer)
faluco@658: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658: }
faluco@658:
faluco@658: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658: if (!pInfo)
faluco@658: {
faluco@658: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658: }
faluco@658:
faluco@658: return pInfo->GetHealth();
faluco@658: }
faluco@658:
faluco@682: static cell_t GetTimeConnected(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetTimeConnected());
faluco@682: }
faluco@682:
faluco@682: static cell_t GetDataRate(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return pInfo->GetDataRate();
faluco@682: }
faluco@682:
faluco@682: static cell_t IsTimingOut(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return pInfo->IsTimingOut() ? 1 : 0;
faluco@682: }
faluco@682:
faluco@682: static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetLatency(params[2]));
faluco@682: }
faluco@682:
faluco@682: static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetAvgLatency(params[2]));
faluco@682: }
faluco@682:
faluco@682: static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetAvgLoss(params[2]));
faluco@682: }
faluco@682:
faluco@682: static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetAvgChoke(params[2]));
faluco@682: }
faluco@682:
faluco@682: static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetAvgData(params[2]));
faluco@682: }
faluco@682:
faluco@682: static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: int client = params[1];
faluco@682:
faluco@682: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682: if (!pPlayer)
faluco@682: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682: } else if (!pPlayer->IsInGame()) {
ds@994: return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682: } else if (pPlayer->IsFakeClient()) {
ds@994: return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682: }
faluco@682:
faluco@682: INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682:
faluco@682: return sp_ftoc(pInfo->GetAvgPackets(params[2]));
faluco@682: }
faluco@682:
faluco@682: static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
faluco@682: {
faluco@682: return g_Players.GetClientOfUserId(params[1]);
faluco@682: }
faluco@682:
dvander@1104: static cell_t _ShowActivity(IPluginContext *pContext, const cell_t *params, const char *tag, cell_t fmt_param)
dvander@910: {
dvander@924: char message[255];
dvander@924: char buffer[255];
dvander@910: int value = sm_show_activity.GetInt();
dvander@924: unsigned int replyto = g_ChatTriggers.GetReplyTo();
dvander@910: int client = params[1];
dvander@910:
dvander@910: const char *name = "Console";
dvander@910: const char *sign = "ADMIN";
dvander@924: bool display_in_chat = false;
dvander@910: if (client != 0)
dvander@910: {
dvander@910: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@910: if (!pPlayer || !pPlayer->IsConnected())
dvander@910: {
dvander@910: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@910: }
dvander@910: name = pPlayer->GetName();
dvander@910: AdminId id = pPlayer->GetAdminId();
dvander@910: if (id == INVALID_ADMIN_ID
dvander@910: || !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@910: {
dvander@910: sign = "PLAYER";
dvander@910: }
dvander@924:
dvander@924: /* Display the message to the client? */
dvander@924: if (replyto == SM_REPLY_CONSOLE)
dvander@924: {
dvander@924: g_SourceMod.SetGlobalTarget(client);
dvander@1104: g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1104: UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
dvander@924: engine->ClientPrintf(pPlayer->GetEdict(), message);
dvander@924: display_in_chat = true;
dvander@924: }
dvander@924: } else {
dvander@924: g_SourceMod.SetGlobalTarget(LANG_SERVER);
dvander@1104: g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1104: UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
dvander@924: META_CONPRINT(message);
dvander@910: }
dvander@910:
dvander@924: if (!value)
dvander@924: {
dvander@924: return 1;
dvander@924: }
dvander@924:
dvander@910: int maxClients = g_Players.GetMaxClients();
dvander@910: for (int i=1; i<=maxClients; i++)
dvander@910: {
dvander@910: CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@924: if (!pPlayer->IsInGame()
dvander@924: || pPlayer->IsFakeClient()
dvander@924: || (display_in_chat && i == client))
dvander@910: {
dvander@910: continue;
dvander@910: }
dvander@910: AdminId id = pPlayer->GetAdminId();
dvander@910: g_SourceMod.SetGlobalTarget(i);
dvander@910: if (id == INVALID_ADMIN_ID
dvander@910: || !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@910: {
dvander@910: /* Treat this as a normal user */
dvander@910: if ((value & 1) || (value & 2))
dvander@910: {
dvander@910: const char *newsign = sign;
dvander@910: if (value & 2)
dvander@910: {
dvander@910: newsign = name;
dvander@910: }
dvander@1104: g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1104: UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
dvander@910: g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@910: }
dvander@910: } else {
dvander@910: /* Treat this as an admin user */
dvander@910: bool is_root = g_Admins.GetAdminFlag(id, Admin_Root, Access_Effective);
dvander@910: if ((value & 4)
dvander@910: || (value & 8)
dvander@910: || ((value & 16) && is_root))
dvander@910: {
dvander@910: const char *newsign = sign;
dvander@910: if ((value & 8) || ((value & 16) && is_root))
dvander@910: {
dvander@910: newsign = name;
dvander@910: }
dvander@1104: g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1104: UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
dvander@910: g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@910: }
dvander@910: }
dvander@910: }
dvander@910:
dvander@910: return 1;
dvander@910: }
dvander@910:
dvander@1104: static cell_t ShowActivity(IPluginContext *pContext, const cell_t *params)
dvander@1104: {
dvander@1104: return _ShowActivity(pContext, params, "[SM] ", 2);
dvander@1104: }
dvander@1104:
dvander@1104: static cell_t ShowActivityEx(IPluginContext *pContext, const cell_t *params)
dvander@1104: {
dvander@1104: char *str;
dvander@1104: pContext->LocalToString(params[2], &str);
dvander@1104:
dvander@1104: return _ShowActivity(pContext, params, str, 3);
dvander@1104: }
dvander@1104:
ds@992: static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
ds@992: {
ds@992: int client = params[1];
ds@992:
ds@992: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
ds@992: if (!pPlayer)
ds@992: {
ds@994: return pContext->ThrowNativeError("Client index %d is invalid", client);
ds@992: } else if (!pPlayer->IsConnected()) {
ds@992: return pContext->ThrowNativeError("Client %d is not connected", client);
ds@992: }
ds@992:
ds@992: if (pPlayer->IsFakeClient())
ds@992: {
ds@998: char kickcmd[40];
ds@992: UTIL_Format(kickcmd, sizeof(kickcmd), "kick %s\n", pPlayer->GetName());
ds@992:
ds@992: engine->ServerCommand(kickcmd);
ds@992: return 1;
ds@992: }
ds@992:
ds@992: INetChannel *pNetChan = static_cast(engine->GetPlayerNetInfo(client));
ds@992: IClient *pClient = static_cast(pNetChan->GetMsgHandler());
ds@992:
dvander@1011: g_SourceMod.SetGlobalTarget(client);
dvander@1011:
ds@992: char buffer[256];
ds@992: g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
ds@992:
dvander@1273: if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1273: {
dvander@1273: return 0;
dvander@1273: }
dvander@1273:
ds@992: pClient->Disconnect("%s", buffer);
ds@992:
ds@992: return 1;
ds@992: }
ds@992:
dvander@1033: static cell_t ChangeClientTeam(IPluginContext *pContext, const cell_t *params)
dvander@1033: {
dvander@1033: int client = params[1];
dvander@1033:
dvander@1033: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1033: if (!pPlayer)
dvander@1033: {
dvander@1033: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1033: } else if (!pPlayer->IsInGame()) {
dvander@1033: return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1033: }
dvander@1033:
dvander@1033: IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
dvander@1033: if (!pInfo)
dvander@1033: {
dvander@1033: return pContext->ThrowNativeError("IPlayerInfo not supported by game");
dvander@1033: }
dvander@1033:
dvander@1033: pInfo->ChangeTeam(params[2]);
dvander@1033:
dvander@1033: return 1;
dvander@1033: }
dvander@1033:
dvander@1273: static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params)
dvander@1273: {
dvander@1273: int client = params[1];
dvander@1273:
dvander@1273: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1273: if (!pPlayer)
dvander@1273: {
dvander@1273: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1273: } else if (!pPlayer->IsInGame()) {
dvander@1273: return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1273: } else if (!pPlayer->IsAuthorized()) {
dvander@1273: return pContext->ThrowNativeError("Client %d is not authorized", client);
dvander@1273: }
dvander@1273:
dvander@1273: AdminId id = pPlayer->GetAdminId();
dvander@1273: pPlayer->DoBasicAdminChecks();
dvander@1273:
dvander@1273: return (id != pPlayer->GetAdminId()) ? 1 : 0;
dvander@1273: }
dvander@1273:
dvander@1273: static cell_t NotifyPostAdminCheck(IPluginContext *pContext, const cell_t *params)
dvander@1273: {
dvander@1273: int client = params[1];
dvander@1273:
dvander@1273: CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1273: if (!pPlayer)
dvander@1273: {
dvander@1273: return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1273: } else if (!pPlayer->IsInGame()) {
dvander@1273: return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1273: } else if (!pPlayer->IsAuthorized()) {
dvander@1273: return pContext->ThrowNativeError("Client %d is not authorized", client);
dvander@1273: }
dvander@1273:
dvander@1273: pPlayer->NotifyPostAdminChecks();
dvander@1273:
dvander@1273: return 1;
dvander@1273: }
dvander@1273:
faluco@260: REGISTER_NATIVES(playernatives)
faluco@260: {
dvander@644: {"AddUserFlags", AddUserFlags},
dvander@644: {"CanUserTarget", CanUserTarget},
dvander@1033: {"ChangeClientTeam", ChangeClientTeam},
dvander@644: {"GetClientAuthString", sm_GetClientAuthStr},
faluco@260: {"GetClientCount", sm_GetClientCount},
dvander@644: {"GetClientInfo", sm_GetClientInfo},
faluco@260: {"GetClientIP", sm_GetClientIP},
dvander@644: {"GetClientName", sm_GetClientName},
dvander@644: {"GetClientTeam", GetClientTeam},
dvander@644: {"GetClientUserId", GetClientUserId},
dvander@644: {"GetMaxClients", sm_GetMaxClients},
dvander@644: {"GetUserAdmin", GetUserAdmin},
dvander@644: {"GetUserFlagBits", GetUserFlagBits},
ds@784: {"IsClientAuthorized", sm_IsClientAuthorized},
ds@784: {"IsClientConnected", sm_IsClientConnected},
ds@784: {"IsFakeClient", sm_IsClientFakeClient},
ds@784: {"IsPlayerInGame", sm_IsClientInGame}, /* Backwards compat shim */
ds@784: {"IsClientInGame", sm_IsClientInGame},
ds@1001: {"IsClientObserver", IsClientObserver},
dvander@458: {"RemoveUserFlags", RemoveUserFlags},
dvander@644: {"SetUserAdmin", SetUserAdmin},
dvander@458: {"SetUserFlagBits", SetUserFlagBits},
faluco@658: {"GetClientDeaths", GetDeathCount},
faluco@658: {"GetClientFrags", GetFragCount},
faluco@658: {"GetClientArmor", GetArmorValue},
faluco@658: {"GetClientAbsOrigin", GetAbsOrigin},
faluco@658: {"GetClientAbsAngles", GetAbsAngles},
faluco@658: {"GetClientMins", GetPlayerMins},
faluco@658: {"GetClientMaxs", GetPlayerMaxs},
faluco@658: {"GetClientWeapon", GetWeaponName},
faluco@658: {"GetClientModel", GetModelName},
faluco@658: {"GetClientHealth", GetHealth},
dvander@691: {"GetClientTime", GetTimeConnected},
dvander@691: {"GetClientDataRate", GetDataRate},
dvander@691: {"IsClentTimingOut", IsTimingOut},
dvander@691: {"GetClientLatency", GetLatency},
dvander@691: {"GetClientAvgLatency", GetAvgLatency},
dvander@691: {"GetClientAvgLoss", GetAvgLoss},
dvander@691: {"GetClientAvgChoke", GetAvgChoke},
dvander@691: {"GetClientAvgData", GetAvgData},
dvander@691: {"GetClientAvgPackets", GetAvgPackets},
faluco@682: {"GetClientOfUserId", GetClientOfUserId},
dvander@910: {"ShowActivity", ShowActivity},
dvander@1110: {"ShowActivityEx", ShowActivityEx},
ds@992: {"KickClient", KickClient},
dvander@1273: {"RunAdminCacheChecks", RunAdminCacheChecks},
dvander@1273: {"NotifyPostAdminCheck", NotifyPostAdminCheck},
faluco@260: {NULL, NULL}
dvander@351: };