1.1 --- a/sourcemm/concommands.cpp Sat Apr 16 23:35:37 2005 +0000
1.2 +++ b/sourcemm/concommands.cpp Sun Apr 17 03:37:50 2005 +0000
1.3 @@ -44,14 +44,14 @@
1.4 Msg(" GameDLL/Plugins: David \"BAILOPAN\" Anderson\n");
1.5 Msg(" GameDLL: Scott \"Damaged Soul\" Ehlert\n");
1.6 Msg("For more information, see the official website\n");
1.7 - Msg("http://www.sourcemm.net/\n");
1.8 + Msg("http://www.sourcemm.net/\n\n");
1.9
1.10 return;
1.11 } else if (strcmp(command, "version") == 0) {
1.12 Msg("Metamod:Source version %s\n", SOURCEMM_VERSION);
1.13 Msg("Compiled on: %s\n", SOURCEMM_DATE);
1.14 Msg("Plugin interface version: %d/%d\n", PLAPI_VERSION, PLAPI_MIN_VERSION);
1.15 - Msg("http://www.sourcemm.net/\n");
1.16 + Msg("http://www.sourcemm.net/\n\n");
1.17
1.18 return;
1.19 } else if (strcmp(command, "game") == 0) {
1.20 @@ -74,6 +74,9 @@
1.21 SourceMM::CPluginManager::CPlugin *pl;
1.22 PluginIter i;
1.23 const char *status="";
1.24 + const char *version=NULL;
1.25 + const char *name=NULL;
1.26 + const char *author=NULL;
1.27
1.28 Msg("-Id- %-16.15s %-8.7s %-12.11s %-8.7s\n", "Name", "Version", "Author", "Status");
1.29 for (i=g_PluginMngr._begin(); i!=g_PluginMngr._end(); i++)
1.30 @@ -93,9 +96,31 @@
1.31 } else if (pl->m_Status == Pl_NotFound) {
1.32 status = "NOFILE";
1.33 }
1.34 - Msg("[%02d] %-16.15s %-8.7s %-12.11s %-8.7s\n", pl->m_Id, pl->m_API->GetName(), pl->m_API->GetVersion(), pl->m_API->GetAuthor(), status);
1.35 +
1.36 + if (pl->m_API)
1.37 + {
1.38 + version = pl->m_API->GetVersion();
1.39 + author = pl->m_API->GetAuthor();
1.40 + name = pl->m_API->GetName();
1.41 + } else {
1.42 + version = "-";
1.43 + author = "-";
1.44 + name = "-";
1.45 + }
1.46 +
1.47 + if (!version)
1.48 + version = "-";
1.49 + if (!author)
1.50 + author = "-";
1.51 + if (!name)
1.52 + name = pl->m_File.c_str();
1.53 +
1.54 +
1.55 + Msg("[%02d] %-16.15s %-8.7s %-12.11s %-8.7s\n", pl->m_Id, name, version, author, status);
1.56 }
1.57
1.58 + Msg("\n");
1.59 +
1.60 return;
1.61 } else if (strcmp(command, "info") == 0) {
1.62 if (args >= 3)
1.63 @@ -125,7 +150,7 @@
1.64 Msg("URL: %s\n", pl->m_API->GetURL());
1.65 Msg("Details: API %03d, Date: %s\n", pl->m_API->GetApiVersion(), pl->m_API->GetDate());
1.66 }
1.67 - Msg("File: %s\n", pl->m_File.c_str());
1.68 + Msg("File: %s\n\n", pl->m_File.c_str());
1.69
1.70 return;
1.71 } else {
1.72 @@ -137,28 +162,16 @@
1.73 if (args >= 3)
1.74 {
1.75 int id = atoi(e->Cmd_Argv(2));
1.76 - SourceMM::CPluginManager::CPlugin *pl = g_PluginMngr.FindById(id);
1.77 - if (!pl)
1.78 +
1.79 + char error[255];
1.80 +
1.81 + if (!g_PluginMngr.Pause(id, error, sizeof(error)-1))
1.82 {
1.83 - Msg("Plugin %d not found.\n", id);
1.84 + Msg("Pause failed: %s\n", error);
1.85 return;
1.86 }
1.87
1.88 - if (pl->m_Status != Pl_Running)
1.89 - {
1.90 - Msg("Plugin %d is not pausable.\n", pl->m_Id);
1.91 - return;
1.92 - }
1.93 -
1.94 - char error[255]={0};
1.95 - if (!pl->m_API->Pause(error, sizeof(error)-1))
1.96 - {
1.97 - Msg("Plugin %d refused pause: %s\n", pl->m_Id, error);
1.98 - return;
1.99 - }
1.100 -
1.101 - g_SourceHook.PausePlugin(pl->m_Id);
1.102 - Msg("\"%s\" has been paused.\n", pl->m_API->GetName());
1.103 + Msg("Plugin %d has been paused.\n", id);
1.104
1.105 return;
1.106 } else {
1.107 @@ -170,28 +183,15 @@
1.108 if (args >= 3)
1.109 {
1.110 int id = atoi(e->Cmd_Argv(2));
1.111 - SourceMM::CPluginManager::CPlugin *pl = g_PluginMngr.FindById(id);
1.112 - if (!pl)
1.113 + char error[255];
1.114 +
1.115 + if (!g_PluginMngr.Unpause(id, error, sizeof(error)-1))
1.116 {
1.117 - Msg("Plugin %d not found.\n", id);
1.118 - return;
1.119 - }
1.120 -
1.121 - if (pl->m_Status != Pl_Paused)
1.122 - {
1.123 - Msg("Plugin %d is not unpausable.\n", pl->m_Id);
1.124 + Msg("Unpause failed: %s\n", error);
1.125 return;
1.126 }
1.127
1.128 - char error[255]={0};
1.129 - if (!pl->m_API->Pause(error, sizeof(error)-1))
1.130 - {
1.131 - Msg("Plugin %d refused unpause: %s\n", pl->m_Id, error);
1.132 - return;
1.133 - }
1.134 -
1.135 - g_SourceHook.UnpausePlugin(pl->m_Id);
1.136 - Msg("\"%s\" has been unpaused.\n", pl->m_API->GetName());
1.137 + Msg("Plugin %d has been unpaused.\n", id);
1.138
1.139 return;
1.140 } else {
1.141 @@ -211,10 +211,10 @@
1.142 } else {
1.143 const char *ext = UTIL_GetExtension(file);
1.144 #if defined WIN32 || defined _WIN32
1.145 - ext ? "" : ".dll";
1.146 + ext = ext ? "" : ".dll";
1.147 snprintf(full_path, sizeof(full_path)-1, "%s\\%s%s", g_ModPath.c_str(), file, ext);
1.148 #else
1.149 - ext ? "" : "_i486.so";
1.150 + ext = ext ? "" : "_i486.so";
1.151 snprintf(full_path, sizeof(full_path)-1, "%s/%s%s", g_ModPath.c_str(), file, ext);
1.152 #endif
1.153 }
1.154 @@ -299,15 +299,17 @@
1.155
1.156 Msg("Metamod:Source Menu\n");
1.157 Msg("usage: meta <command> [arguments]\n");
1.158 - Msg(" clear - Unload all plugins forcefully\n");
1.159 - Msg(" credits - About Metamod:Source\n");
1.160 - Msg(" game - Information about GameDLL\n");
1.161 - Msg(" info - Information about a plugin\n");
1.162 - Msg(" list - List plugins\n");
1.163 - Msg(" load - Load a plugin\n");
1.164 - Msg(" pause - Pause a running plugin\n");
1.165 - Msg(" refresh - Reparse plugins file\n");
1.166 - Msg(" unload - Unload a loaded plugin\n");
1.167 - Msg(" unpause - Unpause a paused plugin\n");
1.168 - Msg(" version - Version information\n");
1.169 + Msg(" clear - Unload all plugins forcefully\n");
1.170 + Msg(" credits - About Metamod:Source\n");
1.171 + Msg(" force_unload - Forcefully unload a plugin\n");
1.172 + Msg(" game - Information about GameDLL\n");
1.173 + Msg(" info - Information about a plugin\n");
1.174 + Msg(" list - List plugins\n");
1.175 + Msg(" load - Load a plugin\n");
1.176 + Msg(" pause - Pause a running plugin\n");
1.177 + Msg(" refresh - Reparse plugins file\n");
1.178 + Msg(" unload - Unload a loaded plugin\n");
1.179 + Msg(" unpause - Unpause a paused plugin\n");
1.180 + Msg(" version - Version information\n");
1.181 + Msg("\n");
1.182 }