Just a short explanation of the "bintools" extension that recently got committed. This is a C++ API to let you do something like this (pseudo code, don't yell at me for not following the API exactly). Imagine that we're trying to call CBaseEntity::GiveNamedItem:
Code:
ParamInfo params[3] = { {Param_POD, 4, 0, }, {Param_POD, 4, 0}, {Param_POD, 4, 0} };
ICallWrapper *pCall = bintools->CreateThisCall(vtblIndex, NULL, params, 3);
This dynamically generates a C function which can decode an array holding 3 parameters of 4 bytes each.
To then call said function, you can do:
Code:
unsigned char stk[4*4];
*(CBaseEntity **)(stk + 0) = pEntity;
*(const char **)(stk + 4) = "weapon_ak47";
*(bool *)(stk + 8) = false;
*(bool *)(stk + 12) = false;
pCall->Execute(stk, NULL);
__________________