#include <sampgdk/sampgdk.h>
PLUGIN_EXPORT bool PLUGIN_CALL Load(void **ppData) { return sampgdk::Load(ppData); }
PLUGIN_EXPORT unsigned int PLUGIN_CALL Supports() { return sampgdk::Supports() | SUPPORTS_PROCESS_TICK; }
PLUGIN_EXPORT void PLUGIN_CALL Unload() { sampgdk::Unload(); }
PLUGIN_EXPORT void PLUGIN_CALL ProcessTick() { sampgdk::ProcessTick();
[14:24:56] [debug] Run time error 20: "Invalid index parameter (bad entry point)"
|
Define SAMPGDK_AMALGAMATION globally, not just for one file (in compiler options / project properties). Or you can define it in sampgdk.c but I wouldn't recommend doing this as you'd have to edit the file with each sampgdk update.
|
. Neither helps defining this inside the samgdk.h
#define SAMPGDK_AMALGAMATION
|
This is the preprocessor definitions of my plugin, SAMPHP.
https://imgur.com/swry8UU Remove the Код:
#define SAMPGDK_AMALGAMATION Clean up the project, and build it. |
#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();
}
|
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 |
#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.");
}
#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.");
return true;
}
EXPORTS
Supports
Load
Unload
OnGameModeInit
ProcessTick
[03:14:36] [sampgdk:warning] Index mismatch for OnIncomingConnection (-10005 != -10007) [03:14:36] [join] BoPoH has joined the server (0:127.0.0.1) [03:14:36] [sampgdk:warning] Index mismatch for OnPlayerConnect (-10012 != -10014) [03:14:36] [sampgdk:warning] Index mismatch for OnPlayerRequestClass (-10029 != -10032) [03:14:37] [sampgdk:warning] Index mismatch for OnPlayerRequestSpawn (-10030 != -10033) [03:14:37] [sampgdk:warning] Index mismatch for OnPlayerStateChange (-10034 != -10037) [03:14:37] [sampgdk:warning] Index mismatch for OnPlayerSpawn (-10033 != -10036) [03:14:37] [sampgdk:warning] Index mismatch for OnPlayerStateChange (-10034 != -10037) [03:14:37] [sampgdk:warning] Index mismatch for OnPlayerUpdate (-10039 != -10042) [03:14:38] [sampgdk:warning] Index mismatch for OnPlayerUpdate (-10039 != -10042) [03:14:38] [sampgdk:warning] Index mismatch for OnPlayerUpdate (-10039 != -10042)
[00:32:06] [debug] Server crashed due to an unknown error [00:32:06] [debug] Native backtrace: [00:32:06] [debug] #0 0fa72f5a in amx_Register () from plugins\helloworld.DLL [00:32:06] [debug] #1 0fa737e3 in AmxLoad () from plugins\helloworld.DLL [00:32:06] [debug] #2 00469a75 in ?? () from samp-server.exe [00:32:06] [debug] #3 65646f6d in ?? () from samp-server.exe [00:32:06] [debug] #4 61622f73 in ?? () from samp-server.exe [00:32:06] [debug] #5 612e6573 in ?? () from samp-server.exe
pAMXFunctions = ppData[PLUGIN_DATA_AMX_EXPORTS];