Hello,
i try to hook FireBullets but it doesn't work.
I Hook it like this: (windows)
PHP Code:
#define HVFUNC( funcname, returntype, proto) \
typedef returntype ( __stdcall * funcname##Func ) proto ; \
extern funcname##Func funcname; \
extern CVirtualCallGate funcname##Gate; \
returntype __stdcall funcname##_hook proto;
#define HOOKVFUNC( classptr , index , funcname ) \
if (! funcname##Gate.IsBuilt() ) { \
DeProtect((void*)VTBL( classptr ), ( index * sizeof(void*)) + 4 ); \
funcname##Gate.Build((void*)VFN( classptr , index ), funcname##_hook , & funcname ); \
*(DWORD*)PVFN( classptr , index ) = funcname##Gate.Gate(); \
}
HVFUNC(h_FireBullets, void, ( CBasePlayer* pPlayer, const FireBulletsInfo_t &info ))
DEFVFUNC(h_FireBullets, void, ( CBasePlayer* pPlayer, const FireBulletsInfo_t &info ))
{
Msg("h_FireBullets called @ %.1f\n", gpGlobals->curtime);
h_FireBullets(pPlayer,info);
}
void TestPlugin::ClientActive( edict_t *pEntity )
{
CBaseEntity *pBaseEnt = pEntity->GetUnknown()->GetBaseEntity();
HOOKVFUNC(pBaseEnt, 110, h_FireBullets);
}
What am I doing wrong?