CBaseEntity::RunScript
0x0060f690 · 302 bytes · __thiscall
_ZN11CBaseEntity9RunScriptEPKcS1_
Decompiled
undefined (3 params)
/* CBaseEntity::RunScript(char const*, char const*) */
char __thiscall CBaseEntity::RunScript(CBaseEntity *this,char *param_1,char *param_2)
{
int *piVar1;
char cVar2;
int iVar3;
undefined4 uVar4;
int *__ptr;
int iVar5;
cVar2 = ValidateScriptScope(this);
piVar1 = g_pScriptVM;
if (cVar2 == '\0') {
DevMsg("\n***\nFAILED to create private ScriptScope. ABORTING script\n***\n");
return '\0';
}
__ptr = *(int **)(this + 0x3f0);
if (0 < *__ptr) {
iVar5 = 0;
do {
if (*(int *)__ptr[iVar5 + 1] != 0) {
(**(code **)(*piVar1 + 0x4c))(piVar1,*(int *)__ptr[iVar5 + 1]);
}
iVar3 = iVar5 * 4;
iVar5 = iVar5 + 1;
**(undefined4 **)(*(int *)(this + 0x3f0) + 4 + iVar3) = 0xffffffff;
__ptr = *(int **)(this + 0x3f0);
} while (iVar5 < *__ptr);
}
if (__ptr != &CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData) {
free(__ptr);
*(undefined4 **)(this + 0x3f0) =
&CUtlVectorUltraConservative<HSCRIPT__**,CUtlVectorUltraConservativeAllocator>::
StaticData()::staticData;
}
iVar5 = (**(code **)(*g_pScriptVM + 0x2c))(g_pScriptVM,param_1,param_2);
if (iVar5 != 0) {
iVar3 = (**(code **)(*g_pScriptVM + 0x34))(g_pScriptVM,iVar5,*(undefined4 *)(this + 1000),1);
(**(code **)(*g_pScriptVM + 0x30))(g_pScriptVM,iVar5);
if (iVar3 != -1) {
return cVar2;
}
}
uVar4 = GetDebugName(this);
DevWarning(" Entity %s encountered an error in RunScript()\n",uVar4);
return cVar2;
}
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.