View Single Post
Maind
Member
Join Date: Dec 2009
Old 09-28-2018 , 15:03   Re: CS:GO Player Used Healthshot
Reply With Quote #8

Hi, with help of @peace-maker and @Pelipoika i've got the solution for that

PHP Code:
#pragma semicolon 1
#include <sourcemod>
#include <dhooks>
 

// CItem_Healthshot::CompleteUse(CCSPlayer *) (probably returns void)
Handle hHealthshotCompleteUse;
int offsetHealthshotCompleteUse;
 
public 
OnPluginStart()
{
    
Handle temp LoadGameConfigFile("healthshot.games");
    if(
temp == INVALID_HANDLE)
        
SetFailState("Missing healthshot.games file in gamedata folder.");
    
offsetHealthshotCompleteUse GameConfGetOffset(temp"CompleteUse");
    if(
offsetHealthshotCompleteUse == -1)
        
SetFailState("Failed to get offset from healthshot.games file.");
    
CloseHandle(temp);
      
    
hHealthshotCompleteUse DHookCreate(offsetHealthshotCompleteUseHookType_EntityReturnType_VoidThisPointer_CBaseEntityHealthshotCompleteUse);
    
DHookAddParam(hHealthshotCompleteUseHookParamType_CBaseEntity);
}
 
public 
OnEntityCreated(int entity, const char[] classname)
{
    if (
StrEqual(classname"weapon_healthshot"))
    {
        
DHookEntity(hHealthshotCompleteUsetrueentity);
    }  
}
 
public 
MRESReturn HealthshotCompleteUse(pThisHandle hParams)
{
    
int client DHookGetParam(hParams1);
    
    
//Here you can do some stuff with client who used healthshot :)
    
    
return MRES_Ignored;

and current offsets for this
Code:
"Games"
{
	"csgo"
	{
		"Offsets"
		{
			"CompleteUse"
			{
				"windows"	"453"
				"linux"		"459"
			}
		}
	}
}
Maind is offline