2007-05-04 12:51:13 +00:00
|
|
|
#include <extdll.h>
|
|
|
|
#include "sdk/amxxmodule.h"
|
2007-05-04 14:56:57 +00:00
|
|
|
|
2007-05-04 12:51:13 +00:00
|
|
|
#include "NEW_Util.h"
|
2007-05-04 14:56:57 +00:00
|
|
|
#include "CVector.h"
|
|
|
|
#include "forward.h"
|
|
|
|
#include "hook.h"
|
|
|
|
#include "ham_const.h"
|
2007-05-10 16:08:02 +00:00
|
|
|
#include "hooklist.h"
|
|
|
|
#include <assert.h>
|
2007-05-04 12:51:13 +00:00
|
|
|
|
|
|
|
edict_t *NEW_FirstEdict;
|
|
|
|
bool NEW_Initialized;
|
|
|
|
|
2007-05-04 14:56:57 +00:00
|
|
|
extern CVector<Hook*> hooks[HAM_LAST_ENTRY_DONT_USE_ME_LOL];
|
2007-05-04 12:51:13 +00:00
|
|
|
|
|
|
|
extern AMX_NATIVE_INFO RegisterNatives[];
|
2007-05-08 17:26:51 +00:00
|
|
|
extern AMX_NATIVE_INFO ReturnNatives[];
|
2007-05-04 12:51:13 +00:00
|
|
|
|
2007-05-10 16:08:02 +00:00
|
|
|
extern hook_t hooklist[];
|
|
|
|
|
2007-05-04 12:51:13 +00:00
|
|
|
int ReadConfig(void);
|
|
|
|
|
|
|
|
void OnAmxxAttach(void)
|
|
|
|
{
|
2007-05-10 16:08:02 +00:00
|
|
|
// Assert that the enum is aligned properly with the table
|
|
|
|
assert(strcmp(hooklist[Ham_NS_UpdateOnRemove].name, "ns_updateonremove")==0);
|
|
|
|
|
2007-05-04 12:51:13 +00:00
|
|
|
if (ReadConfig() > 0)
|
|
|
|
{
|
|
|
|
MF_AddNatives(RegisterNatives);
|
2007-05-08 17:26:51 +00:00
|
|
|
MF_AddNatives(ReturnNatives);
|
2007-05-04 12:51:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void HamCommand(void);
|
|
|
|
|
2007-05-04 14:56:57 +00:00
|
|
|
void OnPluginsUnloaded(void)
|
|
|
|
{
|
|
|
|
|
|
|
|
CVector <Hook *>::iterator end;
|
|
|
|
for (int i = 0; i < HAM_LAST_ENTRY_DONT_USE_ME_LOL; i++)
|
|
|
|
{
|
|
|
|
end=hooks[i].end();
|
|
|
|
|
|
|
|
for (CVector<Hook*>::iterator j=hooks[i].begin();
|
|
|
|
j!=end;
|
|
|
|
++j)
|
|
|
|
{
|
|
|
|
delete (*j);
|
|
|
|
}
|
|
|
|
hooks[i].clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2007-05-04 12:51:13 +00:00
|
|
|
void OnPluginsLoaded(void)
|
|
|
|
{
|
|
|
|
NEW_Initialize(INDEXENT(0));
|
|
|
|
}
|
|
|
|
void OnMetaAttach(void)
|
|
|
|
{
|
|
|
|
REG_SVR_COMMAND("ham", HamCommand);
|
|
|
|
}
|