View Single Post
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Old 03-27-2020 , 10:47   Call a function by the pointer from FunctionTable
Reply With Quote #1

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_THINKFUNCDetonate ),
virtual void Detonatevoid ); 
I tried to do it like this, but it crashes the server:
PHP Code:
typedef void (*Detonate_pointer)();

voidpointer = ...

((
Detonate_pointer)pointer ())(); 
PHP Code:
voidpointer = ...
CBaseEntityptr = ...
reinterpret_castvoid(*)(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

Last edited by kadet.89; 03-27-2020 at 18:39.
kadet.89 is offline
Send a message via Skype™ to kadet.89