24.12.2014, 17:22
Quote:
Here is an example source code I've just made. It gives the same error:
Код:
#include ".\SDK\plugin.h" #include ".\sampgdk\sampgdk.h" // extern void * pAMXFunctions; // typedef void (*logprintf_t)(char* format, ...); logprintf_t logprintf; cell AMX_NATIVE_CALL test(AMX * amx, cell * params){ char test[] = "test message"; SendClientMessage(params[1], 0xFFFFFFFF, test); return 0; } AMX_NATIVE_INFO PluginNatives[] = { {"test", test}, {0, 0} }; PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports(){ return sampgdk::Supports() | SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES | SUPPORTS_PROCESS_TICK; } PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData){ pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS]; logprintf = (logprintf_t)ppData[PLUGIN_DATA_LOGPRINTF]; return sampgdk::Load(ppData); } PLUGIN_EXPORT void PLUGIN_CALL Unload(){ sampgdk::Unload(); } PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx){ return amx_Register(amx, PluginNatives, -1); } PLUGIN_EXPORT int PLUGIN_CALL AmxUnload(AMX *amx){ return AMX_ERR_NONE; } PLUGIN_EXPORT void PLUGIN_CALL ProcessTick(){ sampgdk::ProcessTick(); } Using project settings: SAMPGDK_AMALGAMATION is globally defined .def file is defined additional include directories defined |
pawn Код:
#include <SDK/plugincommon.h>
#include <SDK/amx/amx.h>
#include <sampgdk/sampgdk.h>
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) {
return sampgdk::Load(ppData);
}
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() {
sampgdk::logprintf(" Hello there!");
return sampgdk::Supports() | SUPPORTS_PROCESS_TICK;
}
PLUGIN_EXPORT void PLUGIN_CALL Unload() {
sampgdk::Unload();
}
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() {
sampgdk::ProcessTick();
}
PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeInit() {
SendRconCommand("echo initialized.");
}
(On def file, add OnGameModeInit, and remove AmxLoad & AmxUnload)
This is just a test.