Quote:
Originally Posted by bots4fun
PMB: As to meta-mod, I don't use it because I learned using the template, and I really don't want to re-learn another method of doing the mods.. besides this way I just worry about sdk updates, not sdk and meta-mod.. I dunno who metamod is written by but if they decide to stop someday, but the engine gets updated, don't all metamod plugins then break?
I like just talking to the engine directly, kind of old fashioned i guess 
|
Well I had exactly the same speech ... before.
Now I couldn't live without it, nor even consider writing ANYTHING that would look like a regular hook DLL.
If you want to see a simple example on how a metamod plugin works, check out one of my plugins source code. The metamod stuff is clearly delimited and well commented. All the rest is regular HL coding. Learning is simplissime.
Metamod is currently a collective project developed over SourceForge. It is almost immortal because this tool has become almost mandatory for any server admin (AMX, AdminMod are metamod plugins). You don't have to worry about API changes. You don't have to worry about entity lists. You don't have to worry about network message IDs. You only declare in a struct the functions you want to use, like here for the HPB_bot,
Code:
C_DLLEXPORT int GetEntityAPI2 (DLL_FUNCTIONS *pFunctionTable, int *interfaceVersion)
{
gFunctionTable.pfnGameInit = GameDLLInit;
gFunctionTable.pfnSpawn = Spawn;
gFunctionTable.pfnKeyValue = KeyValue;
gFunctionTable.pfnClientConnect = ClientConnect;
gFunctionTable.pfnClientDisconnect = ClientDisconnect;
gFunctionTable.pfnClientPutInServer = ClientPutInServer;
gFunctionTable.pfnClientCommand = ClientCommand;
gFunctionTable.pfnStartFrame = StartFrame;
memcpy (pFunctionTable, &gFunctionTable, sizeof (DLL_FUNCTIONS));
return (TRUE);
}
Code:
C_DLLEXPORT int GetEngineFunctions (enginefuncs_t *pengfuncsFromEngine, int *interfaceVersion)
{
meta_engfuncs.pfnChangeLevel = pfnChangeLevel;
meta_engfuncs.pfnEmitSound = pfnEmitSound;
meta_engfuncs.pfnClientCommand = pfnClientCommand;
meta_engfuncs.pfnMessageBegin = pfnMessageBegin;
meta_engfuncs.pfnMessageEnd = pfnMessageEnd;
meta_engfuncs.pfnWriteByte = pfnWriteByte;
meta_engfuncs.pfnWriteChar = pfnWriteChar;
meta_engfuncs.pfnWriteShort = pfnWriteShort;
meta_engfuncs.pfnWriteLong = pfnWriteLong;
meta_engfuncs.pfnWriteAngle = pfnWriteAngle;
meta_engfuncs.pfnWriteCoord = pfnWriteCoord;
meta_engfuncs.pfnWriteString = pfnWriteString;
meta_engfuncs.pfnWriteEntity = pfnWriteEntity;
meta_engfuncs.pfnClientPrintf = pfnClientPrintf;
meta_engfuncs.pfnCmd_Args = pfnCmd_Args;
meta_engfuncs.pfnCmd_Argv = pfnCmd_Argv;
meta_engfuncs.pfnCmd_Argc = pfnCmd_Argc;
meta_engfuncs.pfnSetClientMaxspeed = pfnSetClientMaxspeed;
meta_engfuncs.pfnGetPlayerUserId = pfnGetPlayerUserId;
meta_engfuncs.pfnGetPlayerAuthId = pfnGetPlayerAuthId;
memcpy (pengfuncsFromEngine, &meta_engfuncs, sizeof (enginefuncs_t));
return TRUE;
}
and there ya go.