core/smn_console.cpp
author David Anderson <dvander@alliedmods.net>
Wed Jun 06 06:04:16 2007 +0000 (2007-06-06)
changeset 883 f4eff9faf362
parent 873 a2136b3be10d
child 893 a3bc816549a8
permissions -rw-r--r--
fixed inheritance not being used in the base menu style when removing clients from the watch list
     1 /**
     2  * vim: set ts=4 :
     3  * ===============================================================
     4  * SourceMod (C)2004-2007 AlliedModders LLC.  All rights reserved.
     5  * ===============================================================
     6  *
     7  * This file is not open source and may not be copied without explicit
     8  * written permission of AlliedModders LLC.  This file may not be redistributed 
     9  * in whole or significant part.
    10  * For information, see LICENSE.txt or http://www.sourcemod.net/license.php
    11  *
    12  * Version: $Id$
    13  */
    14 
    15 #include "sm_globals.h"
    16 #include "HalfLife2.h"
    17 #include "sourcemm_api.h"
    18 #include "HandleSys.h"
    19 #include "ConVarManager.h"
    20 #include "ConCmdManager.h"
    21 #include "PluginSys.h"
    22 #include "sm_stringutil.h"
    23 #include "PlayerManager.h"
    24 
    25 enum ConVarBounds
    26 {
    27 	ConVarBound_Upper = 0,
    28 	ConVarBound_Lower
    29 };
    30 
    31 static cell_t sm_CreateConVar(IPluginContext *pContext, const cell_t *params)
    32 {
    33 	char *name, *defaultVal, *helpText;
    34 
    35 	pContext->LocalToString(params[1], &name);
    36 
    37 	// While the engine seems to accept a blank convar name, it causes a crash upon server quit
    38 	if (name == NULL || strcmp(name, "") == 0)
    39 	{
    40 		return pContext->ThrowNativeError("Convar with blank name is not permitted");
    41 	}
    42 
    43 	pContext->LocalToString(params[2], &defaultVal);
    44 	pContext->LocalToString(params[3], &helpText);
    45 
    46 	bool hasMin = params[5] ? true : false;
    47 	bool hasMax = params[7] ? true : false;
    48 	float min = sp_ctof(params[6]);
    49 	float max = sp_ctof(params[8]);
    50 
    51 	Handle_t hndl = g_ConVarManager.CreateConVar(pContext, name, defaultVal, helpText, params[4], hasMin, min, hasMax, max);
    52 
    53 	if (hndl == BAD_HANDLE)
    54 	{
    55 		return pContext->ThrowNativeError("Convar \"%s\" was not created. A console command with the same name already exists.", name);
    56 	}
    57 
    58 	return hndl;
    59 }
    60 
    61 static cell_t sm_FindConVar(IPluginContext *pContext, const cell_t *params)
    62 {
    63 	char *name;
    64 
    65 	pContext->LocalToString(params[1], &name);
    66 
    67 	return g_ConVarManager.FindConVar(name);
    68 }
    69 
    70 static cell_t sm_HookConVarChange(IPluginContext *pContext, const cell_t *params)
    71 {
    72 	Handle_t hndl = static_cast<Handle_t>(params[1]);
    73 	HandleError err;
    74 	ConVar *pConVar;
    75 
    76 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
    77 		!= HandleError_None)
    78 	{
    79 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
    80 	}
    81 
    82 	IPluginFunction *pFunction = pContext->GetFunctionById(params[2]);
    83 
    84 	if (!pFunction)
    85 	{
    86 		return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
    87 	}
    88 
    89 	g_ConVarManager.HookConVarChange(pConVar, pFunction);
    90 
    91 	return 1;
    92 }
    93 
    94 static cell_t sm_UnhookConVarChange(IPluginContext *pContext, const cell_t *params)
    95 {
    96 	Handle_t hndl = static_cast<Handle_t>(params[1]);
    97 	HandleError err;
    98 	ConVar *pConVar;
    99 
   100 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   101 		!= HandleError_None)
   102 	{
   103 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   104 	}
   105 
   106 	IPluginFunction *pFunction = pContext->GetFunctionById(params[2]);
   107 
   108 	if (!pFunction)
   109 	{
   110 		return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
   111 	}
   112 
   113 	g_ConVarManager.UnhookConVarChange(pConVar, pFunction);
   114 
   115 	return 1;
   116 }
   117 
   118 static cell_t sm_GetConVarBool(IPluginContext *pContext, const cell_t *params)
   119 {
   120 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   121 	HandleError err;
   122 	ConVar *pConVar;
   123 
   124 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   125 		!= HandleError_None)
   126 	{
   127 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   128 	}
   129 
   130 	return pConVar->GetBool();
   131 }
   132 
   133 static cell_t sm_GetConVarInt(IPluginContext *pContext, const cell_t *params)
   134 {
   135 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   136 	HandleError err;
   137 	ConVar *pConVar;
   138 
   139 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   140 		!= HandleError_None)
   141 	{
   142 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   143 	}
   144 
   145 	return pConVar->GetInt();
   146 }
   147 
   148 /* This handles both SetConVarBool() and SetConVarInt() */
   149 static cell_t sm_SetConVarNum(IPluginContext *pContext, const cell_t *params)
   150 {
   151 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   152 	HandleError err;
   153 	ConVar *pConVar;
   154 
   155 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   156 		!= HandleError_None)
   157 	{
   158 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   159 	}
   160 
   161 	pConVar->SetValue(params[2]);
   162 
   163 	return 1;
   164 }
   165 
   166 static cell_t sm_GetConVarFloat(IPluginContext *pContext, const cell_t *params)
   167 {
   168 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   169 	HandleError err;
   170 	ConVar *pConVar;
   171 
   172 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   173 		!= HandleError_None)
   174 	{
   175 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   176 	}
   177 	
   178 	float value = pConVar->GetFloat();
   179 
   180 	return sp_ftoc(value);
   181 }
   182 
   183 static cell_t sm_SetConVarFloat(IPluginContext *pContext, const cell_t *params)
   184 {
   185 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   186 	HandleError err;
   187 	ConVar *pConVar;
   188 
   189 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   190 		!= HandleError_None)
   191 	{
   192 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   193 	}
   194 
   195 	float value = sp_ctof(params[2]);
   196 	pConVar->SetValue(value);
   197 
   198 	return 1;
   199 }
   200 
   201 static cell_t sm_GetConVarString(IPluginContext *pContext, const cell_t *params)
   202 {
   203 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   204 	HandleError err;
   205 	ConVar *pConVar;
   206 
   207 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   208 		!= HandleError_None)
   209 	{
   210 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   211 	}
   212 
   213 	pContext->StringToLocalUTF8(params[2], params[3], pConVar->GetString(), NULL);
   214 
   215 	return 1;
   216 }
   217 
   218 static cell_t sm_SetConVarString(IPluginContext *pContext, const cell_t *params)
   219 {
   220 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   221 	HandleError err;
   222 	ConVar *pConVar;
   223 
   224 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   225 		!= HandleError_None)
   226 	{
   227 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   228 	}
   229 
   230 	char *value;
   231 	pContext->LocalToString(params[2], &value);
   232 
   233 	pConVar->SetValue(value);
   234 
   235 	return 1;
   236 }
   237 
   238 static cell_t sm_GetConVarFlags(IPluginContext *pContext, const cell_t *params)
   239 {
   240 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   241 	HandleError err;
   242 	ConVar *pConVar;
   243 
   244 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   245 		!= HandleError_None)
   246 	{
   247 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   248 	}
   249 
   250 	return pConVar->GetFlags();
   251 }
   252 
   253 static cell_t sm_SetConVarFlags(IPluginContext *pContext, const cell_t *params)
   254 {
   255 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   256 	HandleError err;
   257 	ConVar *pConVar;
   258 
   259 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   260 		!= HandleError_None)
   261 	{
   262 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   263 	}
   264 
   265 	pConVar->SetFlags(params[2]);
   266 
   267 	return 1;
   268 }
   269 
   270 static cell_t sm_GetConVarBounds(IPluginContext *pContext, const cell_t *params)
   271 {
   272 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   273 	HandleError err;
   274 	ConVar *pConVar;
   275 
   276 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   277 		!= HandleError_None)
   278 	{
   279 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   280 	}
   281 
   282 	cell_t *addr;
   283 	bool hasBound;
   284 	float bound;
   285 
   286 	switch (params[2])
   287 	{
   288 	case ConVarBound_Upper:
   289 		hasBound = pConVar->GetMax(bound);
   290 		break;
   291 	case ConVarBound_Lower:
   292 		hasBound = pConVar->GetMin(bound);
   293 		break;
   294 	default:
   295 		return pContext->ThrowNativeError("Invalid ConVarBounds value %d");
   296 	}
   297 	
   298 	pContext->LocalToPhysAddr(params[3], &addr);
   299 	*addr = sp_ftoc(bound);
   300 
   301 	return hasBound;
   302 }
   303 
   304 static cell_t sm_SetConVarBounds(IPluginContext *pContext, const cell_t *params)
   305 {
   306 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   307 	HandleError err;
   308 	ConVar *pConVar;
   309 
   310 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   311 		!= HandleError_None)
   312 	{
   313 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   314 	}
   315 
   316 	switch (params[2])
   317 	{
   318 	case ConVarBound_Upper:
   319 		pConVar->SetMax(params[3] ? true : false, sp_ctof(params[4]));
   320 		break;
   321 	case ConVarBound_Lower:
   322 		pConVar->SetMin(params[3] ? true : false, sp_ctof(params[4]));
   323 		break;
   324 	default:
   325 		return pContext->ThrowNativeError("Invalid ConVarBounds value %d");
   326 	}
   327 
   328 	return 1;
   329 }
   330 
   331 static cell_t sm_GetConVarName(IPluginContext *pContext, const cell_t *params)
   332 {
   333 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   334 	HandleError err;
   335 	ConVar *pConVar;
   336 
   337 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   338 		!= HandleError_None)
   339 	{
   340 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   341 	}
   342 
   343 	pContext->StringToLocalUTF8(params[2], params[3], pConVar->GetName(), NULL);
   344 
   345 	return 1;
   346 }
   347 
   348 static cell_t sm_ResetConVar(IPluginContext *pContext, const cell_t *params)
   349 {
   350 	Handle_t hndl = static_cast<Handle_t>(params[1]);
   351 	HandleError err;
   352 	ConVar *pConVar;
   353 
   354 	if ((err=g_HandleSys.ReadHandle(hndl, g_ConVarManager.GetHandleType(), NULL, (void **)&pConVar))
   355 		!= HandleError_None)
   356 	{
   357 		return pContext->ThrowNativeError("Invalid convar handle %x (error %d)", hndl, err);
   358 	}
   359 
   360 	pConVar->Revert();
   361 
   362 	return 1;
   363 }
   364 
   365 static bool s_QueryAlreadyWarned = false;
   366 
   367 static cell_t sm_QueryClientConVar(IPluginContext *pContext, const cell_t *params)
   368 {
   369 	CPlayer *pPlayer;
   370 	char *name;
   371 	IPluginFunction *pCallback;
   372 
   373 	if (g_IsOriginalEngine)
   374 	{
   375 		if (!s_QueryAlreadyWarned)
   376 		{
   377 			s_QueryAlreadyWarned = true;
   378 			return pContext->ThrowNativeError("Game does not support client convar querying (one time warning)");
   379 		}
   380 
   381 		return 0;
   382 	}
   383 
   384 	pPlayer = g_Players.GetPlayerByIndex(params[1]);
   385 
   386 	if (!pPlayer)
   387 	{
   388 		return pContext->ThrowNativeError("Player %d is not a valid player", params[1]);
   389 	}
   390 
   391 	if (!pPlayer->IsConnected())
   392 	{
   393 		return pContext->ThrowNativeError("Player %d is not connected", params[1]);
   394 	}
   395 
   396 	/* Trying a query on a bot results in callback not be fired, so don't bother */
   397 	if (pPlayer->IsFakeClient())
   398 	{
   399 		return 0;
   400 	}
   401 
   402 	pContext->LocalToString(params[2], &name);
   403 	pCallback = pContext->GetFunctionById(params[3]);
   404 
   405 	if (!pCallback)
   406 	{
   407 		return pContext->ThrowNativeError("Invalid function id (%X)", params[3]);
   408 	}
   409 
   410 	return g_ConVarManager.QueryClientConVar(pPlayer->GetEdict(), name, pCallback, params[4]);
   411 }
   412 
   413 static cell_t sm_RegServerCmd(IPluginContext *pContext, const cell_t *params)
   414 {
   415 	char *name,*help;
   416 	IPluginFunction *pFunction;
   417 
   418 	pContext->LocalToString(params[1], &name);
   419 	pContext->LocalToString(params[3], &help);
   420 	pFunction = pContext->GetFunctionById(params[2]);
   421 
   422 	if (!pFunction)
   423 	{
   424 		return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
   425 	}
   426 
   427 	if (!g_ConCmds.AddServerCommand(pFunction, name, help, params[4]))
   428 	{
   429 		return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
   430 	}
   431 
   432 	return 1;
   433 }
   434 
   435 static cell_t sm_RegConsoleCmd(IPluginContext *pContext, const cell_t *params)
   436 {
   437 	char *name,*help;
   438 	IPluginFunction *pFunction;
   439 
   440 	pContext->LocalToString(params[1], &name);
   441 	pContext->LocalToString(params[3], &help);
   442 	pFunction = pContext->GetFunctionById(params[2]);
   443 
   444 	if (!pFunction)
   445 	{
   446 		return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
   447 	}
   448 
   449 	if (!g_ConCmds.AddConsoleCommand(pFunction, name, help, params[4]))
   450 	{
   451 		return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
   452 	}
   453 
   454 	return 1;
   455 }
   456 
   457 static cell_t sm_RegAdminCmd(IPluginContext *pContext, const cell_t *params)
   458 {
   459 	char *name,*help;
   460 	const char *group;
   461 	IPluginFunction *pFunction;
   462 	FlagBits flags = params[3];
   463 	int cmdflags = params[6];
   464 
   465 	pContext->LocalToString(params[1], &name);
   466 	pContext->LocalToString(params[4], &help);
   467 	pContext->LocalToString(params[5], (char **)&group);
   468 	pFunction = pContext->GetFunctionById(params[2]);
   469 
   470 	if (group[0] == '\0')
   471 	{
   472 		CPlugin *pPlugin = g_PluginSys.GetPluginByCtx(pContext->GetContext());
   473 		group = pPlugin->GetFilename();
   474 	}
   475 
   476 	if (!pFunction)
   477 	{
   478 		return pContext->ThrowNativeError("Invalid function id (%X)", params[2]);
   479 	}
   480 
   481 	if (!g_ConCmds.AddAdminCommand(pFunction, name, group, flags, help, cmdflags))
   482 	{
   483 		return pContext->ThrowNativeError("Command \"%s\" could not be created. A convar with the same name already exists.", name);
   484 	}
   485 
   486 	return 1;
   487 }
   488 
   489 static cell_t sm_GetCmdArgs(IPluginContext *pContext, const cell_t *params)
   490 {
   491 	return engine->Cmd_Argc() - 1;
   492 }
   493 
   494 static cell_t sm_GetCmdArg(IPluginContext *pContext, const cell_t *params)
   495 {
   496 	const char *arg = engine->Cmd_Argv(params[1]);
   497 	
   498 	pContext->StringToLocalUTF8(params[2], params[3], arg, NULL);
   499 
   500 	return 1;
   501 }
   502 
   503 static cell_t sm_GetCmdArgString(IPluginContext *pContext, const cell_t *params)
   504 {
   505 	const char *args = engine->Cmd_Args();
   506 
   507 	if (!args)
   508 	{
   509 		args = "";
   510 	}
   511 
   512 	pContext->StringToLocalUTF8(params[1], params[2], args, NULL);
   513 
   514 	return 1;
   515 }
   516 
   517 static cell_t sm_PrintToServer(IPluginContext *pCtx, const cell_t *params)
   518 {
   519 	char buffer[1024];
   520 	char *fmt;
   521 	int arg = 2;
   522 
   523 	pCtx->LocalToString(params[1], &fmt);
   524 	size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
   525 
   526 	buffer[res++] = '\n';
   527 	buffer[res] = '\0';
   528 
   529 	META_CONPRINT(buffer);
   530 
   531 	return 1;
   532 }
   533 
   534 static cell_t sm_PrintToConsole(IPluginContext *pCtx, const cell_t *params)
   535 {
   536 	int index = params[1];
   537 	if ((index < 0) || (index > g_Players.GetMaxClients()))
   538 	{
   539 		return pCtx->ThrowNativeError("Invalid client index %d", index);
   540 	}
   541 
   542 	CPlayer *pPlayer = NULL;
   543 	if (index != 0)
   544 	{
   545 		pPlayer = g_Players.GetPlayerByIndex(index);
   546 		if (!pPlayer->IsInGame())
   547 		{
   548 			return pCtx->ThrowNativeError("Client %d is not in game", index);
   549 		}
   550 		
   551 		/* Silent fail on bots, engine will crash */
   552 		if (pPlayer->IsFakeClient())
   553 		{
   554 			return 0;
   555 		}
   556 	}
   557 
   558 	char buffer[1024];
   559 	char *fmt;
   560 	int arg = 3;
   561 
   562 	pCtx->LocalToString(params[2], &fmt);
   563 	size_t res = atcprintf(buffer, sizeof(buffer)-2, fmt, pCtx, params, &arg);
   564 
   565 	buffer[res++] = '\n';
   566 	buffer[res] = '\0';
   567 
   568 	if (index != 0)
   569 	{
   570 		engine->ClientPrintf(pPlayer->GetEdict(), buffer);
   571 	} else {
   572 		META_CONPRINT(buffer);
   573 	}
   574 
   575 	return 1;
   576 }
   577 
   578 static cell_t sm_ServerCommand(IPluginContext *pContext, const cell_t *params)
   579 {
   580 	char buffer[1024];
   581 	size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 1);
   582 
   583 	/* One byte for null terminator, one for newline */
   584 	buffer[len++] = '\n';
   585 	buffer[len] = '\0';
   586 
   587 	engine->ServerCommand(buffer);
   588 
   589 	return 1;
   590 }
   591 
   592 static cell_t sm_InsertServerCommand(IPluginContext *pContext, const cell_t *params)
   593 {
   594 	char buffer[1024];
   595 	size_t len = g_SourceMod.FormatString(buffer, sizeof(buffer)-2, pContext, params, 1);
   596 
   597 	/* One byte for null terminator, one for newline */
   598 	buffer[len++] = '\n';
   599 	buffer[len] = '\0';
   600 
   601 	engine->InsertServerCommand(buffer);
   602 
   603 	return 1;
   604 }
   605 
   606 static cell_t sm_ServerExecute(IPluginContext *pContext, const cell_t *params)
   607 {
   608 	engine->ServerExecute();
   609 
   610 	return 1;
   611 }
   612 
   613 static cell_t sm_ClientCommand(IPluginContext *pContext, const cell_t *params)
   614 {
   615 	CPlayer *pPlayer = g_Players.GetPlayerByIndex(params[1]);
   616 
   617 	if (!pPlayer)
   618 	{
   619 		return pContext->ThrowNativeError("Player %d is not a valid player", params[1]);
   620 	}
   621 
   622 	if (!pPlayer->IsConnected())
   623 	{
   624 		return pContext->ThrowNativeError("Player %d is not connected", params[1]);
   625 	}
   626 
   627 	char buffer[256];
   628 	g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);
   629 
   630 	engine->ClientCommand(pPlayer->GetEdict(), "%s", buffer);
   631 
   632 	return 1;
   633 }
   634 
   635 REGISTER_NATIVES(consoleNatives)
   636 {
   637 	{"CreateConVar",		sm_CreateConVar},
   638 	{"FindConVar",			sm_FindConVar},
   639 	{"HookConVarChange",	sm_HookConVarChange},
   640 	{"UnhookConVarChange",	sm_UnhookConVarChange},
   641 	{"GetConVarBool",		sm_GetConVarBool},
   642 	{"SetConVarBool",		sm_SetConVarNum},
   643 	{"GetConVarInt",		sm_GetConVarInt},
   644 	{"SetConVarInt",		sm_SetConVarNum},
   645 	{"GetConVarFloat",		sm_GetConVarFloat},
   646 	{"SetConVarFloat",		sm_SetConVarFloat},
   647 	{"GetConVarString",		sm_GetConVarString},
   648 	{"SetConVarString",		sm_SetConVarString},
   649 	{"GetConVarFlags",		sm_GetConVarFlags},
   650 	{"SetConVarFlags",		sm_SetConVarFlags},
   651 	{"GetConVarName",		sm_GetConVarName},
   652 	{"GetConVarBounds",		sm_GetConVarBounds},
   653 	{"SetConVarBounds",		sm_SetConVarBounds},
   654 	{"ResetConVar",			sm_ResetConVar},
   655 	{"QueryClientConVar",	sm_QueryClientConVar},
   656 	{"RegServerCmd",		sm_RegServerCmd},
   657 	{"RegConsoleCmd",		sm_RegConsoleCmd},
   658 	{"GetCmdArgString",		sm_GetCmdArgString},
   659 	{"GetCmdArgs",			sm_GetCmdArgs},
   660 	{"GetCmdArg",			sm_GetCmdArg},
   661 	{"PrintToServer",		sm_PrintToServer},
   662 	{"PrintToConsole",		sm_PrintToConsole},
   663 	{"RegAdminCmd",			sm_RegAdminCmd},
   664 	{"ServerCommand",		sm_ServerCommand},
   665 	{"InsertServerCommand",	sm_InsertServerCommand},
   666 	{"ServerExecute",		sm_ServerExecute},
   667 	{"ClientCommand",		sm_ClientCommand},
   668 	{NULL,					NULL}
   669 };