I tried to change srvcmd.cpp in amxmodx but server hangs.
What wrong in this code?
PHP Code:
else if (!strcmp(cmd, "unload_module") && CMD_ARGC() > 2)
{
const char *szModuleFilename;
char *szModule = new char[256];
strcpy(szModule, CMD_ARGV(2));
strcat(szModule, "_amxx.dll");
CList<CModule, const char *>::iterator a = g_modules.begin();
bool bFoundModule = false;
// Search module with given name
while (a)
{
szModuleFilename = (*a).getFilename();
for ( int i = strlen(szModuleFilename)-1; i >= 0; i-- )
{
if ( szModuleFilename[i] == '\\' )
{
if ( !strcmp(szModule, &szModuleFilename[i+1]) )
{
bFoundModule = true;
break;
}
}
}
++a;
}
if ( bFoundModule )
{
print_srvconsole("Tried to unload \"%s\"\n", szModule);
// server hangs in this place:
(*a).CallPluginsUnloading();
(*a).CallPluginsUnloaded();
(*a).detachModule();
a.remove();
/*
List<Library *>::iterator iter;
iter = g_libraries.begin();
while (iter != g_libraries.end())
{
//(*iter)
}
*/
//print_srvconsole("Unloaded module \"%s\"\n", szModule);
}
else
{
print_srvconsole("Module \"%s\" not found\n", szModule);
}
}