2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-01-01 01:25:53 +03:00
metamod-r/metamod/extra/example/meta_api.cpp

60 lines
1.9 KiB
C++
Raw Normal View History

2017-03-10 18:38:35 +03:00
#include <extdll.h>
#include <meta_api.h>
2018-01-26 19:21:37 +03:00
#include "ex_rehlds_api.h"
2017-03-10 18:38:35 +03:00
meta_globals_t *gpMetaGlobals;
gamedll_funcs_t *gpGamedllFuncs;
mutil_funcs_t *gpMetaUtilFuncs;
enginefuncs_t *g_pengfuncsTable;
plugin_info_t Plugin_info =
{
META_INTERFACE_VERSION, // ifvers
"Example plugin", // name
"0.1", // version
__DATE__, // date
"Author", // author
"http://", // url
"EXAMPLE", // logtag
PT_ANYTIME, // (when) loadable
PT_ANYTIME, // (when) unloadable
};
C_DLLEXPORT int Meta_Query(char *interfaceVersion, plugin_info_t **plinfo, mutil_funcs_t *pMetaUtilFuncs)
{
*plinfo = &Plugin_info;
gpMetaUtilFuncs = pMetaUtilFuncs;
return TRUE;
}
META_FUNCTIONS gMetaFunctionTable =
{
NULL, // pfnGetEntityAPI HL SDK; called before game DLL
NULL, // pfnGetEntityAPI_Post META; called after game DLL
GetEntityAPI2, // pfnGetEntityAPI2 HL SDK2; called before game DLL
GetEntityAPI2_Post, // pfnGetEntityAPI2_Post META; called after game DLL
GetNewDLLFunctions, // pfnGetNewDLLFunctions HL SDK2; called before game DLL
GetNewDLLFunctions_Post, // pfnGetNewDLLFunctions_Post META; called after game DLL
GetEngineFunctions, // pfnGetEngineFunctions META; called before HL engine
GetEngineFunctions_Post, // pfnGetEngineFunctions_Post META; called after HL engine
};
C_DLLEXPORT int Meta_Attach(PLUG_LOADTIME now, META_FUNCTIONS *pFunctionTable, meta_globals_t *pMGlobals, gamedll_funcs_t *pGamedllFuncs)
{
gpMetaGlobals = pMGlobals;
gpGamedllFuncs = pGamedllFuncs;
2017-06-27 01:17:45 +03:00
g_engfuncs.pfnServerPrint("\n################\n# Hello World! #\n################\n\n");
2017-03-10 18:38:35 +03:00
2018-01-26 19:21:37 +03:00
if (meta_init_rehlds_api())
g_engfuncs.pfnServerPrint("ReHLDS API successfully initialized.\n");
2017-03-10 18:38:35 +03:00
memcpy(pFunctionTable, &gMetaFunctionTable, sizeof(META_FUNCTIONS));
return TRUE;
}
C_DLLEXPORT int Meta_Detach(PLUG_LOADTIME now, PL_UNLOAD_REASON reason)
{
return TRUE;
}