Raised This Month: $51 Target: $400
 12% 

Knife Headshot


Post New Thread Reply   
 
Thread Tools Display Modes
eyal282
Veteran Member
Join Date: Aug 2011
Old 06-19-2018 , 09:16   Re: Knife Headshot
Reply With Quote #11

Quote:
Originally Posted by Papero View Post
Try this:

PHP Code:
#include <sourcemod>
#include <sdktools>
#include <sdkhooks>

#define PLUGIN_AUTHOR         "Hexah"
#define PLUGIN_VERSION        "1.0"

#pragma semicolon 1
#pragma newdecls required

public Plugin myinfo =
{
    
name "KnifeHS",
    
author PLUGIN_AUTHOR,
    
description "",
    
version PLUGIN_VERSION,
    
url "csitajb.it"
};

public 
void OnPluginStart()
{
    
HookEvent("player_death"Event_PlayerDeathEventHookMode_Pre);
}

public 
Action Event_PlayerDeath(Event event, const char[] namebool dontBroadcast)
{
    
char sWeapon[32];
    
event.GetString("weapon"sWeaponsizeof(sWeapon)); //Get weapon name
    
    
if (StrContains(sWeapon"knife"false) != -1//If the weapon isn't a knife
        
return Plugin_Continue;
        
    
int client GetClientOfUserId(event.GetInt("attacker")); //Get client index
    
    
float vPos[3];
    
float vAng[3];
    
    
GetClientAbsOrigin(clientvAng);
    
GetClientAbsAngles(clientvAng);
    
TR_TraceRayFilter(vPosvAngMASK_SHOTRayType_InfiniteTrace_DontHitSelfclient); //Start the trace
    
    
int iHitGroup TR_GetHitGroup(); //Get the hit group
    
    
if (iHitGroup == 1//Not sure if '1' for it's okay. (For HS hitgroup)
    
{
        
event.SetBool("headshot"true);
        return 
Plugin_Changed;
    }
    return 
Plugin_Continue;
}

public 
bool Trace_DontHitSelf(int entityint contentsMaskany data)
{
    return 
entity != data;

If someone can confirm me that the hitgroup of "headshots" is "1" would be great, since I really don't know if that's okay.
vPos is equal to 0.0, 0.0, 0.0 so I can see this won't work but thanks, it helped me in this plugin:

https://forums.alliedmods.net/showthread.php?t=308409
__________________
I am available to make plugins for pay.

Discord: Eyal282#1334
eyal282 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:23.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode