core/smn_player.cpp
author Borja Ferrer <faluco@alliedmods.net>
Sat Feb 23 20:18:49 2008 +0000 (2008-02-23)
changeset 1894 e6efc8ffa47a
parent 1839 1f3aaf8fbd12
child 1936 89d6e5038933
permissions -rw-r--r--
Executable memory is now provided by MM:S's allocator, this should reduce virtual memory usage.
dvander@370
     1
/**
ds@653
     2
 * vim: set ts=4 :
ds@1330
     3
 * =============================================================================
dvander@1231
     4
 * SourceMod
dvander@1231
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
ds@1330
     6
 * =============================================================================
dvander@370
     7
 *
ds@1330
     8
 * This program is free software; you can redistribute it and/or modify it under
ds@1330
     9
 * the terms of the GNU General Public License, version 3.0, as published by the
ds@1330
    10
 * Free Software Foundation.
dvander@1231
    11
 * 
ds@1330
    12
 * This program is distributed in the hope that it will be useful, but WITHOUT
ds@1330
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
ds@1330
    14
 * FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more
ds@1330
    15
 * details.
dvander@1231
    16
 *
ds@1330
    17
 * You should have received a copy of the GNU General Public License along with
ds@1330
    18
 * this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1231
    19
 *
ds@1330
    20
 * As a special exception, AlliedModders LLC gives you permission to link the
ds@1330
    21
 * code of this program (as well as its derivative works) to "Half-Life 2," the
ds@1330
    22
 * "Source Engine," the "SourcePawn JIT," and any Game MODs that run on software
ds@1330
    23
 * by the Valve Corporation.  You must obey the GNU General Public License in
ds@1330
    24
 * all respects for all other code used.  Additionally, AlliedModders LLC grants
ds@1330
    25
 * this exception to all derivative works.  AlliedModders LLC defines further
ds@1330
    26
 * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
ds@1330
    27
 * or <http://www.sourcemod.net/license.php>.
dvander@370
    28
 *
dvander@370
    29
 * Version: $Id$
dvander@370
    30
 */
dvander@370
    31
dvander@591
    32
#include "PlayerManager.h"
dvander@458
    33
#include "AdminCache.h"
faluco@280
    34
#include "sm_stringutil.h"
dvander@910
    35
#include "HalfLife2.h"
dvander@910
    36
#include "sourcemod.h"
dvander@924
    37
#include "ChatTriggers.h"
ds@992
    38
#include <inetchannel.h>
ds@992
    39
#include <iclient.h>
faluco@242
    40
dvander@1839
    41
ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY, "Activity display setting (see sourcemod.cfg)");
dvander@910
    42
faluco@260
    43
static cell_t sm_GetClientCount(IPluginContext *pCtx, const cell_t *params)
faluco@242
    44
{
faluco@242
    45
	if (params[1])
faluco@242
    46
	{
dvander@448
    47
		return g_Players.NumPlayers();
faluco@242
    48
	}
faluco@242
    49
dvander@448
    50
	int maxplayers = g_Players.MaxClients();
faluco@242
    51
	int count = 0;
faluco@242
    52
	for (int i=1; i<=maxplayers; ++i)
faluco@242
    53
	{
dvander@448
    54
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@435
    55
		if ((pPlayer->IsConnected()) && !(pPlayer->IsInGame()))
faluco@242
    56
		{
faluco@242
    57
			count++;
faluco@242
    58
		}
faluco@242
    59
	}
faluco@242
    60
dvander@448
    61
	return (g_Players.NumPlayers() + count);
faluco@242
    62
}
faluco@242
    63
faluco@260
    64
static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
faluco@242
    65
{
dvander@448
    66
	return g_Players.MaxClients();
faluco@242
    67
}
faluco@242
    68
faluco@260
    69
static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
faluco@242
    70
{
faluco@242
    71
	int index = params[1];
dvander@1049
    72
dvander@1049
    73
	if (index == 0)
dvander@1049
    74
	{
dvander@1049
    75
		static ConVar *hostname = NULL;
dvander@1049
    76
		if (!hostname)
dvander@1049
    77
		{
dvander@1049
    78
			hostname = icvar->FindVar("hostname");
dvander@1049
    79
			if (!hostname)
dvander@1049
    80
			{
dvander@1049
    81
				return pCtx->ThrowNativeError("Could not find \"hostname\" cvar");
dvander@1049
    82
			}
dvander@1049
    83
		}
dvander@1049
    84
		pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), hostname->GetString(), NULL);
dvander@1049
    85
		return 1;
dvander@1049
    86
	}
dvander@1049
    87
dvander@448
    88
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
    89
	{
ds@994
    90
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242
    91
	}
faluco@242
    92
dvander@448
    93
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
    94
	if (!pPlayer->IsConnected())
faluco@260
    95
	{
ds@470
    96
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260
    97
	}
faluco@260
    98
dvander@435
    99
	pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), pPlayer->GetName(), NULL);
faluco@242
   100
	return 1;
faluco@242
   101
}
faluco@242
   102
faluco@260
   103
static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
faluco@242
   104
{
faluco@242
   105
	int index = params[1];
dvander@448
   106
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   107
	{
ds@994
   108
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242
   109
	}
faluco@242
   110
dvander@448
   111
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
   112
	if (!pPlayer->IsConnected())
faluco@260
   113
	{
ds@470
   114
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260
   115
	}
faluco@260
   116
faluco@280
   117
	char buf[64], *ptr;
dvander@435
   118
	strcpy(buf, pPlayer->GetIPAddress());
faluco@280
   119
faluco@280
   120
	if (params[4] && (ptr = strchr(buf, ':')))
faluco@280
   121
	{
faluco@280
   122
		*ptr = '\0';
faluco@280
   123
	}
faluco@280
   124
faluco@280
   125
	pCtx->StringToLocal(params[2], static_cast<size_t>(params[3]), buf);
faluco@242
   126
	return 1;
faluco@242
   127
}
faluco@242
   128
faluco@260
   129
static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
faluco@242
   130
{
faluco@242
   131
	int index = params[1];
dvander@448
   132
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   133
	{
ds@994
   134
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242
   135
	}
faluco@242
   136
dvander@448
   137
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
   138
	if (!pPlayer->IsConnected())
faluco@260
   139
	{
ds@470
   140
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260
   141
	}
faluco@260
   142
dvander@449
   143
	if (!pPlayer->IsAuthorized())
dvander@449
   144
	{
dvander@449
   145
		return 0;
dvander@449
   146
	}
dvander@449
   147
dvander@435
   148
	pCtx->StringToLocal(params[2], static_cast<size_t>(params[3]), pPlayer->GetAuthString());
dvander@449
   149
faluco@242
   150
	return 1;
faluco@242
   151
}
faluco@242
   152
ds@784
   153
static cell_t sm_IsClientConnected(IPluginContext *pCtx, const cell_t *params)
faluco@242
   154
{
faluco@242
   155
	int index = params[1];
dvander@448
   156
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   157
	{
ds@994
   158
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242
   159
	}
faluco@242
   160
dvander@448
   161
	return (g_Players.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
faluco@242
   162
}
faluco@242
   163
ds@784
   164
static cell_t sm_IsClientInGame(IPluginContext *pCtx, const cell_t *params)
faluco@242
   165
{
faluco@242
   166
	int index = params[1];
dvander@448
   167
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   168
	{
ds@994
   169
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242
   170
	}
faluco@242
   171
dvander@448
   172
	return (g_Players.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
faluco@242
   173
}
faluco@242
   174
ds@784
   175
static cell_t sm_IsClientAuthorized(IPluginContext *pCtx, const cell_t *params)
faluco@242
   176
{
faluco@242
   177
	int index = params[1];
dvander@448
   178
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   179
	{
ds@994
   180
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@242
   181
	}
faluco@242
   182
dvander@448
   183
	return (g_Players.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
faluco@242
   184
}
faluco@242
   185
ds@784
   186
static cell_t sm_IsClientFakeClient(IPluginContext *pCtx, const cell_t *params)
faluco@242
   187
{
faluco@242
   188
	int index = params[1];
dvander@448
   189
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   190
	{
ds@994
   191
		return pCtx->ThrowNativeError("Client index %d is invalid", index);
faluco@260
   192
	}
faluco@260
   193
dvander@448
   194
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
   195
	if (!pPlayer->IsConnected())
faluco@260
   196
	{
ds@470
   197
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@242
   198
	}
faluco@242
   199
dvander@435
   200
	return (pPlayer->IsFakeClient()) ? 1 : 0;
faluco@260
   201
}
faluco@260
   202
ds@1001
   203
static cell_t IsClientObserver(IPluginContext *pContext, const cell_t *params)
ds@1001
   204
{
ds@1001
   205
	int client = params[1];
ds@1001
   206
ds@1001
   207
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
ds@1001
   208
	if (!pPlayer)
ds@1001
   209
	{
ds@1001
   210
		return pContext->ThrowNativeError("Client index %d is invalid", client);
ds@1001
   211
	} else if (!pPlayer->IsInGame()) {
ds@1001
   212
		return pContext->ThrowNativeError("Client %d is not in game", client);
ds@1001
   213
	}
ds@1001
   214
ds@1001
   215
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
ds@1001
   216
	if (!pInfo)
ds@1001
   217
	{
ds@1001
   218
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
ds@1001
   219
	}
ds@1001
   220
ds@1001
   221
	return pInfo->IsObserver() ? 1 : 0;
ds@1001
   222
}
ds@1001
   223
dvander@456
   224
static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
dvander@456
   225
{
dvander@456
   226
	int client = params[1];
dvander@456
   227
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@456
   228
	if (!pPlayer)
dvander@456
   229
	{
ds@994
   230
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@456
   231
	}
dvander@456
   232
	if (!pPlayer->IsConnected())
dvander@456
   233
	{
ds@470
   234
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@456
   235
	}
dvander@456
   236
dvander@456
   237
	char *key;
dvander@456
   238
	pContext->LocalToString(params[2], &key);
dvander@456
   239
dvander@456
   240
	const char *val = engine->GetClientConVarValue(client, key);
dvander@456
   241
	if (!val)
dvander@456
   242
	{
dvander@456
   243
		return false;
dvander@456
   244
	}
dvander@456
   245
dvander@456
   246
	pContext->StringToLocalUTF8(params[3], params[4], val, NULL);
dvander@456
   247
	return 1;
dvander@456
   248
}
dvander@456
   249
dvander@458
   250
static cell_t SetUserAdmin(IPluginContext *pContext, const cell_t *params)
dvander@458
   251
{
dvander@458
   252
	int client = params[1];
dvander@458
   253
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   254
	if (!pPlayer)
dvander@458
   255
	{
ds@994
   256
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458
   257
	}
dvander@458
   258
	if (!pPlayer->IsConnected())
dvander@458
   259
	{
ds@470
   260
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   261
	}
dvander@1685
   262
	if (!g_Admins.IsValidAdmin(params[2]) && params[2] != INVALID_ADMIN_ID)
dvander@458
   263
	{
ds@994
   264
		return pContext->ThrowNativeError("AdminId %x is invalid", params[2]);
dvander@458
   265
	}
dvander@458
   266
dvander@458
   267
	pPlayer->SetAdminId(params[2], params[3] ? true : false);
dvander@458
   268
dvander@458
   269
	return 1;
dvander@458
   270
}
dvander@458
   271
dvander@458
   272
static cell_t GetUserAdmin(IPluginContext *pContext, const cell_t *params)
dvander@458
   273
{
dvander@458
   274
	int client = params[1];
dvander@458
   275
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   276
	if (!pPlayer)
dvander@458
   277
	{
ds@994
   278
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458
   279
	}
dvander@458
   280
	if (!pPlayer->IsConnected())
dvander@458
   281
	{
ds@470
   282
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   283
	}
dvander@458
   284
dvander@458
   285
	return pPlayer->GetAdminId();
dvander@458
   286
}
dvander@458
   287
dvander@458
   288
static cell_t AddUserFlags(IPluginContext *pContext, const cell_t *params)
dvander@458
   289
{
dvander@458
   290
	int client = params[1];
dvander@458
   291
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   292
	if (!pPlayer)
dvander@458
   293
	{
ds@994
   294
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458
   295
	}
dvander@458
   296
	if (!pPlayer->IsConnected())
dvander@458
   297
	{
ds@470
   298
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   299
	}
dvander@458
   300
dvander@458
   301
	AdminId id;
dvander@458
   302
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   303
	{
dvander@458
   304
		id = g_Admins.CreateAdmin(NULL);
dvander@458
   305
		pPlayer->SetAdminId(id, true);
dvander@458
   306
	}
dvander@458
   307
dvander@458
   308
	cell_t *addr;
dvander@458
   309
	for (int i=2; i<=params[0]; i++)
dvander@458
   310
	{
dvander@458
   311
		pContext->LocalToPhysAddr(params[i], &addr);
dvander@458
   312
		g_Admins.SetAdminFlag(id, (AdminFlag)*addr, true);
dvander@458
   313
	}
dvander@458
   314
dvander@458
   315
	return 1;
dvander@458
   316
}
dvander@458
   317
dvander@458
   318
static cell_t RemoveUserFlags(IPluginContext *pContext, const cell_t *params)
dvander@458
   319
{
dvander@458
   320
	int client = params[1];
dvander@458
   321
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   322
	if (!pPlayer)
dvander@458
   323
	{
ds@994
   324
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458
   325
	}
dvander@458
   326
	if (!pPlayer->IsConnected())
dvander@458
   327
	{
ds@470
   328
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   329
	}
dvander@458
   330
	
dvander@458
   331
	AdminId id;
dvander@458
   332
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   333
	{
dvander@458
   334
		return 0;
dvander@458
   335
	}
dvander@458
   336
dvander@458
   337
	cell_t *addr;
dvander@458
   338
	for (int i=2; i<=params[0]; i++)
dvander@458
   339
	{
dvander@458
   340
		pContext->LocalToPhysAddr(params[i], &addr);
dvander@458
   341
		g_Admins.SetAdminFlag(id, (AdminFlag)*addr, false);
dvander@458
   342
	}
dvander@458
   343
dvander@458
   344
	return 1;
dvander@458
   345
}
dvander@458
   346
dvander@458
   347
static cell_t SetUserFlagBits(IPluginContext *pContext, const cell_t *params)
dvander@458
   348
{
dvander@458
   349
	int client = params[1];
dvander@458
   350
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   351
	if (!pPlayer)
dvander@458
   352
	{
ds@994
   353
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458
   354
	}
dvander@458
   355
	if (!pPlayer->IsConnected())
dvander@458
   356
	{
ds@470
   357
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   358
	}
dvander@458
   359
dvander@458
   360
	AdminId id;
dvander@458
   361
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   362
	{
dvander@458
   363
		id = g_Admins.CreateAdmin(NULL);
dvander@458
   364
		pPlayer->SetAdminId(id, true);
dvander@458
   365
	}
dvander@458
   366
dvander@458
   367
	g_Admins.SetAdminFlags(id, Access_Effective, params[2]);
dvander@458
   368
dvander@458
   369
	return 1;
dvander@458
   370
}
dvander@458
   371
dvander@458
   372
static cell_t GetUserFlagBits(IPluginContext *pContext, const cell_t *params)
dvander@458
   373
{
dvander@458
   374
	int client = params[1];
dvander@458
   375
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   376
	if (!pPlayer)
dvander@458
   377
	{
ds@994
   378
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@458
   379
	}
dvander@458
   380
	if (!pPlayer->IsConnected())
dvander@458
   381
	{
ds@470
   382
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   383
	}
dvander@458
   384
dvander@458
   385
	AdminId id;
dvander@458
   386
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   387
	{
dvander@458
   388
		return 0;
dvander@458
   389
	}
dvander@458
   390
dvander@458
   391
	return g_Admins.GetAdminFlags(id, Access_Effective);
dvander@458
   392
}
dvander@458
   393
dvander@460
   394
static cell_t GetClientUserId(IPluginContext *pContext, const cell_t *params)
dvander@460
   395
{
dvander@460
   396
	int client = params[1];
dvander@460
   397
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@460
   398
	if (!pPlayer)
dvander@460
   399
	{
ds@994
   400
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@460
   401
	}
dvander@460
   402
	if (!pPlayer->IsConnected())
dvander@460
   403
	{
ds@470
   404
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@460
   405
	}
dvander@460
   406
dvander@460
   407
	return engine->GetPlayerUserId(pPlayer->GetEdict());
dvander@460
   408
}
dvander@460
   409
dvander@540
   410
static cell_t CanUserTarget(IPluginContext *pContext, const cell_t *params)
dvander@540
   411
{
dvander@540
   412
	int client = params[1];
dvander@540
   413
	int target = params[2];
dvander@540
   414
dvander@1035
   415
	if (client == 0)
dvander@1035
   416
	{
dvander@1035
   417
		return 1;
dvander@1035
   418
	}
dvander@1035
   419
dvander@540
   420
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@540
   421
	if (!pPlayer)
dvander@540
   422
	{
ds@994
   423
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@540
   424
	} else if (!pPlayer->IsConnected()) {
ds@994
   425
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@540
   426
	}
dvander@540
   427
dvander@540
   428
	CPlayer *pTarget = g_Players.GetPlayerByIndex(target);
dvander@540
   429
	if (!pTarget)
dvander@540
   430
	{
ds@994
   431
		return pContext->ThrowNativeError("Client index %d is invalid", target);
dvander@540
   432
	} else if (!pTarget->IsConnected()) {
ds@994
   433
		return pContext->ThrowNativeError("Client %d is not connected", target);
dvander@540
   434
	}
dvander@540
   435
dvander@540
   436
	return g_Admins.CanAdminTarget(pPlayer->GetAdminId(), pTarget->GetAdminId()) ? 1 : 0;
dvander@540
   437
}
dvander@540
   438
dvander@644
   439
static cell_t GetClientTeam(IPluginContext *pContext, const cell_t *params)
dvander@644
   440
{
dvander@644
   441
	int client = params[1];
dvander@644
   442
dvander@644
   443
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@644
   444
	if (!pPlayer)
dvander@644
   445
	{
ds@994
   446
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@644
   447
	} else if (!pPlayer->IsInGame()) {
ds@994
   448
		return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@644
   449
	}
dvander@644
   450
dvander@644
   451
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
dvander@644
   452
	if (!pInfo)
dvander@644
   453
	{
dvander@644
   454
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
dvander@644
   455
	}
dvander@644
   456
dvander@644
   457
	return pInfo->GetTeamIndex();
dvander@644
   458
}
dvander@644
   459
faluco@658
   460
static cell_t GetFragCount(IPluginContext *pContext, const cell_t *params)
faluco@658
   461
{
faluco@658
   462
	int client = params[1];
faluco@658
   463
faluco@658
   464
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   465
	if (!pPlayer)
faluco@658
   466
	{
ds@994
   467
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   468
	} else if (!pPlayer->IsInGame()) {
ds@994
   469
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   470
	}
faluco@658
   471
faluco@658
   472
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   473
	if (!pInfo)
faluco@658
   474
	{
faluco@658
   475
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   476
	}
faluco@658
   477
faluco@658
   478
	return pInfo->GetFragCount();
faluco@658
   479
}
faluco@658
   480
faluco@658
   481
static cell_t GetDeathCount(IPluginContext *pContext, const cell_t *params)
faluco@658
   482
{
faluco@658
   483
	int client = params[1];
faluco@658
   484
faluco@658
   485
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   486
	if (!pPlayer)
faluco@658
   487
	{
ds@994
   488
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   489
	} else if (!pPlayer->IsInGame()) {
ds@994
   490
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   491
	}
faluco@658
   492
faluco@658
   493
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   494
	if (!pInfo)
faluco@658
   495
	{
faluco@658
   496
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   497
	}
faluco@658
   498
faluco@658
   499
	return pInfo->GetDeathCount();
faluco@658
   500
}
faluco@658
   501
faluco@658
   502
static cell_t GetArmorValue(IPluginContext *pContext, const cell_t *params)
faluco@658
   503
{
faluco@658
   504
	int client = params[1];
faluco@658
   505
faluco@658
   506
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   507
	if (!pPlayer)
faluco@658
   508
	{
ds@994
   509
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   510
	} else if (!pPlayer->IsInGame()) {
ds@994
   511
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   512
	}
faluco@658
   513
faluco@658
   514
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   515
	if (!pInfo)
faluco@658
   516
	{
faluco@658
   517
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   518
	}
faluco@658
   519
faluco@658
   520
	return pInfo->GetArmorValue();
faluco@658
   521
}
faluco@658
   522
faluco@658
   523
static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
faluco@658
   524
{
faluco@658
   525
	int client = params[1];
faluco@658
   526
faluco@658
   527
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   528
	if (!pPlayer)
faluco@658
   529
	{
ds@994
   530
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   531
	} else if (!pPlayer->IsInGame()) {
ds@994
   532
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   533
	}
faluco@658
   534
faluco@658
   535
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   536
	if (!pInfo)
faluco@658
   537
	{
faluco@658
   538
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   539
	}
faluco@658
   540
faluco@658
   541
	cell_t *pVec;
faluco@658
   542
	pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658
   543
faluco@658
   544
	Vector vec = pInfo->GetAbsOrigin();
faluco@658
   545
	pVec[0] = sp_ftoc(vec.x);
faluco@658
   546
	pVec[1] = sp_ftoc(vec.y);
faluco@658
   547
	pVec[2] = sp_ftoc(vec.z);
faluco@658
   548
faluco@658
   549
	return 1;
faluco@658
   550
}
faluco@658
   551
faluco@658
   552
static cell_t GetAbsAngles(IPluginContext *pContext, const cell_t *params)
faluco@658
   553
{
faluco@658
   554
	int client = params[1];
faluco@658
   555
faluco@658
   556
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   557
	if (!pPlayer)
faluco@658
   558
	{
ds@994
   559
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   560
	} else if (!pPlayer->IsInGame()) {
ds@994
   561
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   562
	}
faluco@658
   563
faluco@658
   564
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   565
	if (!pInfo)
faluco@658
   566
	{
faluco@658
   567
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   568
	}
faluco@658
   569
faluco@658
   570
	cell_t *pAng;
faluco@658
   571
	pContext->LocalToPhysAddr(params[2], &pAng);
faluco@658
   572
faluco@658
   573
	QAngle ang = pInfo->GetAbsAngles();
faluco@658
   574
	pAng[0] = sp_ftoc(ang.x);
faluco@658
   575
	pAng[1] = sp_ftoc(ang.y);
faluco@658
   576
	pAng[2] = sp_ftoc(ang.z);
faluco@658
   577
faluco@658
   578
	return 1;
faluco@658
   579
}
faluco@658
   580
faluco@658
   581
static cell_t GetPlayerMins(IPluginContext *pContext, const cell_t *params)
faluco@658
   582
{
faluco@658
   583
	int client = params[1];
faluco@658
   584
faluco@658
   585
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   586
	if (!pPlayer)
faluco@658
   587
	{
ds@994
   588
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   589
	} else if (!pPlayer->IsInGame()) {
ds@994
   590
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   591
	}
faluco@658
   592
faluco@658
   593
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   594
	if (!pInfo)
faluco@658
   595
	{
faluco@658
   596
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   597
	}
faluco@658
   598
faluco@658
   599
	cell_t *pVec;
faluco@658
   600
	pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658
   601
faluco@658
   602
	Vector vec = pInfo->GetPlayerMins();
faluco@658
   603
	pVec[0] = sp_ftoc(vec.x);
faluco@658
   604
	pVec[1] = sp_ftoc(vec.y);
faluco@658
   605
	pVec[2] = sp_ftoc(vec.z);
faluco@658
   606
faluco@658
   607
	return 1;
faluco@658
   608
}
faluco@658
   609
faluco@658
   610
static cell_t GetPlayerMaxs(IPluginContext *pContext, const cell_t *params)
faluco@658
   611
{
faluco@658
   612
	int client = params[1];
faluco@658
   613
faluco@658
   614
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   615
	if (!pPlayer)
faluco@658
   616
	{
ds@994
   617
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   618
	} else if (!pPlayer->IsInGame()) {
ds@994
   619
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   620
	}
faluco@658
   621
faluco@658
   622
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   623
	if (!pInfo)
faluco@658
   624
	{
faluco@658
   625
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   626
	}
faluco@658
   627
faluco@658
   628
	cell_t *pVec;
faluco@658
   629
	pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658
   630
faluco@658
   631
	Vector vec = pInfo->GetPlayerMaxs();
faluco@658
   632
	pVec[0] = sp_ftoc(vec.x);
faluco@658
   633
	pVec[1] = sp_ftoc(vec.y);
faluco@658
   634
	pVec[2] = sp_ftoc(vec.z);
faluco@658
   635
faluco@658
   636
	return 1;
faluco@658
   637
}
faluco@658
   638
faluco@658
   639
static cell_t GetWeaponName(IPluginContext *pContext, const cell_t *params)
faluco@658
   640
{
faluco@658
   641
	int client = params[1];
faluco@658
   642
faluco@658
   643
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   644
	if (!pPlayer)
faluco@658
   645
	{
ds@994
   646
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   647
	} else if (!pPlayer->IsInGame()) {
ds@994
   648
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   649
	}
faluco@658
   650
faluco@658
   651
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   652
	if (!pInfo)
faluco@658
   653
	{
faluco@658
   654
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   655
	}
faluco@658
   656
faluco@756
   657
	const char *weapon = pInfo->GetWeaponName();
faluco@756
   658
	pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), weapon ? weapon : "", NULL);
faluco@658
   659
faluco@658
   660
	return 1;
faluco@658
   661
}
faluco@658
   662
faluco@658
   663
static cell_t GetModelName(IPluginContext *pContext, const cell_t *params)
faluco@658
   664
{
faluco@658
   665
	int client = params[1];
faluco@658
   666
faluco@658
   667
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   668
	if (!pPlayer)
faluco@658
   669
	{
ds@994
   670
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   671
	} else if (!pPlayer->IsInGame()) {
ds@994
   672
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   673
	}
faluco@658
   674
faluco@658
   675
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   676
	if (!pInfo)
faluco@658
   677
	{
faluco@658
   678
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   679
	}
faluco@658
   680
faluco@756
   681
	const char *model = pInfo->GetModelName();
faluco@756
   682
	pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), model ? model : "", NULL);
faluco@658
   683
faluco@658
   684
	return 1;
faluco@658
   685
}
faluco@658
   686
faluco@658
   687
static cell_t GetHealth(IPluginContext *pContext, const cell_t *params)
faluco@658
   688
{
faluco@658
   689
	int client = params[1];
faluco@658
   690
faluco@658
   691
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   692
	if (!pPlayer)
faluco@658
   693
	{
ds@994
   694
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@658
   695
	} else if (!pPlayer->IsInGame()) {
ds@994
   696
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@658
   697
	}
faluco@658
   698
faluco@658
   699
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   700
	if (!pInfo)
faluco@658
   701
	{
faluco@658
   702
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   703
	}
faluco@658
   704
faluco@658
   705
	return pInfo->GetHealth();
faluco@658
   706
}
faluco@658
   707
faluco@682
   708
static cell_t GetTimeConnected(IPluginContext *pContext, const cell_t *params)
faluco@682
   709
{
faluco@682
   710
	int client = params[1];
faluco@682
   711
faluco@682
   712
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   713
	if (!pPlayer)
faluco@682
   714
	{
ds@994
   715
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   716
	} else if (!pPlayer->IsInGame()) {
ds@994
   717
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   718
	} else if (pPlayer->IsFakeClient()) {
ds@994
   719
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   720
	}
faluco@682
   721
faluco@682
   722
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   723
faluco@682
   724
	return sp_ftoc(pInfo->GetTimeConnected());
faluco@682
   725
}
faluco@682
   726
faluco@682
   727
static cell_t GetDataRate(IPluginContext *pContext, const cell_t *params)
faluco@682
   728
{
faluco@682
   729
	int client = params[1];
faluco@682
   730
faluco@682
   731
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   732
	if (!pPlayer)
faluco@682
   733
	{
ds@994
   734
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   735
	} else if (!pPlayer->IsInGame()) {
ds@994
   736
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   737
	} else if (pPlayer->IsFakeClient()) {
ds@994
   738
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   739
	}
faluco@682
   740
faluco@682
   741
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   742
faluco@682
   743
	return pInfo->GetDataRate();
faluco@682
   744
}
faluco@682
   745
faluco@682
   746
static cell_t IsTimingOut(IPluginContext *pContext, const cell_t *params)
faluco@682
   747
{
faluco@682
   748
	int client = params[1];
faluco@682
   749
faluco@682
   750
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   751
	if (!pPlayer)
faluco@682
   752
	{
ds@994
   753
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   754
	} else if (!pPlayer->IsInGame()) {
ds@994
   755
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   756
	} else if (pPlayer->IsFakeClient()) {
ds@994
   757
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   758
	}
faluco@682
   759
faluco@682
   760
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   761
faluco@682
   762
	return pInfo->IsTimingOut() ? 1 : 0;
faluco@682
   763
}
faluco@682
   764
faluco@682
   765
static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
faluco@682
   766
{
faluco@682
   767
	int client = params[1];
faluco@682
   768
faluco@682
   769
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   770
	if (!pPlayer)
faluco@682
   771
	{
ds@994
   772
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   773
	} else if (!pPlayer->IsInGame()) {
ds@994
   774
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   775
	} else if (pPlayer->IsFakeClient()) {
ds@994
   776
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   777
	}
faluco@682
   778
faluco@682
   779
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   780
faluco@682
   781
	return sp_ftoc(pInfo->GetLatency(params[2]));
faluco@682
   782
}
faluco@682
   783
faluco@682
   784
static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
faluco@682
   785
{
faluco@682
   786
	int client = params[1];
faluco@682
   787
faluco@682
   788
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   789
	if (!pPlayer)
faluco@682
   790
	{
ds@994
   791
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   792
	} else if (!pPlayer->IsInGame()) {
ds@994
   793
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   794
	} else if (pPlayer->IsFakeClient()) {
ds@994
   795
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   796
	}
faluco@682
   797
faluco@682
   798
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   799
faluco@682
   800
	return sp_ftoc(pInfo->GetAvgLatency(params[2]));
faluco@682
   801
}
faluco@682
   802
faluco@682
   803
static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
faluco@682
   804
{
faluco@682
   805
	int client = params[1];
faluco@682
   806
faluco@682
   807
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   808
	if (!pPlayer)
faluco@682
   809
	{
ds@994
   810
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   811
	} else if (!pPlayer->IsInGame()) {
ds@994
   812
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   813
	} else if (pPlayer->IsFakeClient()) {
ds@994
   814
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   815
	}
faluco@682
   816
faluco@682
   817
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   818
faluco@682
   819
	return sp_ftoc(pInfo->GetAvgLoss(params[2]));
faluco@682
   820
}
faluco@682
   821
faluco@682
   822
static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
faluco@682
   823
{
faluco@682
   824
	int client = params[1];
faluco@682
   825
faluco@682
   826
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   827
	if (!pPlayer)
faluco@682
   828
	{
ds@994
   829
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   830
	} else if (!pPlayer->IsInGame()) {
ds@994
   831
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   832
	} else if (pPlayer->IsFakeClient()) {
ds@994
   833
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   834
	}
faluco@682
   835
faluco@682
   836
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   837
faluco@682
   838
	return sp_ftoc(pInfo->GetAvgChoke(params[2]));
faluco@682
   839
}
faluco@682
   840
faluco@682
   841
static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
faluco@682
   842
{
faluco@682
   843
	int client = params[1];
faluco@682
   844
faluco@682
   845
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   846
	if (!pPlayer)
faluco@682
   847
	{
ds@994
   848
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   849
	} else if (!pPlayer->IsInGame()) {
ds@994
   850
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   851
	} else if (pPlayer->IsFakeClient()) {
ds@994
   852
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   853
	}
faluco@682
   854
faluco@682
   855
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   856
faluco@682
   857
	return sp_ftoc(pInfo->GetAvgData(params[2]));
faluco@682
   858
}
faluco@682
   859
faluco@682
   860
static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
faluco@682
   861
{
faluco@682
   862
	int client = params[1];
faluco@682
   863
faluco@682
   864
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   865
	if (!pPlayer)
faluco@682
   866
	{
ds@994
   867
		return pContext->ThrowNativeError("Client index %d is invalid", client);
faluco@682
   868
	} else if (!pPlayer->IsInGame()) {
ds@994
   869
		return pContext->ThrowNativeError("Client %d is not in game", client);
faluco@682
   870
	} else if (pPlayer->IsFakeClient()) {
ds@994
   871
		return pContext->ThrowNativeError("Client %d is a bot", client);
faluco@682
   872
	}
faluco@682
   873
faluco@682
   874
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   875
faluco@682
   876
	return sp_ftoc(pInfo->GetAvgPackets(params[2]));
faluco@682
   877
}
faluco@682
   878
faluco@682
   879
static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
faluco@682
   880
{
faluco@682
   881
	return g_Players.GetClientOfUserId(params[1]);
faluco@682
   882
}
faluco@682
   883
dvander@1621
   884
static cell_t _ShowActivity(IPluginContext *pContext,
dvander@1621
   885
							const cell_t *params,
dvander@1621
   886
							const char *tag,
dvander@1624
   887
							cell_t fmt_param)
dvander@910
   888
{
dvander@924
   889
	char message[255];
dvander@924
   890
	char buffer[255];
dvander@910
   891
	int value = sm_show_activity.GetInt();
dvander@924
   892
	unsigned int replyto = g_ChatTriggers.GetReplyTo();
dvander@910
   893
	int client = params[1];
dvander@910
   894
dvander@910
   895
	const char *name = "Console";
dvander@910
   896
	const char *sign = "ADMIN";
dvander@924
   897
	bool display_in_chat = false;
dvander@910
   898
	if (client != 0)
dvander@910
   899
	{
dvander@910
   900
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@910
   901
		if (!pPlayer || !pPlayer->IsConnected())
dvander@910
   902
		{
dvander@910
   903
			return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@910
   904
		}
dvander@910
   905
		name = pPlayer->GetName();
dvander@910
   906
		AdminId id = pPlayer->GetAdminId();
dvander@910
   907
		if (id == INVALID_ADMIN_ID
dvander@910
   908
			|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@910
   909
		{
dvander@910
   910
			sign = "PLAYER";
dvander@910
   911
		}
dvander@924
   912
dvander@924
   913
		/* Display the message to the client? */
dvander@924
   914
		if (replyto == SM_REPLY_CONSOLE)
dvander@924
   915
		{
dvander@924
   916
			g_SourceMod.SetGlobalTarget(client);
dvander@1104
   917
			g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1621
   918
dvander@1621
   919
			if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1621
   920
			{
dvander@1621
   921
				return 0;
dvander@1621
   922
			}
dvander@1621
   923
dvander@1104
   924
			UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
dvander@924
   925
			engine->ClientPrintf(pPlayer->GetEdict(), message);
dvander@924
   926
			display_in_chat = true;
dvander@924
   927
		}
dvander@1621
   928
	}
dvander@1621
   929
	else
dvander@1621
   930
	{
dvander@924
   931
		g_SourceMod.SetGlobalTarget(LANG_SERVER);
dvander@1104
   932
		g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1621
   933
dvander@1621
   934
		if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1621
   935
		{
dvander@1621
   936
			return 0;
dvander@1621
   937
		}
dvander@1621
   938
dvander@1104
   939
		UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
dvander@924
   940
		META_CONPRINT(message);
dvander@910
   941
	}
dvander@910
   942
dvander@924
   943
	if (!value)
dvander@924
   944
	{
dvander@924
   945
		return 1;
dvander@924
   946
	}
dvander@924
   947
dvander@910
   948
	int maxClients = g_Players.GetMaxClients();
dvander@910
   949
	for (int i=1; i<=maxClients; i++)
dvander@910
   950
	{
dvander@910
   951
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@924
   952
		if (!pPlayer->IsInGame() 
dvander@924
   953
			|| pPlayer->IsFakeClient()
dvander@924
   954
			|| (display_in_chat && i == client))
dvander@910
   955
		{
dvander@910
   956
			continue;
dvander@910
   957
		}
dvander@910
   958
		AdminId id = pPlayer->GetAdminId();
dvander@910
   959
		g_SourceMod.SetGlobalTarget(i);
dvander@910
   960
		if (id == INVALID_ADMIN_ID
dvander@910
   961
			|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@910
   962
		{
dvander@910
   963
			/* Treat this as a normal user */
dvander@910
   964
			if ((value & 1) || (value & 2))
dvander@910
   965
			{
dvander@910
   966
				const char *newsign = sign;
dvander@1621
   967
				if ((value & 2) || (i == client))
dvander@910
   968
				{
dvander@910
   969
					newsign = name;
dvander@910
   970
				}
dvander@1104
   971
				g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1621
   972
dvander@1621
   973
				if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1621
   974
				{
dvander@1621
   975
					return 0;
dvander@1621
   976
				}
dvander@1621
   977
dvander@1104
   978
				UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
dvander@910
   979
				g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@910
   980
			}
dvander@1621
   981
		}
dvander@1621
   982
		else
dvander@1621
   983
		{
dvander@910
   984
			/* Treat this as an admin user */
dvander@910
   985
			bool is_root = g_Admins.GetAdminFlag(id, Admin_Root, Access_Effective);
dvander@910
   986
			if ((value & 4) 
dvander@910
   987
				|| (value & 8)
dvander@910
   988
				|| ((value & 16) && is_root))
dvander@910
   989
			{
dvander@910
   990
				const char *newsign = sign;
dvander@1621
   991
				if ((value & 8) || ((value & 16) && is_root) || (i == client))
dvander@910
   992
				{
dvander@910
   993
					newsign = name;
dvander@910
   994
				}
dvander@1104
   995
				g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1621
   996
dvander@1621
   997
				if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1621
   998
				{
dvander@1621
   999
					return 0;
dvander@1621
  1000
				}
dvander@1621
  1001
dvander@1104
  1002
				UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
dvander@910
  1003
				g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@910
  1004
			}
dvander@910
  1005
		}
dvander@910
  1006
	}
dvander@910
  1007
dvander@910
  1008
	return 1;
dvander@910
  1009
}
dvander@910
  1010
dvander@1624
  1011
static cell_t _ShowActivity2(IPluginContext *pContext,
dvander@1624
  1012
							 const cell_t *params,
dvander@1624
  1013
							 const char *tag,
dvander@1624
  1014
							 cell_t fmt_param)
dvander@1624
  1015
{
dvander@1624
  1016
	char message[255];
dvander@1624
  1017
	char buffer[255];
dvander@1624
  1018
	int value = sm_show_activity.GetInt();
dvander@1624
  1019
	unsigned int replyto = g_ChatTriggers.GetReplyTo();
dvander@1624
  1020
	int client = params[1];
dvander@1624
  1021
dvander@1624
  1022
	const char *name = "Console";
dvander@1624
  1023
	const char *sign = "ADMIN";
dvander@1624
  1024
	if (client != 0)
dvander@1624
  1025
	{
dvander@1624
  1026
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1624
  1027
		if (!pPlayer || !pPlayer->IsConnected())
dvander@1624
  1028
		{
dvander@1624
  1029
			return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1624
  1030
		}
dvander@1624
  1031
		name = pPlayer->GetName();
dvander@1624
  1032
		AdminId id = pPlayer->GetAdminId();
dvander@1624
  1033
		if (id == INVALID_ADMIN_ID
dvander@1624
  1034
			|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@1624
  1035
		{
dvander@1624
  1036
			sign = "PLAYER";
dvander@1624
  1037
		}
dvander@1624
  1038
dvander@1624
  1039
		g_SourceMod.SetGlobalTarget(client);
dvander@1624
  1040
		g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1624
  1041
dvander@1624
  1042
		if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1624
  1043
		{
dvander@1624
  1044
			return 0;
dvander@1624
  1045
		}
dvander@1624
  1046
dvander@1624
  1047
		/* We don't display directly to the console because the chat text 
dvander@1624
  1048
		 * simply gets added to the console, so we don't want it to print 
dvander@1624
  1049
		 * twice.
dvander@1624
  1050
		 */
dvander@1624
  1051
		if (replyto == SM_REPLY_CONSOLE)
dvander@1624
  1052
		{
dvander@1624
  1053
#if 0
dvander@1624
  1054
			UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
dvander@1624
  1055
			engine->ClientPrintf(pPlayer->GetEdict(), message);
dvander@1624
  1056
#endif
dvander@1624
  1057
			UTIL_Format(message, sizeof(message), "%s%s", tag, buffer);
dvander@1624
  1058
			g_HL2.TextMsg(client, HUD_PRINTTALK, message);
dvander@1624
  1059
		}
dvander@1624
  1060
		else
dvander@1624
  1061
		{
dvander@1624
  1062
			UTIL_Format(message, sizeof(message), "%s%s", tag, buffer);
dvander@1624
  1063
			g_HL2.TextMsg(client, HUD_PRINTTALK, message);
dvander@1624
  1064
		}
dvander@1624
  1065
	}
dvander@1624
  1066
	else
dvander@1624
  1067
	{
dvander@1624
  1068
		g_SourceMod.SetGlobalTarget(LANG_SERVER);
dvander@1624
  1069
		g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1624
  1070
dvander@1624
  1071
		if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1624
  1072
		{
dvander@1624
  1073
			return 0;
dvander@1624
  1074
		}
dvander@1624
  1075
dvander@1624
  1076
		UTIL_Format(message, sizeof(message), "%s%s\n", tag, buffer);
dvander@1624
  1077
		META_CONPRINT(message);
dvander@1624
  1078
	}
dvander@1624
  1079
dvander@1624
  1080
	if (!value)
dvander@1624
  1081
	{
dvander@1624
  1082
		return 1;
dvander@1624
  1083
	}
dvander@1624
  1084
dvander@1624
  1085
	int maxClients = g_Players.GetMaxClients();
dvander@1624
  1086
	for (int i=1; i<=maxClients; i++)
dvander@1624
  1087
	{
dvander@1624
  1088
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@1624
  1089
		if (!pPlayer->IsInGame() 
dvander@1624
  1090
			|| pPlayer->IsFakeClient()
dvander@1624
  1091
			|| i == client)
dvander@1624
  1092
		{
dvander@1624
  1093
			continue;
dvander@1624
  1094
		}
dvander@1624
  1095
		AdminId id = pPlayer->GetAdminId();
dvander@1624
  1096
		g_SourceMod.SetGlobalTarget(i);
dvander@1624
  1097
		if (id == INVALID_ADMIN_ID
dvander@1624
  1098
			|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@1624
  1099
		{
dvander@1624
  1100
			/* Treat this as a normal user */
dvander@1624
  1101
			if ((value & 1) || (value & 2))
dvander@1624
  1102
			{
dvander@1624
  1103
				const char *newsign = sign;
dvander@1624
  1104
				if ((value & 2))
dvander@1624
  1105
				{
dvander@1624
  1106
					newsign = name;
dvander@1624
  1107
				}
dvander@1624
  1108
				g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1624
  1109
dvander@1624
  1110
				if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1624
  1111
				{
dvander@1624
  1112
					return 0;
dvander@1624
  1113
				}
dvander@1624
  1114
dvander@1624
  1115
				UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
dvander@1624
  1116
				g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@1624
  1117
			}
dvander@1624
  1118
		}
dvander@1624
  1119
		else
dvander@1624
  1120
		{
dvander@1624
  1121
			/* Treat this as an admin user */
dvander@1624
  1122
			bool is_root = g_Admins.GetAdminFlag(id, Admin_Root, Access_Effective);
dvander@1624
  1123
			if ((value & 4) 
dvander@1624
  1124
				|| (value & 8)
dvander@1624
  1125
				|| ((value & 16) && is_root))
dvander@1624
  1126
			{
dvander@1624
  1127
				const char *newsign = sign;
dvander@1624
  1128
				if ((value & 8) || ((value & 16) && is_root))
dvander@1624
  1129
				{
dvander@1624
  1130
					newsign = name;
dvander@1624
  1131
				}
dvander@1624
  1132
				g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, fmt_param);
dvander@1624
  1133
dvander@1624
  1134
				if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1624
  1135
				{
dvander@1624
  1136
					return 0;
dvander@1624
  1137
				}
dvander@1624
  1138
dvander@1624
  1139
				UTIL_Format(message, sizeof(message), "%s%s: %s", tag, newsign, buffer);
dvander@1624
  1140
				g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@1624
  1141
			}
dvander@1624
  1142
		}
dvander@1624
  1143
	}
dvander@1624
  1144
dvander@1624
  1145
	return 1;
dvander@1624
  1146
}
dvander@1624
  1147
dvander@1104
  1148
static cell_t ShowActivity(IPluginContext *pContext, const cell_t *params)
dvander@1104
  1149
{
dvander@1624
  1150
	return _ShowActivity(pContext, params, "[SM] ", 2);
dvander@1104
  1151
}
dvander@1104
  1152
dvander@1104
  1153
static cell_t ShowActivityEx(IPluginContext *pContext, const cell_t *params)
dvander@1104
  1154
{
dvander@1104
  1155
	char *str;
dvander@1104
  1156
	pContext->LocalToString(params[2], &str);
dvander@1104
  1157
dvander@1624
  1158
	return _ShowActivity(pContext, params, str, 3);
dvander@1621
  1159
}
dvander@1621
  1160
dvander@1621
  1161
static cell_t ShowActivity2(IPluginContext *pContext, const cell_t *params)
dvander@1621
  1162
{
dvander@1621
  1163
	char *str;
dvander@1621
  1164
	pContext->LocalToString(params[2], &str);
dvander@1621
  1165
dvander@1624
  1166
	return _ShowActivity2(pContext, params, str, 3);
dvander@1104
  1167
}
dvander@1104
  1168
ds@992
  1169
static cell_t KickClient(IPluginContext *pContext, const cell_t *params)
ds@992
  1170
{
ds@992
  1171
	int client = params[1];
ds@992
  1172
ds@992
  1173
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
ds@992
  1174
	if (!pPlayer)
ds@992
  1175
	{
ds@994
  1176
		return pContext->ThrowNativeError("Client index %d is invalid", client);
ds@992
  1177
	} else if (!pPlayer->IsConnected()) {
ds@992
  1178
		return pContext->ThrowNativeError("Client %d is not connected", client);
ds@992
  1179
	}
ds@992
  1180
dvander@1509
  1181
	pPlayer->MarkAsBeingKicked();
dvander@1509
  1182
ds@992
  1183
	if (pPlayer->IsFakeClient())
ds@992
  1184
	{
ds@998
  1185
		char kickcmd[40];
ds@992
  1186
		UTIL_Format(kickcmd, sizeof(kickcmd), "kick %s\n", pPlayer->GetName());
ds@992
  1187
ds@992
  1188
		engine->ServerCommand(kickcmd);
ds@992
  1189
		return 1;
ds@992
  1190
	}
ds@992
  1191
dvander@1011
  1192
	g_SourceMod.SetGlobalTarget(client);
dvander@1011
  1193
ds@992
  1194
	char buffer[256];
ds@992
  1195
	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
ds@992
  1196
dvander@1273
  1197
	if (pContext->GetContext()->n_err != SP_ERROR_NONE)
dvander@1273
  1198
	{
dvander@1273
  1199
		return 0;
dvander@1273
  1200
	}
dvander@1273
  1201
dvander@1576
  1202
	pPlayer->Kick(buffer);
ds@992
  1203
ds@992
  1204
	return 1;
ds@992
  1205
}
ds@992
  1206
dvander@1033
  1207
static cell_t ChangeClientTeam(IPluginContext *pContext, const cell_t *params)
dvander@1033
  1208
{
dvander@1033
  1209
	int client = params[1];
dvander@1033
  1210
dvander@1033
  1211
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1033
  1212
	if (!pPlayer)
dvander@1033
  1213
	{
dvander@1033
  1214
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1621
  1215
	}
dvander@1621
  1216
	else if (!pPlayer->IsInGame())
dvander@1621
  1217
	{
dvander@1033
  1218
		return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1033
  1219
	}
dvander@1033
  1220
dvander@1033
  1221
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
dvander@1033
  1222
	if (!pInfo)
dvander@1033
  1223
	{
dvander@1033
  1224
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
dvander@1033
  1225
	}
dvander@1033
  1226
dvander@1033
  1227
	pInfo->ChangeTeam(params[2]);
dvander@1033
  1228
dvander@1033
  1229
	return 1;
dvander@1033
  1230
}
dvander@1033
  1231
dvander@1273
  1232
static cell_t RunAdminCacheChecks(IPluginContext *pContext, const cell_t *params)
dvander@1273
  1233
{
dvander@1273
  1234
	int client = params[1];
dvander@1273
  1235
dvander@1273
  1236
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1273
  1237
	if (!pPlayer)
dvander@1273
  1238
	{
dvander@1273
  1239
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1621
  1240
	}
dvander@1621
  1241
	else if (!pPlayer->IsInGame())
dvander@1621
  1242
	{
dvander@1273
  1243
		return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1621
  1244
	}
dvander@1621
  1245
	else if (!pPlayer->IsAuthorized())
dvander@1621
  1246
	{
dvander@1273
  1247
		return pContext->ThrowNativeError("Client %d is not authorized", client);
dvander@1273
  1248
	}
dvander@1273
  1249
dvander@1273
  1250
	AdminId id = pPlayer->GetAdminId();
dvander@1273
  1251
	pPlayer->DoBasicAdminChecks();
dvander@1273
  1252
dvander@1273
  1253
	return (id != pPlayer->GetAdminId()) ? 1 : 0;
dvander@1273
  1254
}
dvander@1273
  1255
dvander@1273
  1256
static cell_t NotifyPostAdminCheck(IPluginContext *pContext, const cell_t *params)
dvander@1273
  1257
{
dvander@1273
  1258
	int client = params[1];
dvander@1273
  1259
dvander@1273
  1260
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1273
  1261
	if (!pPlayer)
dvander@1273
  1262
	{
dvander@1273
  1263
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1621
  1264
	}
dvander@1621
  1265
	else if (!pPlayer->IsInGame()) {
dvander@1273
  1266
		return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1621
  1267
	}
dvander@1621
  1268
	else if (!pPlayer->IsAuthorized())
dvander@1621
  1269
	{
dvander@1273
  1270
		return pContext->ThrowNativeError("Client %d is not authorized", client);
dvander@1273
  1271
	}
dvander@1273
  1272
dvander@1273
  1273
	pPlayer->NotifyPostAdminChecks();
dvander@1273
  1274
dvander@1273
  1275
	return 1;
dvander@1273
  1276
}
dvander@1273
  1277
dvander@1509
  1278
static cell_t IsClientInKickQueue(IPluginContext *pContext, const cell_t *params)
dvander@1509
  1279
{
dvander@1509
  1280
	int client = params[1];
dvander@1509
  1281
dvander@1509
  1282
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@1509
  1283
dvander@1509
  1284
	if (!pPlayer)
dvander@1509
  1285
	{
dvander@1509
  1286
		return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@1509
  1287
	}
dvander@1509
  1288
	else if (!pPlayer->IsConnected())
dvander@1509
  1289
	{
dvander@1509
  1290
		return pContext->ThrowNativeError("Client %d is not in game", client);
dvander@1509
  1291
	}
dvander@1509
  1292
dvander@1509
  1293
	return pPlayer->IsInKickQueue() ? 1 : 0;
dvander@1509
  1294
}
dvander@1509
  1295
dvander@1621
  1296
static cell_t ProcessTargetString(IPluginContext *pContext, const cell_t *params)
dvander@1621
  1297
{
dvander@1621
  1298
	cmd_target_info_t info;
dvander@1621
  1299
dvander@1621
  1300
	pContext->LocalToString(params[1], (char **)&info.pattern);
dvander@1621
  1301
	info.admin = params[2];
dvander@1621
  1302
	pContext->LocalToPhysAddr(params[3], &info.targets);
dvander@1621
  1303
	info.max_targets = params[4];
dvander@1621
  1304
	info.flags = params[5];
dvander@1621
  1305
	pContext->LocalToString(params[6], &info.target_name);
dvander@1621
  1306
	info.target_name_maxlength = params[7];
dvander@1621
  1307
dvander@1621
  1308
	cell_t *tn_is_ml;
dvander@1621
  1309
	pContext->LocalToPhysAddr(params[8], &tn_is_ml);
dvander@1621
  1310
dvander@1621
  1311
	g_Players.ProcessCommandTarget(&info);
dvander@1621
  1312
dvander@1621
  1313
	if (info.target_name_style == COMMAND_TARGETNAME_ML)
dvander@1621
  1314
	{
dvander@1621
  1315
		*tn_is_ml = 1;
dvander@1621
  1316
	}
dvander@1621
  1317
	else
dvander@1621
  1318
	{
dvander@1621
  1319
		*tn_is_ml = 0;
dvander@1621
  1320
	}
dvander@1621
  1321
dvander@1621
  1322
	if (info.num_targets == 0)
dvander@1621
  1323
	{
dvander@1621
  1324
		return info.reason;
dvander@1621
  1325
	}
dvander@1621
  1326
	else
dvander@1621
  1327
	{
dvander@1621
  1328
		return info.num_targets;
dvander@1621
  1329
	}
dvander@1621
  1330
}
dvander@1621
  1331
faluco@260
  1332
REGISTER_NATIVES(playernatives)
faluco@260
  1333
{
dvander@644
  1334
	{"AddUserFlags",			AddUserFlags},
dvander@644
  1335
	{"CanUserTarget",			CanUserTarget},
dvander@1033
  1336
	{"ChangeClientTeam",		ChangeClientTeam},
dvander@644
  1337
	{"GetClientAuthString",		sm_GetClientAuthStr},
faluco@260
  1338
	{"GetClientCount",			sm_GetClientCount},
dvander@644
  1339
	{"GetClientInfo",			sm_GetClientInfo},
faluco@260
  1340
	{"GetClientIP",				sm_GetClientIP},
dvander@644
  1341
	{"GetClientName",			sm_GetClientName},
dvander@644
  1342
	{"GetClientTeam",			GetClientTeam},
dvander@644
  1343
	{"GetClientUserId",			GetClientUserId},
dvander@644
  1344
	{"GetMaxClients",			sm_GetMaxClients},
dvander@644
  1345
	{"GetUserAdmin",			GetUserAdmin},
dvander@644
  1346
	{"GetUserFlagBits",			GetUserFlagBits},
ds@784
  1347
	{"IsClientAuthorized",		sm_IsClientAuthorized},
ds@784
  1348
	{"IsClientConnected",		sm_IsClientConnected},
ds@784
  1349
	{"IsFakeClient",			sm_IsClientFakeClient},
ds@784
  1350
	{"IsPlayerInGame",			sm_IsClientInGame},			/* Backwards compat shim */
ds@784
  1351
	{"IsClientInGame",			sm_IsClientInGame},
ds@1001
  1352
	{"IsClientObserver",		IsClientObserver},
dvander@458
  1353
	{"RemoveUserFlags",			RemoveUserFlags},
dvander@644
  1354
	{"SetUserAdmin",			SetUserAdmin},
dvander@458
  1355
	{"SetUserFlagBits",			SetUserFlagBits},
faluco@658
  1356
	{"GetClientDeaths",			GetDeathCount},
faluco@658
  1357
	{"GetClientFrags",			GetFragCount},
faluco@658
  1358
	{"GetClientArmor",			GetArmorValue},
faluco@658
  1359
	{"GetClientAbsOrigin",		GetAbsOrigin},
faluco@658
  1360
	{"GetClientAbsAngles",		GetAbsAngles},
faluco@658
  1361
	{"GetClientMins",			GetPlayerMins},
faluco@658
  1362
	{"GetClientMaxs",			GetPlayerMaxs},
faluco@658
  1363
	{"GetClientWeapon",			GetWeaponName},
faluco@658
  1364
	{"GetClientModel",			GetModelName},
faluco@658
  1365
	{"GetClientHealth",			GetHealth},
dvander@691
  1366
	{"GetClientTime",			GetTimeConnected},
dvander@691
  1367
	{"GetClientDataRate",		GetDataRate},
dvander@691
  1368
	{"IsClentTimingOut",		IsTimingOut},
dvander@691
  1369
	{"GetClientLatency",		GetLatency},
dvander@691
  1370
	{"GetClientAvgLatency",		GetAvgLatency},
dvander@691
  1371
	{"GetClientAvgLoss",		GetAvgLoss},
dvander@691
  1372
	{"GetClientAvgChoke",		GetAvgChoke},
dvander@691
  1373
	{"GetClientAvgData",		GetAvgData},
dvander@691
  1374
	{"GetClientAvgPackets",		GetAvgPackets},
faluco@682
  1375
	{"GetClientOfUserId",		GetClientOfUserId},
dvander@910
  1376
	{"ShowActivity",			ShowActivity},
dvander@1110
  1377
	{"ShowActivityEx",			ShowActivityEx},
dvander@1621
  1378
	{"ShowActivity2",			ShowActivity2},
ds@992
  1379
	{"KickClient",				KickClient},
dvander@1273
  1380
	{"RunAdminCacheChecks",		RunAdminCacheChecks},
dvander@1273
  1381
	{"NotifyPostAdminCheck",	NotifyPostAdminCheck},
dvander@1509
  1382
	{"IsClientInKickQueue",		IsClientInKickQueue},
dvander@1621
  1383
	{"ProcessTargetString",		ProcessTargetString},
faluco@260
  1384
	{NULL,						NULL}
dvander@351
  1385
};
dvander@1423
  1386