diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index d254df6d..3846a851 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -546,6 +546,23 @@ AMX* get_amxscript(int id, void** code, const char** filename) return 0; } +const char* GetFileName(AMX *amx) +{ + const char *filename = ""; + CPluginMngr::CPlugin *pl = g_plugins.findPluginFast(amx); + + if (pl) + { + filename = pl->getName(); + } else { + CList::iterator a = g_loadedscripts.find(amx); + if (a) + filename = (*a).getName(); + } + + return filename; +} + const char* get_amxscriptname(AMX* amx) { CList::iterator a = g_loadedscripts.find(amx); diff --git a/amxmodx/modules.h b/amxmodx/modules.h index 4c4493ce..05895548 100755 --- a/amxmodx/modules.h +++ b/amxmodx/modules.h @@ -75,5 +75,6 @@ int CheckModules(AMX *amx, char error[128]); const char *StrCaseStr(const char *as, const char *bs); void DisableDebugHandler(AMX *amx); void EnableDebugHandler(AMX *amx); +const char* GetFileName(AMX *amx); #endif // __MODULES_H__