core/smn_player.cpp
author David Anderson <dvander@alliedmods.net>
Fri Jun 08 01:09:17 2007 +0000 (2007-06-08)
changeset 922 980941c525fa
parent 910 153c052460af
child 923 346e4c60fc32
permissions -rw-r--r--
sm_kick now uses targeting properly
dvander@370
     1
/**
ds@653
     2
 * vim: set ts=4 :
dvander@370
     3
 * ===============================================================
dvander@370
     4
 * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
dvander@370
     5
 * ===============================================================
dvander@370
     6
 *
dvander@370
     7
 * This file is not open source and may not be copied without explicit
dvander@370
     8
 * written permission of AlliedModders LLC.  This file may not be redistributed 
dvander@370
     9
 * in whole or significant part.
dvander@370
    10
 * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
dvander@370
    11
 *
dvander@370
    12
 * Version: $Id$
dvander@370
    13
 */
dvander@370
    14
dvander@591
    15
#include "PlayerManager.h"
dvander@458
    16
#include "AdminCache.h"
faluco@280
    17
#include "sm_stringutil.h"
dvander@910
    18
#include "HalfLife2.h"
dvander@910
    19
#include "sourcemod.h"
faluco@682
    20
#include <inetchannelinfo.h>
faluco@242
    21
dvander@910
    22
ConVar sm_show_activity("sm_show_activity", "13", FCVAR_SPONLY, "Activity display setting (see sourcemod.cfg)");
dvander@910
    23
faluco@260
    24
static cell_t sm_GetClientCount(IPluginContext *pCtx, const cell_t *params)
faluco@242
    25
{
faluco@242
    26
	if (params[1])
faluco@242
    27
	{
dvander@448
    28
		return g_Players.NumPlayers();
faluco@242
    29
	}
faluco@242
    30
dvander@448
    31
	int maxplayers = g_Players.MaxClients();
faluco@242
    32
	int count = 0;
faluco@242
    33
	for (int i=1; i<=maxplayers; ++i)
faluco@242
    34
	{
dvander@448
    35
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@435
    36
		if ((pPlayer->IsConnected()) && !(pPlayer->IsInGame()))
faluco@242
    37
		{
faluco@242
    38
			count++;
faluco@242
    39
		}
faluco@242
    40
	}
faluco@242
    41
dvander@448
    42
	return (g_Players.NumPlayers() + count);
faluco@242
    43
}
faluco@242
    44
faluco@260
    45
static cell_t sm_GetMaxClients(IPluginContext *pCtx, const cell_t *params)
faluco@242
    46
{
dvander@448
    47
	return g_Players.MaxClients();
faluco@242
    48
}
faluco@242
    49
faluco@260
    50
static cell_t sm_GetClientName(IPluginContext *pCtx, const cell_t *params)
faluco@242
    51
{
faluco@242
    52
	int index = params[1];
dvander@448
    53
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
    54
	{
ds@470
    55
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@242
    56
	}
faluco@242
    57
dvander@448
    58
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
    59
	if (!pPlayer->IsConnected())
faluco@260
    60
	{
ds@470
    61
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260
    62
	}
faluco@260
    63
dvander@435
    64
	pCtx->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), pPlayer->GetName(), NULL);
faluco@242
    65
	return 1;
faluco@242
    66
}
faluco@242
    67
faluco@260
    68
static cell_t sm_GetClientIP(IPluginContext *pCtx, const cell_t *params)
faluco@242
    69
{
faluco@242
    70
	int index = params[1];
dvander@448
    71
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
    72
	{
ds@470
    73
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@242
    74
	}
faluco@242
    75
dvander@448
    76
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
    77
	if (!pPlayer->IsConnected())
faluco@260
    78
	{
ds@470
    79
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260
    80
	}
faluco@260
    81
faluco@280
    82
	char buf[64], *ptr;
dvander@435
    83
	strcpy(buf, pPlayer->GetIPAddress());
faluco@280
    84
faluco@280
    85
	if (params[4] && (ptr = strchr(buf, ':')))
faluco@280
    86
	{
faluco@280
    87
		*ptr = '\0';
faluco@280
    88
	}
faluco@280
    89
faluco@280
    90
	pCtx->StringToLocal(params[2], static_cast<size_t>(params[3]), buf);
faluco@242
    91
	return 1;
faluco@242
    92
}
faluco@242
    93
faluco@260
    94
static cell_t sm_GetClientAuthStr(IPluginContext *pCtx, const cell_t *params)
faluco@242
    95
{
faluco@242
    96
	int index = params[1];
dvander@448
    97
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
    98
	{
ds@470
    99
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@242
   100
	}
faluco@242
   101
dvander@448
   102
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
   103
	if (!pPlayer->IsConnected())
faluco@260
   104
	{
ds@470
   105
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@260
   106
	}
faluco@260
   107
dvander@449
   108
	if (!pPlayer->IsAuthorized())
dvander@449
   109
	{
dvander@449
   110
		return 0;
dvander@449
   111
	}
dvander@449
   112
dvander@435
   113
	pCtx->StringToLocal(params[2], static_cast<size_t>(params[3]), pPlayer->GetAuthString());
dvander@449
   114
faluco@242
   115
	return 1;
faluco@242
   116
}
faluco@242
   117
ds@784
   118
static cell_t sm_IsClientConnected(IPluginContext *pCtx, const cell_t *params)
faluco@242
   119
{
faluco@242
   120
	int index = params[1];
dvander@448
   121
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   122
	{
ds@470
   123
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@242
   124
	}
faluco@242
   125
dvander@448
   126
	return (g_Players.GetPlayerByIndex(index)->IsConnected()) ? 1 : 0;
faluco@242
   127
}
faluco@242
   128
ds@784
   129
static cell_t sm_IsClientInGame(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@470
   134
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@242
   135
	}
faluco@242
   136
dvander@448
   137
	return (g_Players.GetPlayerByIndex(index)->IsInGame()) ? 1 : 0;
faluco@242
   138
}
faluco@242
   139
ds@784
   140
static cell_t sm_IsClientAuthorized(IPluginContext *pCtx, const cell_t *params)
faluco@242
   141
{
faluco@242
   142
	int index = params[1];
dvander@448
   143
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   144
	{
ds@470
   145
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@242
   146
	}
faluco@242
   147
dvander@448
   148
	return (g_Players.GetPlayerByIndex(index)->IsAuthorized()) ? 1 : 0;
faluco@242
   149
}
faluco@242
   150
ds@784
   151
static cell_t sm_IsClientFakeClient(IPluginContext *pCtx, const cell_t *params)
faluco@242
   152
{
faluco@242
   153
	int index = params[1];
dvander@448
   154
	if ((index < 1) || (index > g_Players.GetMaxClients()))
faluco@242
   155
	{
ds@470
   156
		return pCtx->ThrowNativeError("Invalid client index %d", index);
faluco@260
   157
	}
faluco@260
   158
dvander@448
   159
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(index);
dvander@435
   160
	if (!pPlayer->IsConnected())
faluco@260
   161
	{
ds@470
   162
		return pCtx->ThrowNativeError("Client %d is not connected", index);
faluco@242
   163
	}
faluco@242
   164
dvander@435
   165
	return (pPlayer->IsFakeClient()) ? 1 : 0;
faluco@260
   166
}
faluco@260
   167
dvander@456
   168
static cell_t sm_GetClientInfo(IPluginContext *pContext, const cell_t *params)
dvander@456
   169
{
dvander@456
   170
	int client = params[1];
dvander@456
   171
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@456
   172
	if (!pPlayer)
dvander@456
   173
	{
ds@470
   174
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@456
   175
	}
dvander@456
   176
	if (!pPlayer->IsConnected())
dvander@456
   177
	{
ds@470
   178
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@456
   179
	}
dvander@456
   180
dvander@456
   181
	char *key;
dvander@456
   182
	pContext->LocalToString(params[2], &key);
dvander@456
   183
dvander@456
   184
	const char *val = engine->GetClientConVarValue(client, key);
dvander@456
   185
	if (!val)
dvander@456
   186
	{
dvander@456
   187
		return false;
dvander@456
   188
	}
dvander@456
   189
dvander@456
   190
	pContext->StringToLocalUTF8(params[3], params[4], val, NULL);
dvander@456
   191
	return 1;
dvander@456
   192
}
dvander@456
   193
dvander@458
   194
static cell_t SetUserAdmin(IPluginContext *pContext, const cell_t *params)
dvander@458
   195
{
dvander@458
   196
	int client = params[1];
dvander@458
   197
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   198
	if (!pPlayer)
dvander@458
   199
	{
ds@470
   200
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@458
   201
	}
dvander@458
   202
	if (!pPlayer->IsConnected())
dvander@458
   203
	{
ds@470
   204
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   205
	}
dvander@458
   206
	if (!g_Admins.IsValidAdmin(params[2]))
dvander@458
   207
	{
ds@470
   208
		return pContext->ThrowNativeError("AdminId %x is not valid", params[2]);
dvander@458
   209
	}
dvander@458
   210
dvander@458
   211
	pPlayer->SetAdminId(params[2], params[3] ? true : false);
dvander@458
   212
dvander@458
   213
	return 1;
dvander@458
   214
}
dvander@458
   215
dvander@458
   216
static cell_t GetUserAdmin(IPluginContext *pContext, const cell_t *params)
dvander@458
   217
{
dvander@458
   218
	int client = params[1];
dvander@458
   219
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   220
	if (!pPlayer)
dvander@458
   221
	{
ds@470
   222
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@458
   223
	}
dvander@458
   224
	if (!pPlayer->IsConnected())
dvander@458
   225
	{
ds@470
   226
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   227
	}
dvander@458
   228
dvander@458
   229
	return pPlayer->GetAdminId();
dvander@458
   230
}
dvander@458
   231
dvander@458
   232
static cell_t AddUserFlags(IPluginContext *pContext, const cell_t *params)
dvander@458
   233
{
dvander@458
   234
	int client = params[1];
dvander@458
   235
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   236
	if (!pPlayer)
dvander@458
   237
	{
ds@470
   238
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@458
   239
	}
dvander@458
   240
	if (!pPlayer->IsConnected())
dvander@458
   241
	{
ds@470
   242
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   243
	}
dvander@458
   244
dvander@458
   245
	AdminId id;
dvander@458
   246
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   247
	{
dvander@458
   248
		id = g_Admins.CreateAdmin(NULL);
dvander@458
   249
		pPlayer->SetAdminId(id, true);
dvander@458
   250
	}
dvander@458
   251
dvander@458
   252
	cell_t *addr;
dvander@458
   253
	for (int i=2; i<=params[0]; i++)
dvander@458
   254
	{
dvander@458
   255
		pContext->LocalToPhysAddr(params[i], &addr);
dvander@458
   256
		g_Admins.SetAdminFlag(id, (AdminFlag)*addr, true);
dvander@458
   257
	}
dvander@458
   258
dvander@458
   259
	return 1;
dvander@458
   260
}
dvander@458
   261
dvander@458
   262
static cell_t RemoveUserFlags(IPluginContext *pContext, const cell_t *params)
dvander@458
   263
{
dvander@458
   264
	int client = params[1];
dvander@458
   265
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   266
	if (!pPlayer)
dvander@458
   267
	{
ds@470
   268
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@458
   269
	}
dvander@458
   270
	if (!pPlayer->IsConnected())
dvander@458
   271
	{
ds@470
   272
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   273
	}
dvander@458
   274
	
dvander@458
   275
	AdminId id;
dvander@458
   276
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   277
	{
dvander@458
   278
		return 0;
dvander@458
   279
	}
dvander@458
   280
dvander@458
   281
	cell_t *addr;
dvander@458
   282
	for (int i=2; i<=params[0]; i++)
dvander@458
   283
	{
dvander@458
   284
		pContext->LocalToPhysAddr(params[i], &addr);
dvander@458
   285
		g_Admins.SetAdminFlag(id, (AdminFlag)*addr, false);
dvander@458
   286
	}
dvander@458
   287
dvander@458
   288
	return 1;
dvander@458
   289
}
dvander@458
   290
dvander@458
   291
static cell_t SetUserFlagBits(IPluginContext *pContext, const cell_t *params)
dvander@458
   292
{
dvander@458
   293
	int client = params[1];
dvander@458
   294
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   295
	if (!pPlayer)
dvander@458
   296
	{
ds@470
   297
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@458
   298
	}
dvander@458
   299
	if (!pPlayer->IsConnected())
dvander@458
   300
	{
ds@470
   301
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   302
	}
dvander@458
   303
dvander@458
   304
	AdminId id;
dvander@458
   305
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   306
	{
dvander@458
   307
		id = g_Admins.CreateAdmin(NULL);
dvander@458
   308
		pPlayer->SetAdminId(id, true);
dvander@458
   309
	}
dvander@458
   310
dvander@458
   311
	g_Admins.SetAdminFlags(id, Access_Effective, params[2]);
dvander@458
   312
dvander@458
   313
	return 1;
dvander@458
   314
}
dvander@458
   315
dvander@458
   316
static cell_t GetUserFlagBits(IPluginContext *pContext, const cell_t *params)
dvander@458
   317
{
dvander@458
   318
	int client = params[1];
dvander@458
   319
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@458
   320
	if (!pPlayer)
dvander@458
   321
	{
ds@470
   322
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@458
   323
	}
dvander@458
   324
	if (!pPlayer->IsConnected())
dvander@458
   325
	{
ds@470
   326
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@458
   327
	}
dvander@458
   328
dvander@458
   329
	AdminId id;
dvander@458
   330
	if ((id=pPlayer->GetAdminId()) == INVALID_ADMIN_ID)
dvander@458
   331
	{
dvander@458
   332
		return 0;
dvander@458
   333
	}
dvander@458
   334
dvander@458
   335
	return g_Admins.GetAdminFlags(id, Access_Effective);
dvander@458
   336
}
dvander@458
   337
dvander@460
   338
static cell_t GetClientUserId(IPluginContext *pContext, const cell_t *params)
dvander@460
   339
{
dvander@460
   340
	int client = params[1];
dvander@460
   341
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@460
   342
	if (!pPlayer)
dvander@460
   343
	{
ds@470
   344
		return pContext->ThrowNativeError("Invalid client index %d", client);
dvander@460
   345
	}
dvander@460
   346
	if (!pPlayer->IsConnected())
dvander@460
   347
	{
ds@470
   348
		return pContext->ThrowNativeError("Client %d is not connected", client);
dvander@460
   349
	}
dvander@460
   350
dvander@460
   351
	return engine->GetPlayerUserId(pPlayer->GetEdict());
dvander@460
   352
}
dvander@460
   353
dvander@540
   354
static cell_t CanUserTarget(IPluginContext *pContext, const cell_t *params)
dvander@540
   355
{
dvander@540
   356
	int client = params[1];
dvander@540
   357
	int target = params[2];
dvander@540
   358
dvander@540
   359
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@540
   360
	if (!pPlayer)
dvander@540
   361
	{
dvander@540
   362
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
dvander@540
   363
	} else if (!pPlayer->IsConnected()) {
dvander@540
   364
		return pContext->ThrowNativeError("Player %d is not connected", client);
dvander@540
   365
	}
dvander@540
   366
dvander@540
   367
	CPlayer *pTarget = g_Players.GetPlayerByIndex(target);
dvander@540
   368
	if (!pTarget)
dvander@540
   369
	{
dvander@540
   370
		return pContext->ThrowNativeError("Player %d is not a valid client", target);
dvander@540
   371
	} else if (!pTarget->IsConnected()) {
dvander@540
   372
		return pContext->ThrowNativeError("Player %d is not connected", target);
dvander@540
   373
	}
dvander@540
   374
dvander@540
   375
	return g_Admins.CanAdminTarget(pPlayer->GetAdminId(), pTarget->GetAdminId()) ? 1 : 0;
dvander@540
   376
}
dvander@540
   377
dvander@644
   378
static cell_t GetClientTeam(IPluginContext *pContext, const cell_t *params)
dvander@644
   379
{
dvander@644
   380
	int client = params[1];
dvander@644
   381
dvander@644
   382
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@644
   383
	if (!pPlayer)
dvander@644
   384
	{
dvander@644
   385
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
dvander@644
   386
	} else if (!pPlayer->IsInGame()) {
dvander@644
   387
		return pContext->ThrowNativeError("Player %d is not in game", client);
dvander@644
   388
	}
dvander@644
   389
dvander@644
   390
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
dvander@644
   391
	if (!pInfo)
dvander@644
   392
	{
dvander@644
   393
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
dvander@644
   394
	}
dvander@644
   395
dvander@644
   396
	return pInfo->GetTeamIndex();
dvander@644
   397
}
dvander@644
   398
faluco@658
   399
static cell_t GetFragCount(IPluginContext *pContext, const cell_t *params)
faluco@658
   400
{
faluco@658
   401
	int client = params[1];
faluco@658
   402
faluco@658
   403
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   404
	if (!pPlayer)
faluco@658
   405
	{
faluco@658
   406
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   407
	} else if (!pPlayer->IsInGame()) {
faluco@658
   408
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   409
	}
faluco@658
   410
faluco@658
   411
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   412
	if (!pInfo)
faluco@658
   413
	{
faluco@658
   414
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   415
	}
faluco@658
   416
faluco@658
   417
	return pInfo->GetFragCount();
faluco@658
   418
}
faluco@658
   419
faluco@658
   420
static cell_t GetDeathCount(IPluginContext *pContext, const cell_t *params)
faluco@658
   421
{
faluco@658
   422
	int client = params[1];
faluco@658
   423
faluco@658
   424
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   425
	if (!pPlayer)
faluco@658
   426
	{
faluco@658
   427
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   428
	} else if (!pPlayer->IsInGame()) {
faluco@658
   429
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   430
	}
faluco@658
   431
faluco@658
   432
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   433
	if (!pInfo)
faluco@658
   434
	{
faluco@658
   435
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   436
	}
faluco@658
   437
faluco@658
   438
	return pInfo->GetDeathCount();
faluco@658
   439
}
faluco@658
   440
faluco@658
   441
static cell_t GetArmorValue(IPluginContext *pContext, const cell_t *params)
faluco@658
   442
{
faluco@658
   443
	int client = params[1];
faluco@658
   444
faluco@658
   445
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   446
	if (!pPlayer)
faluco@658
   447
	{
faluco@658
   448
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   449
	} else if (!pPlayer->IsInGame()) {
faluco@658
   450
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   451
	}
faluco@658
   452
faluco@658
   453
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   454
	if (!pInfo)
faluco@658
   455
	{
faluco@658
   456
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   457
	}
faluco@658
   458
faluco@658
   459
	return pInfo->GetArmorValue();
faluco@658
   460
}
faluco@658
   461
faluco@658
   462
static cell_t GetAbsOrigin(IPluginContext *pContext, const cell_t *params)
faluco@658
   463
{
faluco@658
   464
	int client = params[1];
faluco@658
   465
faluco@658
   466
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   467
	if (!pPlayer)
faluco@658
   468
	{
faluco@658
   469
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   470
	} else if (!pPlayer->IsInGame()) {
faluco@658
   471
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   472
	}
faluco@658
   473
faluco@658
   474
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   475
	if (!pInfo)
faluco@658
   476
	{
faluco@658
   477
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   478
	}
faluco@658
   479
faluco@658
   480
	cell_t *pVec;
faluco@658
   481
	pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658
   482
faluco@658
   483
	Vector vec = pInfo->GetAbsOrigin();
faluco@658
   484
	pVec[0] = sp_ftoc(vec.x);
faluco@658
   485
	pVec[1] = sp_ftoc(vec.y);
faluco@658
   486
	pVec[2] = sp_ftoc(vec.z);
faluco@658
   487
faluco@658
   488
	return 1;
faluco@658
   489
}
faluco@658
   490
faluco@658
   491
static cell_t GetAbsAngles(IPluginContext *pContext, const cell_t *params)
faluco@658
   492
{
faluco@658
   493
	int client = params[1];
faluco@658
   494
faluco@658
   495
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   496
	if (!pPlayer)
faluco@658
   497
	{
faluco@658
   498
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   499
	} else if (!pPlayer->IsInGame()) {
faluco@658
   500
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   501
	}
faluco@658
   502
faluco@658
   503
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   504
	if (!pInfo)
faluco@658
   505
	{
faluco@658
   506
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   507
	}
faluco@658
   508
faluco@658
   509
	cell_t *pAng;
faluco@658
   510
	pContext->LocalToPhysAddr(params[2], &pAng);
faluco@658
   511
faluco@658
   512
	QAngle ang = pInfo->GetAbsAngles();
faluco@658
   513
	pAng[0] = sp_ftoc(ang.x);
faluco@658
   514
	pAng[1] = sp_ftoc(ang.y);
faluco@658
   515
	pAng[2] = sp_ftoc(ang.z);
faluco@658
   516
faluco@658
   517
	return 1;
faluco@658
   518
}
faluco@658
   519
faluco@658
   520
static cell_t GetPlayerMins(IPluginContext *pContext, const cell_t *params)
faluco@658
   521
{
faluco@658
   522
	int client = params[1];
faluco@658
   523
faluco@658
   524
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   525
	if (!pPlayer)
faluco@658
   526
	{
faluco@658
   527
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   528
	} else if (!pPlayer->IsInGame()) {
faluco@658
   529
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   530
	}
faluco@658
   531
faluco@658
   532
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   533
	if (!pInfo)
faluco@658
   534
	{
faluco@658
   535
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   536
	}
faluco@658
   537
faluco@658
   538
	cell_t *pVec;
faluco@658
   539
	pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658
   540
faluco@658
   541
	Vector vec = pInfo->GetPlayerMins();
faluco@658
   542
	pVec[0] = sp_ftoc(vec.x);
faluco@658
   543
	pVec[1] = sp_ftoc(vec.y);
faluco@658
   544
	pVec[2] = sp_ftoc(vec.z);
faluco@658
   545
faluco@658
   546
	return 1;
faluco@658
   547
}
faluco@658
   548
faluco@658
   549
static cell_t GetPlayerMaxs(IPluginContext *pContext, const cell_t *params)
faluco@658
   550
{
faluco@658
   551
	int client = params[1];
faluco@658
   552
faluco@658
   553
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   554
	if (!pPlayer)
faluco@658
   555
	{
faluco@658
   556
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   557
	} else if (!pPlayer->IsInGame()) {
faluco@658
   558
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   559
	}
faluco@658
   560
faluco@658
   561
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   562
	if (!pInfo)
faluco@658
   563
	{
faluco@658
   564
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   565
	}
faluco@658
   566
faluco@658
   567
	cell_t *pVec;
faluco@658
   568
	pContext->LocalToPhysAddr(params[2], &pVec);
faluco@658
   569
faluco@658
   570
	Vector vec = pInfo->GetPlayerMaxs();
faluco@658
   571
	pVec[0] = sp_ftoc(vec.x);
faluco@658
   572
	pVec[1] = sp_ftoc(vec.y);
faluco@658
   573
	pVec[2] = sp_ftoc(vec.z);
faluco@658
   574
faluco@658
   575
	return 1;
faluco@658
   576
}
faluco@658
   577
faluco@658
   578
static cell_t GetWeaponName(IPluginContext *pContext, const cell_t *params)
faluco@658
   579
{
faluco@658
   580
	int client = params[1];
faluco@658
   581
faluco@658
   582
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   583
	if (!pPlayer)
faluco@658
   584
	{
faluco@658
   585
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   586
	} else if (!pPlayer->IsInGame()) {
faluco@658
   587
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   588
	}
faluco@658
   589
faluco@658
   590
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   591
	if (!pInfo)
faluco@658
   592
	{
faluco@658
   593
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   594
	}
faluco@658
   595
faluco@756
   596
	const char *weapon = pInfo->GetWeaponName();
faluco@756
   597
	pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), weapon ? weapon : "", NULL);
faluco@658
   598
faluco@658
   599
	return 1;
faluco@658
   600
}
faluco@658
   601
faluco@658
   602
static cell_t GetModelName(IPluginContext *pContext, const cell_t *params)
faluco@658
   603
{
faluco@658
   604
	int client = params[1];
faluco@658
   605
faluco@658
   606
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   607
	if (!pPlayer)
faluco@658
   608
	{
faluco@658
   609
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   610
	} else if (!pPlayer->IsInGame()) {
faluco@658
   611
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   612
	}
faluco@658
   613
faluco@658
   614
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   615
	if (!pInfo)
faluco@658
   616
	{
faluco@658
   617
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   618
	}
faluco@658
   619
faluco@756
   620
	const char *model = pInfo->GetModelName();
faluco@756
   621
	pContext->StringToLocalUTF8(params[2], static_cast<size_t>(params[3]), model ? model : "", NULL);
faluco@658
   622
faluco@658
   623
	return 1;
faluco@658
   624
}
faluco@658
   625
faluco@658
   626
static cell_t GetHealth(IPluginContext *pContext, const cell_t *params)
faluco@658
   627
{
faluco@658
   628
	int client = params[1];
faluco@658
   629
faluco@658
   630
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@658
   631
	if (!pPlayer)
faluco@658
   632
	{
faluco@658
   633
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@658
   634
	} else if (!pPlayer->IsInGame()) {
faluco@658
   635
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@658
   636
	}
faluco@658
   637
faluco@658
   638
	IPlayerInfo *pInfo = pPlayer->GetPlayerInfo();
faluco@658
   639
	if (!pInfo)
faluco@658
   640
	{
faluco@658
   641
		return pContext->ThrowNativeError("IPlayerInfo not supported by game");
faluco@658
   642
	}
faluco@658
   643
faluco@658
   644
	return pInfo->GetHealth();
faluco@658
   645
}
faluco@658
   646
faluco@682
   647
static cell_t GetTimeConnected(IPluginContext *pContext, const cell_t *params)
faluco@682
   648
{
faluco@682
   649
	int client = params[1];
faluco@682
   650
faluco@682
   651
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   652
	if (!pPlayer)
faluco@682
   653
	{
faluco@682
   654
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   655
	} else if (!pPlayer->IsInGame()) {
faluco@682
   656
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   657
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   658
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   659
	}
faluco@682
   660
faluco@682
   661
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   662
faluco@682
   663
	return sp_ftoc(pInfo->GetTimeConnected());
faluco@682
   664
}
faluco@682
   665
faluco@682
   666
static cell_t GetDataRate(IPluginContext *pContext, const cell_t *params)
faluco@682
   667
{
faluco@682
   668
	int client = params[1];
faluco@682
   669
faluco@682
   670
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   671
	if (!pPlayer)
faluco@682
   672
	{
faluco@682
   673
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   674
	} else if (!pPlayer->IsInGame()) {
faluco@682
   675
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   676
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   677
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   678
	}
faluco@682
   679
faluco@682
   680
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   681
faluco@682
   682
	return pInfo->GetDataRate();
faluco@682
   683
}
faluco@682
   684
faluco@682
   685
static cell_t IsTimingOut(IPluginContext *pContext, const cell_t *params)
faluco@682
   686
{
faluco@682
   687
	int client = params[1];
faluco@682
   688
faluco@682
   689
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   690
	if (!pPlayer)
faluco@682
   691
	{
faluco@682
   692
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   693
	} else if (!pPlayer->IsInGame()) {
faluco@682
   694
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   695
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   696
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   697
	}
faluco@682
   698
faluco@682
   699
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   700
faluco@682
   701
	return pInfo->IsTimingOut() ? 1 : 0;
faluco@682
   702
}
faluco@682
   703
faluco@682
   704
static cell_t GetLatency(IPluginContext *pContext, const cell_t *params)
faluco@682
   705
{
faluco@682
   706
	int client = params[1];
faluco@682
   707
faluco@682
   708
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   709
	if (!pPlayer)
faluco@682
   710
	{
faluco@682
   711
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   712
	} else if (!pPlayer->IsInGame()) {
faluco@682
   713
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   714
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   715
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   716
	}
faluco@682
   717
faluco@682
   718
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   719
faluco@682
   720
	return sp_ftoc(pInfo->GetLatency(params[2]));
faluco@682
   721
}
faluco@682
   722
faluco@682
   723
static cell_t GetAvgLatency(IPluginContext *pContext, const cell_t *params)
faluco@682
   724
{
faluco@682
   725
	int client = params[1];
faluco@682
   726
faluco@682
   727
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   728
	if (!pPlayer)
faluco@682
   729
	{
faluco@682
   730
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   731
	} else if (!pPlayer->IsInGame()) {
faluco@682
   732
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   733
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   734
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   735
	}
faluco@682
   736
faluco@682
   737
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   738
faluco@682
   739
	return sp_ftoc(pInfo->GetAvgLatency(params[2]));
faluco@682
   740
}
faluco@682
   741
faluco@682
   742
static cell_t GetAvgLoss(IPluginContext *pContext, const cell_t *params)
faluco@682
   743
{
faluco@682
   744
	int client = params[1];
faluco@682
   745
faluco@682
   746
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   747
	if (!pPlayer)
faluco@682
   748
	{
faluco@682
   749
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   750
	} else if (!pPlayer->IsInGame()) {
faluco@682
   751
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   752
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   753
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   754
	}
faluco@682
   755
faluco@682
   756
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   757
faluco@682
   758
	return sp_ftoc(pInfo->GetAvgLoss(params[2]));
faluco@682
   759
}
faluco@682
   760
faluco@682
   761
static cell_t GetAvgChoke(IPluginContext *pContext, const cell_t *params)
faluco@682
   762
{
faluco@682
   763
	int client = params[1];
faluco@682
   764
faluco@682
   765
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   766
	if (!pPlayer)
faluco@682
   767
	{
faluco@682
   768
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   769
	} else if (!pPlayer->IsInGame()) {
faluco@682
   770
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   771
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   772
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   773
	}
faluco@682
   774
faluco@682
   775
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   776
faluco@682
   777
	return sp_ftoc(pInfo->GetAvgChoke(params[2]));
faluco@682
   778
}
faluco@682
   779
faluco@682
   780
static cell_t GetAvgData(IPluginContext *pContext, const cell_t *params)
faluco@682
   781
{
faluco@682
   782
	int client = params[1];
faluco@682
   783
faluco@682
   784
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   785
	if (!pPlayer)
faluco@682
   786
	{
faluco@682
   787
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   788
	} else if (!pPlayer->IsInGame()) {
faluco@682
   789
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   790
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   791
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   792
	}
faluco@682
   793
faluco@682
   794
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   795
faluco@682
   796
	return sp_ftoc(pInfo->GetAvgData(params[2]));
faluco@682
   797
}
faluco@682
   798
faluco@682
   799
static cell_t GetAvgPackets(IPluginContext *pContext, const cell_t *params)
faluco@682
   800
{
faluco@682
   801
	int client = params[1];
faluco@682
   802
faluco@682
   803
	CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
faluco@682
   804
	if (!pPlayer)
faluco@682
   805
	{
faluco@682
   806
		return pContext->ThrowNativeError("Player %d is not a valid client", client);
faluco@682
   807
	} else if (!pPlayer->IsInGame()) {
faluco@682
   808
		return pContext->ThrowNativeError("Player %d is not in game", client);
faluco@682
   809
	} else if (pPlayer->IsFakeClient()) {
faluco@682
   810
		return pContext->ThrowNativeError("Player %d is a bot", client);
faluco@682
   811
	}
faluco@682
   812
faluco@682
   813
	INetChannelInfo *pInfo = engine->GetPlayerNetInfo(client);
faluco@682
   814
faluco@682
   815
	return sp_ftoc(pInfo->GetAvgPackets(params[2]));
faluco@682
   816
}
faluco@682
   817
faluco@682
   818
static cell_t GetClientOfUserId(IPluginContext *pContext, const cell_t *params)
faluco@682
   819
{
faluco@682
   820
	return g_Players.GetClientOfUserId(params[1]);
faluco@682
   821
}
faluco@682
   822
dvander@910
   823
static cell_t ShowActivity(IPluginContext *pContext, const cell_t *params)
dvander@910
   824
{
dvander@910
   825
	int value = sm_show_activity.GetInt();
dvander@910
   826
dvander@910
   827
	if (!value)
dvander@910
   828
	{
dvander@910
   829
		return 0;
dvander@910
   830
	}
dvander@910
   831
dvander@910
   832
	int client = params[1];
dvander@910
   833
dvander@910
   834
	const char *name = "Console";
dvander@910
   835
	const char *sign = "ADMIN";
dvander@910
   836
	if (client != 0)
dvander@910
   837
	{
dvander@910
   838
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(client);
dvander@910
   839
		if (!pPlayer || !pPlayer->IsConnected())
dvander@910
   840
		{
dvander@910
   841
			return pContext->ThrowNativeError("Client index %d is invalid", client);
dvander@910
   842
		}
dvander@910
   843
		name = pPlayer->GetName();
dvander@910
   844
		AdminId id = pPlayer->GetAdminId();
dvander@910
   845
		if (id == INVALID_ADMIN_ID
dvander@910
   846
			|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@910
   847
		{
dvander@910
   848
			sign = "PLAYER";
dvander@910
   849
		}
dvander@910
   850
	}
dvander@910
   851
dvander@910
   852
	char message[255];
dvander@910
   853
	char buffer[255];
dvander@910
   854
	int maxClients = g_Players.GetMaxClients();
dvander@910
   855
	for (int i=1; i<=maxClients; i++)
dvander@910
   856
	{
dvander@910
   857
		CPlayer *pPlayer = g_Players.GetPlayerByIndex(i);
dvander@910
   858
		if (!pPlayer->IsInGame() || pPlayer->IsFakeClient())
dvander@910
   859
		{
dvander@910
   860
			continue;
dvander@910
   861
		}
dvander@910
   862
		AdminId id = pPlayer->GetAdminId();
dvander@910
   863
		g_SourceMod.SetGlobalTarget(i);
dvander@910
   864
		if (id == INVALID_ADMIN_ID
dvander@910
   865
			|| !g_Admins.GetAdminFlag(id, Admin_Generic, Access_Effective))
dvander@910
   866
		{
dvander@910
   867
			/* Treat this as a normal user */
dvander@910
   868
			if ((value & 1) || (value & 2))
dvander@910
   869
			{
dvander@910
   870
				const char *newsign = sign;
dvander@910
   871
				if (value & 2)
dvander@910
   872
				{
dvander@910
   873
					newsign = name;
dvander@910
   874
				}
dvander@910
   875
				g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
dvander@910
   876
				UTIL_Format(message, sizeof(message), "[SM] %s: %s", newsign, buffer);
dvander@910
   877
				g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@910
   878
			}
dvander@910
   879
		} else {
dvander@910
   880
			/* Treat this as an admin user */
dvander@910
   881
			bool is_root = g_Admins.GetAdminFlag(id, Admin_Root, Access_Effective);
dvander@910
   882
			if ((value & 4) 
dvander@910
   883
				|| (value & 8)
dvander@910
   884
				|| ((value & 16) && is_root))
dvander@910
   885
			{
dvander@910
   886
				const char *newsign = sign;
dvander@910
   887
				if ((value & 8) || ((value & 16) && is_root))
dvander@910
   888
				{
dvander@910
   889
					newsign = name;
dvander@910
   890
				}
dvander@910
   891
				g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
dvander@910
   892
				UTIL_Format(message, sizeof(message), "[SM] %s: %s", newsign, buffer);
dvander@910
   893
				g_HL2.TextMsg(i, HUD_PRINTTALK, message);
dvander@910
   894
			}
dvander@910
   895
		}
dvander@910
   896
	}
dvander@910
   897
dvander@910
   898
	return 1;
dvander@910
   899
}
dvander@910
   900
faluco@260
   901
REGISTER_NATIVES(playernatives)
faluco@260
   902
{
dvander@644
   903
	{"AddUserFlags",			AddUserFlags},
dvander@644
   904
	{"CanUserTarget",			CanUserTarget},
dvander@644
   905
	{"GetClientAuthString",		sm_GetClientAuthStr},
faluco@260
   906
	{"GetClientCount",			sm_GetClientCount},
dvander@644
   907
	{"GetClientInfo",			sm_GetClientInfo},
faluco@260
   908
	{"GetClientIP",				sm_GetClientIP},
dvander@644
   909
	{"GetClientName",			sm_GetClientName},
dvander@644
   910
	{"GetClientTeam",			GetClientTeam},
dvander@644
   911
	{"GetClientUserId",			GetClientUserId},
dvander@644
   912
	{"GetMaxClients",			sm_GetMaxClients},
dvander@644
   913
	{"GetUserAdmin",			GetUserAdmin},
dvander@644
   914
	{"GetUserFlagBits",			GetUserFlagBits},
ds@784
   915
	{"IsClientAuthorized",		sm_IsClientAuthorized},
ds@784
   916
	{"IsClientConnected",		sm_IsClientConnected},
ds@784
   917
	{"IsFakeClient",			sm_IsClientFakeClient},
ds@784
   918
	{"IsPlayerInGame",			sm_IsClientInGame},			/* Backwards compat shim */
ds@784
   919
	{"IsClientInGame",			sm_IsClientInGame},
dvander@458
   920
	{"RemoveUserFlags",			RemoveUserFlags},
dvander@644
   921
	{"SetUserAdmin",			SetUserAdmin},
dvander@458
   922
	{"SetUserFlagBits",			SetUserFlagBits},
faluco@658
   923
	{"GetClientDeaths",			GetDeathCount},
faluco@658
   924
	{"GetClientFrags",			GetFragCount},
faluco@658
   925
	{"GetClientArmor",			GetArmorValue},
faluco@658
   926
	{"GetClientAbsOrigin",		GetAbsOrigin},
faluco@658
   927
	{"GetClientAbsAngles",		GetAbsAngles},
faluco@658
   928
	{"GetClientMins",			GetPlayerMins},
faluco@658
   929
	{"GetClientMaxs",			GetPlayerMaxs},
faluco@658
   930
	{"GetClientWeapon",			GetWeaponName},
faluco@658
   931
	{"GetClientModel",			GetModelName},
faluco@658
   932
	{"GetClientHealth",			GetHealth},
dvander@691
   933
	{"GetClientTime",			GetTimeConnected},
dvander@691
   934
	{"GetClientDataRate",		GetDataRate},
dvander@691
   935
	{"IsClentTimingOut",		IsTimingOut},
dvander@691
   936
	{"GetClientLatency",		GetLatency},
dvander@691
   937
	{"GetClientAvgLatency",		GetAvgLatency},
dvander@691
   938
	{"GetClientAvgLoss",		GetAvgLoss},
dvander@691
   939
	{"GetClientAvgChoke",		GetAvgChoke},
dvander@691
   940
	{"GetClientAvgData",		GetAvgData},
dvander@691
   941
	{"GetClientAvgPackets",		GetAvgPackets},
faluco@682
   942
	{"GetClientOfUserId",		GetClientOfUserId},
dvander@910
   943
	{"ShowActivity",			ShowActivity},
faluco@260
   944
	{NULL,						NULL}
dvander@351
   945
};