Raised This Month: $ Target: $400
 0% 

How to check if player has killed somebody


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Doc-Holiday
AlliedModders Donor
Join Date: Jul 2007
Old 09-09-2011 , 17:30   Re: How to check if player has killed somebody
Reply With Quote #4

Just another way

PHP Code:
#include <amxmodx>
#include <fakemeta>
#include <hamsandwich>
#include <cstrike>

#define m_LastHitGroup 75
new KillCount[33]

public 
plugin_init()
{
    
RegisterHam(Ham_Killed"player""death");
    
register_logevent("ResetKills",2,"1=Round_Start")
}

public 
client_disconnect(id)
    
KillCount[id] = 0

    
public ResetKills()
{
    new 
players[32] , inum
    get_players
(playersinum)
    for(new 
0inum; ++a)
        
KillCount[a] = 0
}
public 
death(iVictimiInflictoriAttackeriShouldGib)
{
    new 
HitGroup get_pdata_int(iVictimm_LastHitGroup);
    if(
iAttacker != iVictim && cs_get_user_team(iVictim) != cs_get_user_team(iAttacker))
    {
        
KillCount[iAttacker]++
        
        if(
HitGroup == HIT_HEAD)
        {
            
//Was a Headshot
        
}
    
        if(
KillCount[iAttacker] == 3)
        {
            
//if he has killed 3 this round execute a function
            
SomeFunction(iAttacker)
        }
    }
    
    return 
HAM_IGNORED;
}

public 
SomeFunction(id)
{
    
//your code here
    
client_print(idprint_chat"This is your third kill this round!")

you can check head shots also in death message by using read_data(3) and doing a check like this

PHP Code:
new HeadShot read_data(3)

if(
HeadShot)
{
    
//Was a headshot

Also i didnt edit his code just changed it over to ham so i didn't test the way it works.
Doc-Holiday is offline
 



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 09:12.


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