15.06.2012, 08:41
What the hell... I'm just trying to use invoke and here is my results . Please, help someone.
Code:
#include "SDK\amx\amx.h" #include "SDK\plugincommon.h" #include "Invoke.h" typedef void (*logprintf_t)(char* format, ...); logprintf_t logprintf; extern void *pAMXFunctions; cell AMX_NATIVE_CALL HelloWorld(AMX* amx, cell* params) { logprintf("This was printed from the Test plugin! Yay!"); return 1; } PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES; } PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { invoke = new Invoke; pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS]; logprintf = (logprintf_t) ppData[PLUGIN_DATA_LOGPRINTF]; logprintf(" * Test plugin was loaded."); return true; } PLUGIN_EXPORT void PLUGIN_CALL Unload() { logprintf(" * Test plugin was unloaded."); } AMX_NATIVE_INFO PluginNatives[] = { {"HelloWorld", HelloWorld}, {0, 0} }; PLUGIN_EXPORT int PLUGIN_CALL AmxLoad( AMX *amx ) { invoke->amx_list.push_back(amx); return amx_Register(amx, PluginNatives, -1); } PLUGIN_EXPORT int PLUGIN_CALL AmxUnload( AMX *amx ) { for (std::list<AMX *>::iterator i = invoke->amx_list.begin(); i != invoke->amx_list.end(); ++i) { if (* i == amx) { invoke->amx_list.erase(i); break; } } return AMX_ERR_NONE; }