View Single Post
Dr!fter
The Salt Boss
Join Date: Mar 2007
Old 05-14-2015 , 12:21   Re: DHooks (Dynamic Hooks - Dev Preview)
Reply With Quote #284

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(offsetHookType_EntityReturnType_CBaseEntityThisPointer_CBaseEntityOnGiveNamedItem);
    
DHookAddParam(hGiveNamedItemHookParamType_CharPtr);
    
DHookAddParam(hGiveNamedItemHookParamType_Int);
    
DHookAddParam(hGiveNamedItemHookParamType_Unknown);
    
DHookAddParam(hGiveNamedItemHookParamType_Bool);
}
public 
void OnClientPutInServer(client)
{
    if (
IsFakeClient(client))
        return;
    
    
DHookEntity(hGiveNamedItemtrueclient);
}

public 
MRESReturn OnGiveNamedItem(pThisHandle hReturnHandle hParams)
{   
    
PrintToConsole(pThis"----------==========> MRESReturn:OnGiveNamedItem(client=%d, entity=%d)"pThisDHookGetReturn(hReturn));
    return 
MRES_Ignored;

You can grab the latest snapshot on the link in the first post.

Last edited by Dr!fter; 05-14-2015 at 12:23.
Dr!fter is offline