diff --git a/amxmodx/amx.cpp b/amxmodx/amx.cpp index 6004a2af..56e56fa9 100755 --- a/amxmodx/amx.cpp +++ b/amxmodx/amx.cpp @@ -428,6 +428,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params) AMX_HEADER *hdr; AMX_FUNCSTUB *func; AMX_NATIVE f; + int i =0; assert(amx!=NULL); hdr=(AMX_HEADER *)amx->base; @@ -437,6 +438,7 @@ int AMXAPI amx_Callback(AMX *amx, cell index, cell *result, cell *params) assert(index>=0 && index<(cell)NUMENTRIES(hdr,natives,libraries)); func=GETENTRY(hdr,natives,index); f=(AMX_NATIVE)func->address; + amx->userdata[2] = (char *)GETENTRYNAME(hdr, func); assert(f!=NULL); /* now that we have found the function, patch the program so that any @@ -606,6 +608,7 @@ static int amx_BrowseRelocate(AMX *amx) } else { amx->userdata[0] = 0; amx->userdata[1] = 0; + amx->userdata[2] = 0; } #if defined __GNUC__ || defined ASM32 || defined JIT && !defined __64BIT__ diff --git a/amxmodx/modules.cpp b/amxmodx/modules.cpp index 28f457b9..04f8ffa4 100755 --- a/amxmodx/modules.cpp +++ b/amxmodx/modules.cpp @@ -1166,6 +1166,8 @@ void GenericError(AMX *amx, int err, int line, char buf[], const char *file) { sprintf(buf, "Run time error %d on line %d (%s \"%s\").", err, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName())); } else { + if (err == AMX_ERR_NATIVE && amx->userdata[2]) + geterr = (char *)(amx->userdata[2]); sprintf(buf, "Run time error %d (%s) on line %d (%s \"%s\").", err, geterr, line, (file?"file":"plugin"), (file?file:g_plugins.findPluginFast(amx)->getName())); } }