Hello guys, I'm trying to call the function CorpseGib from CBaseCombatCharacter with this code
PHP Code:
bool CorpseGib(CBaseEntity *clientEntity, const CTakeDamageInfoHack &damageInfo)
{
CONSOLE_DEBUGGER("Call started!");
static ICallWrapper *pCallWrapper = nullptr;
if( !pCallWrapper )
{
PassInfo info[2];
info[0].flags = PASSFLAG_BYREF | PASSFLAG_OCTOR | PASSFLAG_OCOPYCTOR;
info[0].size = sizeof(CTakeDamageInfoHack);
info[0].type = PassType_Object;
info[1].type = PassType_Basic;
info[1].flags = PASSFLAG_BYVAL;
info[1].size = sizeof(bool);
pCallWrapper = g_pExtension->m_pBinTools->CreateVCall(310, 0, 0, &info[1], info, 1);
if( !pCallWrapper )
{
CONSOLE_DEBUGGER("Failed to create a call to CBaseCombatCharacter:CorpseGib");
return false;
}
g_pExtension->m_pBinCallWrappers.push_back(pCallWrapper);
}
unsigned char params[sizeof(CBaseEntity *) + sizeof(CTakeDamageInfoHack)];
unsigned char *vparams = params;
*(CBaseEntity **) vparams = clientEntity; vparams += sizeof(CBaseEntity *);
memcpy(vparams, &damageInfo, sizeof(CTakeDamageInfoHack));
bool gibbed = false;
pCallWrapper->Execute(params, &gibbed);
CONSOLE_DEBUGGER("Call ended!");
return gibbed;
}
As you can see, the reference is making things a bit harder and I took a look at SDKTools's AcceptEntityInput, it is the only one using PassType_Object (apart from the ValveCaller);
The offset is: 310, and just to be sure I tested both 309 and 311. Although 310 seems the 'only' one giving gibbed = true as a result, I am confused, I mean the function is probably getting called but nothing is happening?
PS: I'm using the takedamageinfohack header and source file from SDKHooks to wrap around CTakeDamageInfo