Quote:
Originally Posted by Phil25
That is pretty insane. Care to post the full solution?
|
I forgot to respond
Gamedata(ghostbuster_defs.txt):
Code:
"Games"
{
"#default"
{
"Signatures"
{
"CWeaponMedigun::AllowedToHealTarget" // "weapon_blocks_healing" and 4th function or debug and set breakpoints
{
"library" "server"
"windows" "\x55\x8B\xEC\x53\x8B\xD9\x56\x57\x8B\xB3\xE8"
"linux" "_ZN14CWeaponMedigun19AllowedToHealTargetEP11CBaseEntity"
}
}
}
}
Some code from my ff2 ghostbuster ability...(Requires
DHooks with detours!)
PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>
#include <tf2>
#include <tf2_stocks>
#include <dhooks>
#pragma newdecls required
#define PLUGIN_NAME "Example all-heal plugin"
#define PLUGIN_AUTHOR "Naydef"
#define PLUGIN_VERSION "1.0"
public Plugin myinfo =
{
name = PLUGIN_NAME,
author = PLUGIN_AUTHOR,
version = PLUGIN_VERSION,
};
Handle hDetourAllowedToHealTarget;
public void OnPluginStart()
{
Handle gamedatafile=LoadGameConfigFile("ghostbuster_defs.games");
if(gamedatafile==null)
{
SetFailState("Cannot find file ghostbuster_defs.games!");
}
hDetourAllowedToHealTarget=DHookCreateDetour(Address_Null, CallConv_THISCALL, ReturnType_Bool, ThisPointer_CBaseEntity);
if(hDetourAllowedToHealTarget==null)
{
SetFailState("Failed to create CWeaponMedigun::AllowedToHealTarget detour!");
}
// Load the address of the function from PTaH's signature gamedata file.
if(!DHookSetFromConf(hDetourAllowedToHealTarget, gamedatafile, SDKConf_Signature, "CWeaponMedigun::AllowedToHealTarget"))
{
SetFailState("Failed to load CWeaponMedigun::AllowedToHealTarget signature from gamedata");
}
// Load the address of the function from PTaH's signature gamedata file.
delete gamedatafile;
//CWeaponMedigun::AllowedToHealTarget
DHookAddParam(hDetourAllowedToHealTarget, HookParamType_CBaseEntity);
// Add a post hook on the function.
if(!DHookEnableDetour(hDetourAllowedToHealTarget, false, Detour_AllowedToHealTargetPost))
{
SetFailState("Failed to detour CWeaponMedigun::AllowedToHealTarget!");
}
}
public MRESReturn Detour_AllowedToHealTargetPost(int pThis, Handle hReturn, Handle hParams)
{
if(pThis==-1 || DHookIsNullParam(hParams, 1))
{
return MRES_Ignored;
}
//int targettoheal=DHookGetParam(hParams, 1);
DHookSetReturn(hReturn, true); // Just try the medigun in the game :)
return MRES_ChangedOverride;
}
__________________