sourcemm/metamod_console.cpp
branchhookman_autogen
changeset 531 0180319136ba
parent 479 b43ebc944319
child 532 9729de2d7551
     1.1 --- a/sourcemm/metamod_console.cpp	Sun Nov 25 01:22:41 2007 +0000
     1.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.3 @@ -1,747 +0,0 @@
     1.4 -/**
     1.5 - * vim: set ts=4 :
     1.6 - * ======================================================
     1.7 - * Metamod:Source
     1.8 - * Copyright (C) 2004-2007 AlliedModders LLC and authors.
     1.9 - * All rights reserved.
    1.10 - * ======================================================
    1.11 - *
    1.12 - * This software is provided 'as-is', without any express or implied warranty.
    1.13 - * In no event will the authors be held liable for any damages arising from 
    1.14 - * the use of this software.
    1.15 - * 
    1.16 - * Permission is granted to anyone to use this software for any purpose, 
    1.17 - * including commercial applications, and to alter it and redistribute it 
    1.18 - * freely, subject to the following restrictions:
    1.19 - *
    1.20 - * 1. The origin of this software must not be misrepresented; you must not 
    1.21 - * claim that you wrote the original software. If you use this software in a 
    1.22 - * product, an acknowledgment in the product documentation would be 
    1.23 - * appreciated but is not required.
    1.24 - * 2. Altered source versions must be plainly marked as such, and must not be
    1.25 - * misrepresented as being the original software.
    1.26 - * 3. This notice may not be removed or altered from any source distribution.
    1.27 - *
    1.28 - * Version: $Id$
    1.29 - */
    1.30 -
    1.31 -#if defined _DEBUG
    1.32 -#define DEBUG2
    1.33 -#undef _DEBUG
    1.34 -#endif
    1.35 -#include <ctype.h>
    1.36 -#include "metamod.h"
    1.37 -#include "metamod_util.h"
    1.38 -#include "metamod_console.h"
    1.39 -#include "metamod_plugins.h"
    1.40 -#if defined DEBUG2
    1.41 -#undef DEBUG2
    1.42 -#define _DEBUG
    1.43 -#endif
    1.44 -
    1.45 -using namespace SourceMM;
    1.46 -using namespace SourceHook;
    1.47 -
    1.48 -/**
    1.49 - * @brief Console Command Implementations
    1.50 - * @file concommands.cpp
    1.51 - */
    1.52 -
    1.53 -#define CONMSG			g_Metamod.ConPrintf
    1.54 -#define CLIENT_CONMSG	g_Metamod.ClientConPrintf
    1.55 -
    1.56 -bool Command_Meta(IMetamodSourceCommandInfo *info)
    1.57 -{
    1.58 -	unsigned int args = info->GetArgCount();
    1.59 -
    1.60 -	if (args >= 1)
    1.61 -	{
    1.62 -		const char *command = info->GetArg(1);
    1.63 -		if (strcmp(command, "credits") == 0)
    1.64 -		{
    1.65 -			CONMSG("Metamod:Source was developed by:\n");
    1.66 -			CONMSG("  SourceHook: Pavol \"PM OnoTo\" Marko\n");
    1.67 -			CONMSG("  GameDLL/Plugins: David \"BAILOPAN\" Anderson\n");
    1.68 -			CONMSG("  GameDLL: Scott \"Damaged Soul\" Ehlert\n");
    1.69 -			CONMSG("For more information, see the official website\n");
    1.70 -			CONMSG("http://www.sourcemm.net/\n");
    1.71 -			
    1.72 -			return true;
    1.73 -		}
    1.74 -		else if (strcmp(command, "version") == 0)
    1.75 -		{
    1.76 -			CONMSG("Metamod:Source version %s\n", SOURCEMM_VERSION);
    1.77 -			CONMSG("Compiled on: %s\n", SOURCEMM_DATE);
    1.78 -			CONMSG("Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
    1.79 -			CONMSG("SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
    1.80 -			CONMSG("http://www.sourcemm.net/\n");
    1.81 -
    1.82 -			return true;
    1.83 -		}
    1.84 -		else if (strcmp(command, "game") == 0)
    1.85 -		{
    1.86 -			CONMSG("GameDLL Information\n");
    1.87 -			CONMSG("  Description: %s\n", provider->GetGameDescription());
    1.88 -			CONMSG("  Mod Path: %s\n", g_Metamod.GetBaseDir());
    1.89 -			CONMSG("  DLL Path: %s\n", g_Metamod.GetGameBinaryPath());
    1.90 -			CONMSG("  Interface: ServerGameDLL%03d\n", g_Metamod.GetGameDLLVersion());
    1.91 -
    1.92 -			int engine = g_Metamod.GetSourceEngineBuild();
    1.93 -			if (engine == SOURCE_ENGINE_ORIGINAL)
    1.94 -			{
    1.95 -				CONMSG("  Engine: Original (pre-Episode 1)\n");
    1.96 -			}
    1.97 -			else if (engine == SOURCE_ENGINE_EPISODEONE)
    1.98 -			{
    1.99 -				CONMSG("  Engine: Episode 1 (2004)\n");
   1.100 -			}
   1.101 -			else if (engine == SOURCE_ENGINE_ORANGEBOX)
   1.102 -			{
   1.103 -				CONMSG("  Engine: Episode 2 (Orange Box, 2007)\n");
   1.104 -			}
   1.105 -
   1.106 -			// Display user messages
   1.107 -			int messages = g_Metamod.GetUserMessageCount();
   1.108 -			if (messages != -1)
   1.109 -			{
   1.110 -				const char *msgname;
   1.111 -				int msgsize;
   1.112 -
   1.113 -				if (messages > 0)
   1.114 -				{
   1.115 -					CONMSG("  User Messages:  %-32.31s  %-5s  %-5s\n", "Name", "Index", "Size");
   1.116 -
   1.117 -					for (int i = 0; i < messages; i++)
   1.118 -					{
   1.119 -						msgname = g_Metamod.GetUserMessage(i, &msgsize);
   1.120 -
   1.121 -						CONMSG("                  %-32.31s  %-5d  %-5d\n", msgname, i, msgsize); 
   1.122 -					}
   1.123 -
   1.124 -					CONMSG("  %d user message%s in total\n", messages, (messages > 1) ? "s" : "");
   1.125 -				}
   1.126 -				else
   1.127 -				{
   1.128 -					CONMSG("  User Messages: None\n");
   1.129 -				}
   1.130 -			}
   1.131 -			else
   1.132 -			{
   1.133 -				CONMSG("  User Messages: Failed to get list of user messages\n");
   1.134 -			}
   1.135 -
   1.136 -			return true;
   1.137 -		}
   1.138 -		else if (strcmp(command, "refresh") == 0)
   1.139 -		{
   1.140 -			char full_path[255];
   1.141 -			g_Metamod.PathFormat(full_path,
   1.142 -				sizeof(full_path),
   1.143 -				"%s/%s",
   1.144 -				g_Metamod.GetBaseDir(), 
   1.145 -				g_Metamod.GetPluginsFile());
   1.146 -
   1.147 -			LoadPluginsFromFile(full_path);
   1.148 -
   1.149 -			return true;
   1.150 -		}
   1.151 -		else if (strcmp(command, "list") == 0)
   1.152 -		{
   1.153 -			CPluginManager::CPlugin *pl;
   1.154 -			ISmmPlugin *plapi;
   1.155 -			const char *plname;
   1.156 -			PluginIter i;
   1.157 -			char buffer[256];
   1.158 -			int len;
   1.159 -			int plnum = g_PluginMngr.GetPluginCount();
   1.160 -
   1.161 -			if (!plnum)
   1.162 -			{
   1.163 -				CONMSG("No plugins loaded.\n");
   1.164 -				return true;
   1.165 -			} else {
   1.166 -				CONMSG("Listing %d plugin%s:\n", plnum, (plnum > 1) ? "s" : "");
   1.167 -			}
   1.168 -
   1.169 -			for (i = g_PluginMngr._begin(); i != g_PluginMngr._end(); i++)
   1.170 -			{
   1.171 -				pl = (*i);
   1.172 -				if (!pl)
   1.173 -				{
   1.174 -					break;
   1.175 -				}
   1.176 -
   1.177 -				len = 0;
   1.178 -
   1.179 -				if (pl->m_Status != Pl_Running)
   1.180 -				{
   1.181 -					len += UTIL_Format(buffer, sizeof(buffer), "  [%02d] <%s>", pl->m_Id, g_PluginMngr.GetStatusText(pl));
   1.182 -				} else {
   1.183 -					len += UTIL_Format(buffer, sizeof(buffer), "  [%02d]", pl->m_Id);
   1.184 -				}
   1.185 -
   1.186 -				if ((plapi = pl->m_API))
   1.187 -				{
   1.188 -					plname = IS_STR_FILLED(plapi->GetName()) ? plapi->GetName() : pl->m_File.c_str();
   1.189 -					len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " %s", plname);
   1.190 -
   1.191 -					if (IS_STR_FILLED(plapi->GetVersion()))
   1.192 -					{
   1.193 -						len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", plapi->GetVersion());
   1.194 -					}
   1.195 -					if (IS_STR_FILLED(plapi->GetAuthor()))
   1.196 -					{
   1.197 -						UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", plapi->GetAuthor());
   1.198 -					}
   1.199 -				}
   1.200 -
   1.201 -				CONMSG("%s\n", buffer);
   1.202 -			}
   1.203 -
   1.204 -			return true;
   1.205 -		}
   1.206 -		else if (strcmp(command, "cmds") == 0)
   1.207 -		{
   1.208 -			if (args >= 2)
   1.209 -			{
   1.210 -				int id = atoi(info->GetArg(2));
   1.211 -				CPluginManager::CPlugin *pl = g_PluginMngr.FindById(id);
   1.212 -
   1.213 -				if (!pl)
   1.214 -				{
   1.215 -					CONMSG("Plugin %d not found.\n", id);
   1.216 -					return true;
   1.217 -				}
   1.218 -
   1.219 -				if (!pl->m_API)
   1.220 -				{
   1.221 -					CONMSG("Plugin %d is not loaded.\n", id);
   1.222 -				}
   1.223 -				else
   1.224 -				{
   1.225 -					CONMSG("Console commands for %s:\n", pl->m_API->GetName());
   1.226 -					List<ConCommandBase *>::iterator ci;
   1.227 -					size_t count = 0;
   1.228 -
   1.229 -					for (ci=pl->m_Cmds.begin(); ci!=pl->m_Cmds.end(); ci++)
   1.230 -					{
   1.231 -						count++;
   1.232 -						CONMSG(" [%5d] %-s\n", count, (*ci)->GetName());
   1.233 -					}
   1.234 -				}
   1.235 -			}
   1.236 -			else
   1.237 -			{
   1.238 -				CONMSG("Usage: meta cmds <id>\n");
   1.239 -			}
   1.240 -
   1.241 -			return true;
   1.242 -		}
   1.243 -		else if (strcmp(command, "cvars") == 0)
   1.244 -		{
   1.245 -			if (args >= 2)
   1.246 -			{
   1.247 -				int id = atoi(info->GetArg(2));
   1.248 -				CPluginManager::CPlugin *pl = g_PluginMngr.FindById(id);
   1.249 -
   1.250 -				if (!pl)
   1.251 -				{
   1.252 -					CONMSG("Plugin %d not found.\n", id);
   1.253 -					return true;
   1.254 -				}
   1.255 -
   1.256 -				if (!pl->m_API)
   1.257 -				{
   1.258 -					CONMSG("Plugin %d is not loaded.\n", id);
   1.259 -				}
   1.260 -				else
   1.261 -				{
   1.262 -					CONMSG("Registered cvars for %s:\n", pl->m_API->GetName());
   1.263 -					List<ConCommandBase *>::iterator ci;
   1.264 -					size_t count = 0;
   1.265 -
   1.266 -					for (ci=pl->m_Cvars.begin(); ci!=pl->m_Cvars.end(); ci++)
   1.267 -					{
   1.268 -						count++;
   1.269 -						CONMSG(" [%5d] %-s\n", count, (*ci)->GetName());
   1.270 -					}
   1.271 -				}
   1.272 -			}
   1.273 -			else
   1.274 -			{
   1.275 -				CONMSG("Usage: meta cvars <id>\n");
   1.276 -			}
   1.277 -
   1.278 -			return true;
   1.279 -		}
   1.280 -		else if (strcmp(command, "info") == 0)
   1.281 -		{
   1.282 -			if (args >= 2)
   1.283 -			{
   1.284 -				int id = atoi(info->GetArg(2));
   1.285 -				CPluginManager::CPlugin *pl = g_PluginMngr.FindById(id);
   1.286 -				if (!pl)
   1.287 -				{
   1.288 -					CONMSG("Plugin %d not found.\n", id);
   1.289 -					return true;
   1.290 -				}
   1.291 -
   1.292 -				if (!pl->m_API)
   1.293 -				{
   1.294 -					CONMSG("Plugin %d is not loaded.\n", id);
   1.295 -				}
   1.296 -				else
   1.297 -				{
   1.298 -					if (pl->m_Status == Pl_Paused)
   1.299 -					{
   1.300 -						CONMSG("Plugin %d is paused.\n", id);
   1.301 -					}
   1.302 -					else if (pl->m_Status == Pl_Running)
   1.303 -					{
   1.304 -						char run_msg[255];
   1.305 -						bool run = false;
   1.306 -						if (pl->m_API && pl->m_API->QueryRunning(run_msg, sizeof(run_msg)-1))
   1.307 -						{
   1.308 -							run = true;
   1.309 -						}
   1.310 -						if (run)
   1.311 -						{
   1.312 -							CONMSG("Plugin %d is running.\n", id);
   1.313 -						}
   1.314 -						else
   1.315 -						{
   1.316 -							CONMSG("Plugin %d is stopped: %s\n", id, run_msg);
   1.317 -						}
   1.318 -					}
   1.319 -					CONMSG("  Name: \"%s\" by %s\n", pl->m_API->GetName(), pl->m_API->GetAuthor());
   1.320 -					CONMSG("  Version: %s\n", pl->m_API->GetVersion());
   1.321 -					CONMSG("  Description: %s\n", pl->m_API->GetDescription());
   1.322 -					CONMSG("  License: %s\n", pl->m_API->GetLicense());
   1.323 -					CONMSG("  URL: %s\n", pl->m_API->GetURL());
   1.324 -					CONMSG("  Details: API %03d, Date: %s\n", pl->m_API->GetApiVersion(), pl->m_API->GetDate());
   1.325 -				}
   1.326 -				CONMSG("File: %s\n\n", pl->m_File.c_str());
   1.327 -
   1.328 -				return true;
   1.329 -			}
   1.330 -			else
   1.331 -			{
   1.332 -				CONMSG("Usage: meta info <id>\n");
   1.333 -
   1.334 -				return true;
   1.335 -			}
   1.336 -		}
   1.337 -		else if (strcmp(command, "pause") == 0)
   1.338 -		{
   1.339 -			if (args >= 2)
   1.340 -			{
   1.341 -				int id = atoi(info->GetArg(2));
   1.342 -
   1.343 -				char error[255];
   1.344 -
   1.345 -				if (!g_PluginMngr.Pause(id, error, sizeof(error)))
   1.346 -				{
   1.347 -					CONMSG("Pause failed: %s\n", error);
   1.348 -					return true;
   1.349 -				}
   1.350 -				
   1.351 -				CONMSG("Plugin %d has been paused.\n", id);
   1.352 -
   1.353 -				return true;
   1.354 -			}
   1.355 -			else
   1.356 -			{
   1.357 -				CONMSG("Usage: meta pause <id>\n");
   1.358 -
   1.359 -				return true;
   1.360 -			}
   1.361 -		}
   1.362 -		else if (strcmp(command, "unpause") == 0)
   1.363 -		{
   1.364 -			if (args >= 2)
   1.365 -			{
   1.366 -				int id = atoi(info->GetArg(2));
   1.367 -				char error[255];
   1.368 -
   1.369 -				if (!g_PluginMngr.Unpause(id, error, sizeof(error)))
   1.370 -				{
   1.371 -					CONMSG("Unpause failed: %s\n", error);
   1.372 -					return true;
   1.373 -				}
   1.374 -
   1.375 -				CONMSG("Plugin %d has been unpaused.\n", id);
   1.376 -
   1.377 -				return true;
   1.378 -			}
   1.379 -			else
   1.380 -			{
   1.381 -				CONMSG("Usage: meta unpause <id>\n");
   1.382 -
   1.383 -				return true;
   1.384 -			}
   1.385 -		}
   1.386 -		else if (strcmp(command, "load") == 0)
   1.387 -		{
   1.388 -			if (args >= 2)
   1.389 -			{
   1.390 -				const char *file = info->GetArg(2);
   1.391 -				char full_path[255];
   1.392 -
   1.393 -				const char *alias = g_PluginMngr.LookupAlias(file);
   1.394 -				if (alias)
   1.395 -				{
   1.396 -					file = alias;
   1.397 -				}
   1.398 -
   1.399 -				if (file[0] == '/' || strcmp(&(file[1]), ":\\") == 0)
   1.400 -				{
   1.401 -					g_Metamod.PathFormat(full_path, sizeof(full_path), "%s", file);
   1.402 -				}
   1.403 -				else
   1.404 -				{
   1.405 -					const char *ext = UTIL_GetExtension(file);
   1.406 -#if defined WIN32 || defined _WIN32
   1.407 -					ext = ext ? "" : ".dll";
   1.408 -#else
   1.409 -					ext = ext ? "" : "_i486.so";
   1.410 -#endif
   1.411 -					g_Metamod.PathFormat(full_path,
   1.412 -						sizeof(full_path),
   1.413 -						"%s/%s%s",
   1.414 -						g_Metamod.GetBaseDir(),
   1.415 -						file,
   1.416 -						ext);
   1.417 -				}
   1.418 -
   1.419 -				char error[255]={0};
   1.420 -				bool already;
   1.421 -				CPluginManager::CPlugin *pl;
   1.422 -
   1.423 -				PluginId id = g_PluginMngr.Load(full_path, Pl_Console, already, error, sizeof(error));
   1.424 -				pl = g_PluginMngr.FindById(id);
   1.425 -				if (!pl || id < Pl_MinId || (pl->m_Status < Pl_Paused))
   1.426 -				{
   1.427 -					CONMSG("Failed to load plugin %s (%s).\n", file, error);
   1.428 -					return true;
   1.429 -				}
   1.430 -
   1.431 -				if (!already)
   1.432 -				{
   1.433 -					CONMSG("Plugin \"%s\" loaded with id %d.\n", pl->m_API->GetName(), pl->m_Id);
   1.434 -				} else {
   1.435 -					CONMSG("Plugin \"%s\" is already loaded as %d.\n", pl->m_API->GetName(), pl->m_Id);
   1.436 -				}
   1.437 -				
   1.438 -				return true;
   1.439 -			}
   1.440 -			else
   1.441 -			{
   1.442 -				CONMSG("Usage: meta load <path>\n");
   1.443 -
   1.444 -				return true;
   1.445 -			}
   1.446 -		}
   1.447 -		else if ( (strcmp(command, "alias") == 0) ||
   1.448 -					(strcmp(command, "aliases") == 0) )
   1.449 -		{
   1.450 -			if (args >= 3)
   1.451 -			{
   1.452 -				const char *alias = info->GetArg(2);
   1.453 -				const char *value = info->GetArg(3);
   1.454 -
   1.455 -				g_PluginMngr.SetAlias(alias, value);
   1.456 -				if (value == NULL || value[0] == '\0')
   1.457 -				{
   1.458 -					CONMSG("Deleted alias: %s.\n", alias);
   1.459 -				} else {
   1.460 -					CONMSG("Set alias \"%s\" to: %s\n", alias, value);
   1.461 -				}
   1.462 -			}
   1.463 -			else if (args >= 2)
   1.464 -			{
   1.465 -				const char *alias = info->GetArg(2);
   1.466 -				const char *value = g_PluginMngr.LookupAlias(alias);
   1.467 -				if (value)
   1.468 -				{
   1.469 -					CONMSG("Alias \"%s\" is set to: %s\n", alias, value);
   1.470 -				} else {
   1.471 -					CONMSG("Alias \"%s\" was not found.\n", alias);
   1.472 -				}
   1.473 -			}
   1.474 -			else
   1.475 -			{
   1.476 -				List<CNameAlias *>::iterator iter, end;
   1.477 -				CNameAlias *p;
   1.478 -
   1.479 -				iter = g_PluginMngr._alias_begin();
   1.480 -				end = g_PluginMngr._alias_end();
   1.481 -				size_t total = 0;
   1.482 -				if (iter != end)
   1.483 -				{
   1.484 -					CONMSG("%-10.9s %s\n", "Alias", "File");
   1.485 -					CONMSG(" --- \n");
   1.486 -					for (; iter!=end; iter++)
   1.487 -					{
   1.488 -						p = (*iter);
   1.489 -						CONMSG("%-10.9s %s\n", p->alias.c_str(), p->value.c_str());
   1.490 -						total++;
   1.491 -					}
   1.492 -					CONMSG(" --- \n");
   1.493 -					CONMSG("%d aliases total.\n", total);
   1.494 -				}
   1.495 -				else
   1.496 -				{
   1.497 -					CONMSG("No aliases found.\n");
   1.498 -				}
   1.499 -			}
   1.500 -			return true;
   1.501 -		}
   1.502 -		else if (strcmp(command, "unload") == 0)
   1.503 -		{
   1.504 -			if (args >= 2)
   1.505 -			{
   1.506 -				const char *file = info->GetArg(2);
   1.507 -				int id = atoi(file);
   1.508 -				char error[255]={0};
   1.509 -
   1.510 -				if (id == 0 && isalpha(file[0]))
   1.511 -				{
   1.512 -					char full_path[255];
   1.513 -					const char *alias = g_PluginMngr.LookupAlias(file);
   1.514 -
   1.515 -					if (alias)
   1.516 -					{
   1.517 -						file = alias;
   1.518 -					}
   1.519 -
   1.520 -					/* first check if it's a known filename */
   1.521 -					if (file[0] == '/' || strcmp(&(file[1]), ":\\") == 0)
   1.522 -					{
   1.523 -						g_Metamod.PathFormat(full_path, sizeof(full_path), "%s", file);
   1.524 -					}
   1.525 -					else
   1.526 -					{
   1.527 -						const char *ext = UTIL_GetExtension(file);
   1.528 -#if defined WIN32 || defined _WIN32
   1.529 -						ext = ext ? "" : ".dll";
   1.530 -#else
   1.531 -						ext = ext ? "" : "_i486.so";
   1.532 -#endif
   1.533 -						g_Metamod.PathFormat(full_path,
   1.534 -							sizeof(full_path),
   1.535 -							"%s/%s%s",
   1.536 -							g_Metamod.GetBaseDir(),
   1.537 -							file,
   1.538 -							ext);
   1.539 -					}
   1.540 -
   1.541 -					List<CPluginManager::CPlugin *>::iterator iter, end;
   1.542 -					CPluginManager::CPlugin *pl;
   1.543 -					iter = g_PluginMngr._begin();
   1.544 -					end = g_PluginMngr._end();
   1.545 -					for (; iter!=end; iter++)
   1.546 -					{
   1.547 -						pl = (*iter);
   1.548 -						if (strcmp(pl->m_File.c_str(), full_path) == 0)
   1.549 -						{
   1.550 -							id = pl->m_Id;
   1.551 -							break;
   1.552 -						}
   1.553 -					}
   1.554 -					if (id == 0)
   1.555 -					{
   1.556 -						CONMSG("Plugin \"%s\" not found.\n", full_path);
   1.557 -						return true;
   1.558 -					}
   1.559 -				}
   1.560 -
   1.561 -				if (!g_PluginMngr.Unload(id, false, error, sizeof(error)))
   1.562 -				{
   1.563 -					CONMSG("Unload failed: %s\n", error);
   1.564 -					return true;
   1.565 -				}
   1.566 -
   1.567 -				CONMSG("Plugin %d unloaded.\n", id);
   1.568 -			}
   1.569 -			else
   1.570 -			{
   1.571 -				CONMSG("Usage: meta unload <id>\n");
   1.572 -			}
   1.573 -			return true;
   1.574 -		}
   1.575 -		else if (strcmp(command, "force_unload") == 0)
   1.576 -		{
   1.577 -			if (args >= 2)
   1.578 -			{
   1.579 -				int id = atoi(info->GetArg(2));
   1.580 -				char error[255]={0};
   1.581 -
   1.582 -				if (!g_PluginMngr.Unload(id, false, error, sizeof(error)))
   1.583 -				{
   1.584 -					CONMSG("Force unload failed: %s\n", error);
   1.585 -					return true;
   1.586 -				}
   1.587 -
   1.588 -				CONMSG("Plugin %d force unloaded.\n", id);
   1.589 -
   1.590 -				return true;
   1.591 -			}
   1.592 -			else
   1.593 -			{
   1.594 -				CONMSG("Usage: meta force_unload <id>\n");
   1.595 -
   1.596 -				return true;
   1.597 -			}
   1.598 -		}
   1.599 -		else if (strcmp(command, "clear") == 0)
   1.600 -		{
   1.601 -			if (!g_PluginMngr.UnloadAll())
   1.602 -			{
   1.603 -				CONMSG("One or more plugins resisted removal (cleaned anyway).\n");
   1.604 -				return true;
   1.605 -			} 
   1.606 -
   1.607 -			CONMSG("All plugins unloaded.\n");
   1.608 -
   1.609 -			return true;
   1.610 -		}
   1.611 -		else if (strcmp(command, "retry") == 0)
   1.612 -		{
   1.613 -			if (args >= 2)
   1.614 -			{
   1.615 -				int id = atoi(info->GetArg(2));
   1.616 -				char error[255];
   1.617 -
   1.618 -				if (!g_PluginMngr.Retry(id, error, sizeof(error)))
   1.619 -				{
   1.620 -					CONMSG("Error reloading plugin: %s\n", error);
   1.621 -					return true;
   1.622 -				}
   1.623 -
   1.624 -				CONMSG("Plugin %d successfully reloaded.\n", id);
   1.625 -
   1.626 -				return true;
   1.627 -			}
   1.628 -			else
   1.629 -			{
   1.630 -				CONMSG("Usage: meta retry <id>\n");
   1.631 -
   1.632 -				return true;
   1.633 -			}
   1.634 -		}
   1.635 -	}
   1.636 -
   1.637 -	CONMSG("Metamod:Source Menu\n");
   1.638 -	CONMSG("usage: meta <command> [arguments]\n");
   1.639 -	CONMSG("  alias        - List or set an alias\n");
   1.640 -	CONMSG("  clear        - Unload all plugins forcefully\n");
   1.641 -	CONMSG("  cmds         - Show plugin commands\n");
   1.642 -	CONMSG("  cvars        - Show plugin cvars\n");
   1.643 -	CONMSG("  credits      - About Metamod:Source\n");
   1.644 -	CONMSG("  force_unload - Forcefully unload a plugin\n");
   1.645 -	CONMSG("  game         - Information about GameDLL\n");
   1.646 -	CONMSG("  info         - Information about a plugin\n");
   1.647 -	CONMSG("  list         - List plugins\n");
   1.648 -	CONMSG("  load         - Load a plugin\n");
   1.649 -	CONMSG("  pause        - Pause a running plugin\n");
   1.650 -	CONMSG("  refresh      - Reparse plugins file\n");
   1.651 -	CONMSG("  retry        - Attempt to reload a plugin\n");
   1.652 -	CONMSG("  unload       - Unload a loaded plugin\n");
   1.653 -	CONMSG("  unpause      - Unpause a paused plugin\n");
   1.654 -	CONMSG("  version      - Version information\n");
   1.655 -
   1.656 -	return true;
   1.657 -}
   1.658 -
   1.659 -bool Command_ClientMeta(edict_t *client, IMetamodSourceCommandInfo *info)
   1.660 -{
   1.661 -	const char *cmd = info->GetArg(0);
   1.662 -
   1.663 -	if (strcmp(cmd, "meta") == 0)
   1.664 -	{
   1.665 -		unsigned int args = info->GetArgCount();
   1.666 -		if (args == 1)
   1.667 -		{
   1.668 -			const char *subcmd = info->GetArg(1);
   1.669 -
   1.670 -			if (strcmp(subcmd, "credits") == 0)
   1.671 -			{
   1.672 -				CLIENT_CONMSG(client, "Metamod:Source was developed by:\n");
   1.673 -				CLIENT_CONMSG(client, "  SourceHook: Pavol \"PM OnoTo\" Marko\n");
   1.674 -				CLIENT_CONMSG(client, "  GameDLL/Plugins: David \"BAILOPAN\" Anderson\n");
   1.675 -				CLIENT_CONMSG(client, "  GameDLL: Scott \"Damaged Soul\" Ehlert\n");
   1.676 -				CLIENT_CONMSG(client, "For more information, see the official website\n");
   1.677 -				CLIENT_CONMSG(client, "http://www.sourcemm.net/\n");
   1.678 -
   1.679 -				return true;
   1.680 -			}
   1.681 -			else if(strcmp(subcmd, "version") == 0)
   1.682 -			{
   1.683 -				CLIENT_CONMSG(client, "Metamod:Source version %s\n", SOURCEMM_VERSION);
   1.684 -				CLIENT_CONMSG(client, "Compiled on: %s\n", SOURCEMM_DATE);
   1.685 -				CLIENT_CONMSG(client, "Plugin interface version: %d:%d\n", METAMOD_PLAPI_VERSION, PLAPI_MIN_VERSION);
   1.686 -				CLIENT_CONMSG(client, "SourceHook version: %d:%d\n", g_SHPtr->GetIfaceVersion(), g_SHPtr->GetImplVersion());
   1.687 -				CLIENT_CONMSG(client, "http://www.sourcemm.net/\n");
   1.688 -
   1.689 -				return true;
   1.690 -			}
   1.691 -			else if(strcmp(subcmd, "list") == 0)
   1.692 -			{
   1.693 -				CPluginManager::CPlugin *pl;
   1.694 -				ISmmPlugin *plapi;
   1.695 -				const char *plname;
   1.696 -				PluginIter i;
   1.697 -				char buffer[256];
   1.698 -				int len = 0;
   1.699 -				int plnum = 0;
   1.700 -
   1.701 -				for (i = g_PluginMngr._begin(); i != g_PluginMngr._end(); i++, len=0)
   1.702 -				{
   1.703 -					pl = (*i);
   1.704 -					if (pl && pl->m_Status == Pl_Running)
   1.705 -					{
   1.706 -						plapi = pl->m_API;
   1.707 -						if (!plapi || !plapi->QueryRunning(NULL, 0))
   1.708 -						{
   1.709 -							continue;
   1.710 -						}
   1.711 -						plnum++;
   1.712 -
   1.713 -						len += UTIL_Format(buffer, sizeof(buffer), "  [%02d]", plnum);
   1.714 -
   1.715 -						plname = IS_STR_FILLED(plapi->GetName()) ? plapi->GetName() : pl->m_File.c_str();
   1.716 -						len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " %s", plname);
   1.717 -
   1.718 -						if (IS_STR_FILLED(plapi->GetVersion()))
   1.719 -						{
   1.720 -							len += UTIL_Format(&buffer[len], sizeof(buffer)-len, " (%s)", plapi->GetVersion());
   1.721 -						}
   1.722 -						if (IS_STR_FILLED(plapi->GetAuthor()))
   1.723 -						{
   1.724 -							UTIL_Format(&buffer[len], sizeof(buffer)-len, " by %s", plapi->GetAuthor());
   1.725 -						}
   1.726 -
   1.727 -						CLIENT_CONMSG(client, "%s\n", buffer);
   1.728 -					}
   1.729 -				}
   1.730 -
   1.731 -				if (!plnum)
   1.732 -				{
   1.733 -					CLIENT_CONMSG(client, "No active plugins loaded.\n");
   1.734 -				}
   1.735 -
   1.736 -				return true;
   1.737 -			}
   1.738 -		}
   1.739 -
   1.740 -		CLIENT_CONMSG(client, "Metamod:Source Menu\n");
   1.741 -		CLIENT_CONMSG(client, "usage: meta <command>\n");
   1.742 -		CLIENT_CONMSG(client, "  credits - About Metamod:Source\n");
   1.743 -		CLIENT_CONMSG(client, "  list    - List plugins\n");
   1.744 -		CLIENT_CONMSG(client, "  version - Version information\n");
   1.745 -
   1.746 -		return true;
   1.747 -	}
   1.748 -
   1.749 -	return false;
   1.750 -}