I have these functions from datamaps:
DEFINE_THINKFUNC( Detonate )
Code:
CBaseCSGrenadeProjectile - hegrenade_projectile
- InitializeSpawnFromWorld (Offset 0) (Input)(0 Bytes) - InitializeSpawnFromWorld
- CBaseCSGrenadeProjectileDangerSoundThink (Offset 0) (FunctionTable)(0 Bytes)
- m_hThrower (Offset 1292) (Save)(4 Bytes)
- m_bIsLive (Offset 1265) (Save)(1 Bytes)
- m_DmgRadius (Offset 1268) (Save)(4 Bytes)
- CBaseGrenadeSmoke (Offset 0) (FunctionTable)(0 Bytes)
- CBaseGrenadeExplodeTouch (Offset 0) (FunctionTable)(0 Bytes)
- CBaseGrenadeDetonateUse (Offset 0) (FunctionTable)(0 Bytes)
- CBaseGrenadePreDetonate (Offset 0) (FunctionTable)(0 Bytes)
- CBaseGrenadeDetonate (Offset 0) (FunctionTable)(0 Bytes)
I get a void* from CBaseGrenadeDetonate (and it's not nullptr), is there a way to call the function using the pointer?
PHP Code:
DEFINE_THINKFUNC( Detonate ),
virtual void Detonate( void );
I tried to do it like this, but it crashes the server:
PHP Code:
typedef void (*Detonate_pointer)();
void* pointer = ...
((Detonate_pointer)pointer ())();
PHP Code:
void* pointer = ...
CBaseEntity* ptr = ...
reinterpret_cast< void(*)(CBaseEntity*) > (pointer ) (ptr );
UPD:
I got inputfunc_t field value from typedescription_t of the "CBaseGrenadeDetonate", I gues that should be the correct funcion pointer, but have no idea ho I can call it