VScriptServerRunScript
0x00b472b0 · 365 bytes · __cdecl
_Z22VScriptServerRunScriptPKcP9HSCRIPT__b
Decompiled
undefined (3 params)
/* VScriptServerRunScript(char const*, HSCRIPT__*, bool) */
bool VScriptServerRunScript(char *param_1,HSCRIPT__ *param_2,bool param_3)
{
int iVar1;
int iVar2;
CBaseEntity *this;
bool bVar3;
void *local_28 [2];
undefined2 local_20;
ushort local_1e;
if (g_pScriptVM == (int *)0x0) {
return false;
}
if ((param_1 != (char *)0x0) && (*param_1 != '\0')) {
if (g_ScriptServerRunScriptDepth < 0x11) {
g_ScriptServerRunScriptDepth = g_ScriptServerRunScriptDepth + 1;
iVar1 = VScriptServerCompileScript(param_1,param_3);
if (iVar1 == 0) {
bVar3 = false;
}
else {
if (*(int *)(gpGlobals + 0x14) == 1) {
this = (CBaseEntity *)UTIL_GetLocalPlayer();
if (this != (CBaseEntity *)0x0) {
local_28[0] = (void *)CBaseEntity::GetScriptInstance(this);
local_20 = 0x20;
local_1e = 0;
/* try { // try from 00b47411 to 00b47413 has its CatchHandler @ 00b47447 */
(**(code **)(*g_pScriptVM + 0x78))(g_pScriptVM,0,"player",local_28);
if ((local_1e & 1) != 0) {
free(local_28[0]);
}
}
}
iVar2 = (**(code **)(*g_pScriptVM + 0x34))(g_pScriptVM,iVar1,param_2,1);
bVar3 = iVar2 != -1;
if (iVar2 == -1) {
DevMsg("Error running script named %s\n",param_1);
}
(**(code **)(*g_pScriptVM + 0x30))(g_pScriptVM,iVar1);
}
g_ScriptServerRunScriptDepth = g_ScriptServerRunScriptDepth + -1;
return bVar3;
}
Warning("IncludeScript stack overflow\n");
return false;
}
Msg("Cannot run script: NULL script name\n");
return false;
}
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.