Raised This Month: $32 Target: $400
 8% 

[L4D2] Detect if special infected die by headshot


Post New Thread Reply   
 
Thread Tools Display Modes
HarryPotter
Veteran Member
Join Date: Sep 2017
Location: Taiwan, Asia
Old 01-28-2022 , 11:03   Re: [L4D2] Detect if special infected die by headshot
Reply With Quote #11

If player_death event doesn't work, you can try use player_hurt event and detect hitgroup

PHP Code:
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <sdktools>

#define HITGROUP_GENERIC 0
#define HITGROUP_HEAD 1
#define HITGROUP_CHEST 2
#define HITGROUP_STOMACH 3
#define HITGROUP_LEFTARM 4
#define HITGROUP_RIGHTARM 5
#define HITGROUP_LEFTLEG 6
#define HITGROUP_RIGHTLEG 7 


public Plugin myinfo =
{
    
name "[L4D & L4D2] XXX",
    
author "HarryPotter",
    
description "<->",
    
version "0.0",
    
url ""
}

public 
void OnPluginStart()
{
    
HookEvent("player_hurt"Event_PlayerHurtEventHookMode_Pre);    
}

public 
void Event_PlayerHurt(Event event, const char[] namebool dontBroadcast
{
    
int victim GetClientOfUserId(event.GetInt("userid"));
    
int attacker GetClientOfUserId(event.GetInt("attacker"));    
    
int dmg event.GetInt("dmg_health");
    
int eventhealth event.GetInt("health");
    
    if (
attacker == || victim == || !IsClientInGame(attacker) || !IsClientInGame(victim)
        || 
GetClientTeam(attacker) != || GetClientTeam(victim) != ) {
        return;
    }

    
int zombieClass GetEntProp(victimProp_Send"m_zombieClass");
    
int hitgroup event.GetInt("hitgroup");
    if(
zombieClass == && eventhealth <= //hunter infected player is going to die
    
{
        switch (
hitgroup)
        {
            case 
HITGROUP_HEAD:
            {
                
PrintToChatAll("%N head-shot killed %N, dmg: %d"attackervictimdmg);
            }
        }
    }

__________________

Last edited by HarryPotter; 01-28-2022 at 11:03.
HarryPotter is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 01-28-2022 , 13:06   Re: [L4D2] Detect if special infected die by headshot
Reply With Quote #12

Thanks Guys!
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
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 14:47.


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