Raised This Month: $ Target: $400
 0% 

Solved Problem with headshot detection.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Shadows Adi
AlliedModders Donor
Join Date: Aug 2019
Location: Romania
Old 05-20-2020 , 18:59   Re: Problem with headshot detection.
Reply With Quote #1

This is registered event:
PHP Code:
RegisterHam(Ham_Killed"player""fw_PlayerKilled"1
And this is the public of the function:
PHP Code:
public fw_PlayerKilled(iVictimiAttackershouldgib)
{
    if( 
iVictim == iAttacker || !is_user_connected(iAttacker) || !is_user_connected(iVictim) )
        return 
HAM_IGNORED

    
if(is_user_connected(iAttacker) && is_user_alive(iAttacker))
    {
        new 
g_iIsHeadshot read_data(3);
        new 
szName[33]
        
get_user_name(iVictimszNamecharsmax(szName))
        new 
aName[32]
        
get_user_name(iAttackeraNamecharsmax(aName))
        
        new 
wpnclipammo
        wpn 
get_user_weapon(iAttackerclipammo)
        if(
iAttacker != iVictim && wpn == CSW_KNIFE )
        {
            if(
g_iIsHeadshot)
            {
                
pdData[iAttacker][Kills] += 1
                pdData
[iAttacker][Headshot] += 1
            
}
            else
            {
                
pdData[iAttacker][Kills] += 1
            
}
        }
        if(!
is_user_alive(iVictim) && iVictim != iAttacker && wpn == CSW_KNIFE )
        {
            
pdData[iVictim][Deaths]  += 1
        
}
        return 
HAM_HANDLED
    
}
    return 
PLUGIN_HANDLED

__________________


Accepting Paid Requests, contact PM.

MVP Of The Round View project on GITHUB / AlliedModders
CSGO REMAKE ~ CSGO MOD [STABLE + SOURCE CODE]
Shadows Adi 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 17:10.


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