08.10.2014, 19:06
Quote:
I personally use sampGDK and it works correctly with this syntax :
pawn Code:
|

(Reference to unresolved external symbol)
My Code:
Code:
#include "sampgdk/a_players.h" #include "sampgdk/a_samp.h" #include "sampgdk/core.h" #include "sampgdk/sdk.h" #include "Invoke.h" #include <string> #include <vector> #include <cstdlib> #include <ctime> using sampgdk::logprintf; typedef void(*logprintf_t)(char* format, ...); extern void *pAMXFunctions; using namespace std; #define AMX_DECLARE_NATIVE(native) \ cell AMX_NATIVE_CALL native(AMX* amx, cell* params) PLUGIN_EXPORT bool PLUGIN_CALL OnGameModeInit() { return true; } ///////////////////////////////////// AMX_DECLARE_NATIVE(CheckUser) { if (!IsPlayerConnected(params[1])) return printf("The user %d isn't connected !", params[1]), 1; char name[25]; GetPlayerName(params[1], name, 25); printf("This was printed from the Test plugin! Yay %s!", name); return 1; } ///////////////////////////////////// PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return SUPPORTS_VERSION | SUPPORTS_AMX_NATIVES; } PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { g_Invoke = new Invoke; pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS]; printf(" * plugin was loaded."); return true; } PLUGIN_EXPORT void PLUGIN_CALL Unload() { printf(" * plugin was unloaded."); } AMX_NATIVE_INFO PluginNatives[] = { { "CheckUser", CheckUser }, { 0, 0 } }; PLUGIN_EXPORT int PLUGIN_CALL AmxLoad(AMX *amx) { g_Invoke->amx_list.push_back(amx); return amx_Register(amx, PluginNatives, -1); } PLUGIN_EXPORT int PLUGIN_CALL AmxUnload(AMX *amx) { for (list<AMX *>::iterator i = g_Invoke->amx_list.begin(); i != g_Invoke->amx_list.end(); ++i) { if (*i == amx) { g_Invoke->amx_list.erase(i); break; } } return AMX_ERR_NONE; }