I fixed the problem with returns that were pointers. I hopefully didnt break anything else, the code for handling returns needs to be rewritten at some point as it is quiet ugly (Ill probably get around to it soon). I tested changing returns of ints, floats, bools, and pointers and they all appear to be working correctly so hopefully the ones I didnt test also work. I also updated the test plugin so it no longer spews things about keywords (this, interface).
The code i used to test.
PHP Code:
new Handle:hGiveNamedItem;
public OnPluginStart()
{
int offset = 445;
hGiveNamedItem = DHookCreate(offset, HookType_Entity, ReturnType_CBaseEntity, ThisPointer_CBaseEntity, OnGiveNamedItem);
DHookAddParam(hGiveNamedItem, HookParamType_CharPtr);
DHookAddParam(hGiveNamedItem, HookParamType_Int);
DHookAddParam(hGiveNamedItem, HookParamType_Unknown);
DHookAddParam(hGiveNamedItem, HookParamType_Bool);
}
public void OnClientPutInServer(client)
{
if (IsFakeClient(client))
return;
DHookEntity(hGiveNamedItem, true, client);
}
public MRESReturn OnGiveNamedItem(pThis, Handle hReturn, Handle hParams)
{
PrintToConsole(pThis, "----------==========> MRESReturn:OnGiveNamedItem(client=%d, entity=%d)", pThis, DHookGetReturn(hReturn));
return MRES_Ignored;
}
You can grab the latest snapshot on the link in the first post.