Thread: Fake touch
View Single Post
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 01-13-2018 , 18:06   Re: Fake touch
Reply With Quote #5

You can try creating an SDKCall for CBaseEntity::Touch( CBaseEntity* pOther ) which (I think) gets called when 2 entities touch each other.

Here is some code that should do that:

PHP Code:
Handle g_hSDK_Touch;

public 
void OnPluginStart()
{
    
Handle hGameConf LoadGameConfigFile("sdkhooks.games");
    if(
hGameConf == INVALID_HANDLE)
    {
        
SetFailState("GameConfigFile sdkhooks.games was not found");
        return;
    }
    
    
StartPrepSDKCall(SDKCall_Entity);
    
PrepSDKCall_SetFromConf(hGameConfSDKConf_Virtual"Touch");
    
PrepSDKCall_AddParameter(SDKType_CBaseEntitySDKPass_Pointer);
    
g_hSDK_Touch EndPrepSDKCall();
    
CloseHandle(hGameConf);

    if(
g_hSDK_Touch == INVALID_HANDLE)
    {
        
SetFailState("Unable to prepare virtual function CBaseEntity::Touch");
        return;
    }
}

// later when you want to call it
SDKCall(g_hSDK_Touchentity1entity2); 
This will just call the Touch function for the 2 entities which should simulate them "touching" (or at least the code that runs when they do), but it might not necessarily work the way you expect to or give you the effect you're looking for.

Last edited by hmmmmm; 01-13-2018 at 18:07.
hmmmmm is offline