is_module_loaded and is_plugin_loaded now return id on success, -1 on failure

This commit is contained in:
Pavol Marko 2004-02-27 11:01:14 +00:00
parent 0db4648788
commit cef68cf821

View File

@ -2066,12 +2066,14 @@ static cell AMX_NATIVE_CALL is_module_loaded(AMX *amx, cell *params)
// param1: name // param1: name
int len; int len;
char *name = get_amxstring(amx, params[1], 0, len); char *name = get_amxstring(amx, params[1], 0, len);
int id = 0;
for (CList<CModule>::iterator iter = g_modules.begin(); iter; ++iter) for (CList<CModule>::iterator iter = g_modules.begin(); iter; ++iter)
{ {
if (stricmp((*iter).getName(), name) == 0) if (stricmp((*iter).getName(), name) == 0)
return 1; return id;
++id;
} }
return 0; return -1;
} }
// native is_plugin_loaded(const name[]); // native is_plugin_loaded(const name[]);
@ -2080,12 +2082,14 @@ static cell AMX_NATIVE_CALL is_plugin_loaded(AMX *amx, cell *params)
// param1: name // param1: name
int len; int len;
char *name = get_amxstring(amx, params[1], 0, len); char *name = get_amxstring(amx, params[1], 0, len);
int id = 0;
for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter) for (CPluginMngr::iterator iter = g_plugins.begin(); iter; ++iter)
{ {
if (stricmp((*iter).getName(), name) == 0) if (stricmp((*iter).getName(), name) == 0)
return 1; return id;
++id;
} }
return 0; return -1;
} }
// native get_modulesnum(); // native get_modulesnum();
static cell AMX_NATIVE_CALL get_modulesnum(AMX *amx, cell *params) static cell AMX_NATIVE_CALL get_modulesnum(AMX *amx, cell *params)