1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-12-01 13:24:25 +01:00

Added retry console command

--HG--
extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/trunk%4014
This commit is contained in:
David Anderson 2005-04-17 04:21:02 +00:00
parent e2100056f4
commit 6df8efff3a

View File

@ -227,7 +227,7 @@ CON_COMMAND(meta, "Metamod:Source Menu")
pl = g_PluginMngr.FindById(id);
if (!pl || id < Pl_MinId || (pl->m_Status < Pl_Paused))
{
Msg("Failed to load plugin %s. %s\n", file, error);
Msg("Failed to load plugin %s (%s).\n", file, error);
return;
}
@ -294,6 +294,45 @@ CON_COMMAND(meta, "Metamod:Source Menu")
Msg("All plugins unloaded.\n");
return;
} else if (strcmp(command, "retry") == 0) {
if (args >= 3)
{
int id = atoi(e->Cmd_Argv(2));
SourceMM::CPluginManager::CPlugin *pl;
pl = g_PluginMngr.FindById(id);
if (!pl)
{
Msg("Plugin %d not found.\n", id);
return;
}
if (pl->m_Status >= Pl_Paused)
{
Msg("Plugin %d is already loaded.\n");
return;
}
PluginId plid;
char error[255];
bool already;
plid = g_PluginMngr.Load(pl->m_File.c_str(), Pl_Console, already, error, sizeof(error)-1);
if (plid < Pl_MinId)
{
Msg("Failed to reload plugin %d: (%s).\n", id, error);
return;
}
Msg("Plugin %d successfully reloaded as plugin %d.\n", id, plid);
return;
} else {
Msg("Usage: meta force_unload <id>\n");
return;
}
}
}
@ -308,6 +347,7 @@ CON_COMMAND(meta, "Metamod:Source Menu")
Msg(" load - Load a plugin\n");
Msg(" pause - Pause a running plugin\n");
Msg(" refresh - Reparse plugins file\n");
Msg(" retry - Attempt to reload a plugin\n");
Msg(" unload - Unload a loaded plugin\n");
Msg(" unpause - Unpause a paused plugin\n");
Msg(" version - Version information\n");