diff --git a/amxmodx/amxmodx.cpp b/amxmodx/amxmodx.cpp index 7e556844..5054dd0d 100755 --- a/amxmodx/amxmodx.cpp +++ b/amxmodx/amxmodx.cpp @@ -3777,7 +3777,9 @@ static cell AMX_NATIVE_CALL CreateMultiForward(AMX *amx, cell *params) cell ps[FORWARD_MAX_PARAMS]; cell count = params[0] / sizeof(cell); for (cell i=3; i<=count; i++) + { ps[i-3] = *get_amxaddr(amx, params[i]); + } return registerForwardC(funcname, static_cast(params[2]), ps, count-2); } @@ -3785,13 +3787,24 @@ static cell AMX_NATIVE_CALL CreateMultiForward(AMX *amx, cell *params) static cell AMX_NATIVE_CALL CreateOneForward(AMX *amx, cell *params) { CPluginMngr::CPlugin *p = g_plugins.findPlugin(params[1]); + + if (!p) + { + LogError(amx, AMX_ERR_NATIVE, "Invalid plugin id: %d", params[1]); + return -1; + } else if (!p->isExecutable(0)) { + return -1; + } + int len; char *funcname = get_amxstring(amx, params[2], 0, len); cell ps[FORWARD_MAX_PARAMS]; cell count = params[0] / sizeof(cell); for (cell i=3; i<=count; i++) + { ps[i-3] = *get_amxaddr(amx, params[i]); + } return registerSPForwardByNameC(p->getAMX(), funcname, ps, count-2); } diff --git a/plugins/include/amxmodx.inc b/plugins/include/amxmodx.inc index 7b1a0072..3e16c367 100755 --- a/plugins/include/amxmodx.inc +++ b/plugins/include/amxmodx.inc @@ -1004,10 +1004,10 @@ native set_addr_val(addr, val); native CreateMultiForward(const name[], stop_type, ...); /** - * creates a forward for one plugin. - * results will be > 0 for success - * id can be returned from find_plugin_byfile or - * anything get_plugin is compatible with. + * Creates a forward for one plugin. + * Results will be > 0 for success. + * id should be an id such as returned by find_plugin_byfile. + * Unlike get_plugin(), negative numbers will not work. */ native CreateOneForward(plugin_id, const name[], ...);