Code:
C_DLLEXPORT int
GetEntityAPI2 (DLL_FUNCTIONS * pFunctionTable, int *interfaceVersion)
{
gFunctionTable.pfnGameInit = GameDLLInit;
gFunctionTable.pfnSpawn = Spawn;
gFunctionTable.pfnClientConnect = ClientConnect;
gFunctionTable.pfnClientDisconnect = ClientDisconnect;
gFunctionTable.pfnClientPutInServer = ClientPutInServer;
gFunctionTable.pfnClientCommand = ClientCommand;
gFunctionTable.pfnStartFrame = StartFrame;
memcpy (pFunctionTable, &gFunctionTable, sizeof (DLL_FUNCTIONS));
return (TRUE);
}
C_DLLEXPORT int
GetEntityAPI2_Post (DLL_FUNCTIONS * pFunctionTable, int *interfaceVersion)
{
gFunctionTable.pfnGameInit = GameDLLInit;
gFunctionTable.pfnSpawn = Spawn_Post;
gFunctionTable.pfnClientConnect = ClientConnect;
gFunctionTable.pfnClientDisconnect = ClientDisconnect;
gFunctionTable.pfnClientPutInServer = ClientPutInServer;
gFunctionTable.pfnClientCommand = ClientCommand;
gFunctionTable.pfnStartFrame = StartFrame;
memcpy (pFunctionTable, &gFunctionTable, sizeof (DLL_FUNCTIONS));
return (TRUE);
}
...looks like you don't know what these two functions mean.
The hooks in GetEntityAPI2 are called *BEFORE* the real gamedll funcs get called, and those in GetEntityAPI2_Post are called *AFTER* the real gamedll funcs get called. So in this way all of YOUR functions in the plugin are called _twice_ when one of the gamedll funcs gets called by engine.
So the GetEntityAPI2_Post should be only like this:
Code:
C_DLLEXPORT int
GetEntityAPI2_Post (DLL_FUNCTIONS * pFunctionTable, int *interfaceVersion)
{
gFunctionTable_post.pfnSpawn = Spawn_Post; // need to declare another gFunctionTable_post in the top of the dll.cpp file
memcpy (pFunctionTable, &gFunctionTable, sizeof (DLL_FUNCTIONS));
return (TRUE);
}