CBaseEntity::TakeHealth
0x00601b40 · 155 bytes · __cdecl
_ZN11CBaseEntity10TakeHealthEfi
Decompiled
undefined (2 params)
/* CBaseEntity::TakeHealth(float, int) */
int CBaseEntity::TakeHealth(float param_1,int param_2)
{
int iVar1;
int iVar2;
int iVar3;
int iVar4;
int iVar5;
iVar3 = 0;
if ((*(int *)((int)param_1 + 0x30) != 0) && ('\x01' < *(char *)((int)param_1 + 0x105))) {
iVar2 = (**(code **)(*(int *)param_1 + 0x1fc))(param_1);
iVar1 = *(int *)((int)param_1 + 0x100);
if (iVar1 < iVar2) {
iVar5 = (int)param_1 + 0x100;
iVar4 = (int)(float)param_2 + iVar1;
iVar3 = iVar1;
if (iVar1 != iVar4) {
(**(code **)(*(int *)param_1 + 0x214))(param_1,iVar5,iVar5);
*(int *)((int)param_1 + 0x100) = iVar4;
iVar3 = iVar4;
if (iVar2 < iVar4) {
(**(code **)(*(int *)param_1 + 0x214))(param_1,iVar5);
*(int *)((int)param_1 + 0x100) = iVar2;
iVar3 = iVar2;
}
}
iVar3 = iVar3 - iVar1;
}
}
return iVar3;
}
SourceMod gamedata
paste intoaddons/sourcemod/gamedata/<your_plugin>.txt
used as the SourceMod key — change to fit your plugin's convention
SourceMod library name (server / engine / matchmaking)
Just a Signatures{} block, ready to drop into a gamedata
file. Wire it up in your plugin however you like - SDKCall, DHooks,
raw memory ops, or anything else.
Signatures + Functions block. The plugin uses
DHookCreateFromConf - DHooks reads return type, this-type,
calling convention, and argument types straight from the gamedata. Less
boilerplate in the plugin, types travel with the gamedata.
Gamedata KeyValues
DHooks plugin example
Type inference is best-effort from the C signature - sanity-check the DHooks types before shipping.