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

[REQUEST] 1 Headshot = 1 Kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 03-08-2021 , 20:15   [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #1

Hello.

I would like to have a small light plugin to make players kill when they hit an headshot.
Like the title says.
Sometimes players get headshots but don't die.

I found a plugin that makes this, but it has a bug: Sometimes players 1st camera gets turned sideways left or right. The plugin is this: MORTAL HEADSHOT

Can someone please do this for me?
Me and my team are trying hard to keep CS 1.6 alive in Portugal.

Thank you in advance.
MAJESTIC_SZ is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-08-2021 , 20:34   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #2

Code:
#include <amxmodx> #include <hamsandwich> #include <fakemeta> public plugin_init() {     register_plugin("Plugin", "Version", "Author")     RegisterHam(Ham_TraceAttack, "player", "HookPlayerTraceAttack") } public HookPlayerTraceAttack(this, idattacker, Float:damage, Float:direction[3], tracehandle, damagebits) {     if (!is_user_alive(idattacker))         return HAM_IGNORED     if (get_tr2(tracehandle, TR_iHitgroup) == HIT_HEAD)     {         new Float:health         pev(this, pev_health, health)         SetHamParamFloat(3, health)         return HAM_HANDLED     }     return HAM_IGNORED }
__________________








CrazY. is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-08-2021 , 21:58   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #3

CrazY., the damage inflicted can be offset by armor that the player may have, so if a player has 100 hp and you inflict 80 damage, he may only get a loss in hp of 40. I would remove the pev_health part all together and just go a value that is guaranteed to kill, like SetHamParamFloat(3, 999.0). Your plugin was not working for me.

This works
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const m_LastHitGroup 75;

public 
plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage" );
}

public 
HamTakeDamagevictim inflictor attacker Float:fDamage bitDamage 
{     
    if ( 
get_pdata_intvictim m_LastHitGroup ) == HIT_HEAD )
    {
        
SetHamParamFloat999.0 );
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;

__________________
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 03-09-2021 , 19:24   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #4

Thank you both for your help.
I will try if it works as i imagine.
MAJESTIC_SZ is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 03-13-2021 , 14:54   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #5

Quote:
Originally Posted by Bugsy View Post
CrazY., the damage inflicted can be offset by armor that the player may have, so if a player has 100 hp and you inflict 80 damage, he may only get a loss in hp of 40. I would remove the pev_health part all together and just go a value that is guaranteed to kill, like SetHamParamFloat(3, 999.0). Your plugin was not working for me.

This works
PHP Code:
#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const m_LastHitGroup 75;

public 
plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage" );
}

public 
HamTakeDamagevictim inflictor attacker Float:fDamage bitDamage 
{     
    if ( 
get_pdata_intvictim m_LastHitGroup ) == HIT_HEAD )
    {
        
SetHamParamFloat999.0 );
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;


Hello Bugsy.

This works.

How can i change the amount of damage made by the headshot?
Like this?

SetHamParamFloat( 4 , 999.0 );

to

SetHamParamFloat( 4 , 110.0 );

Thanks
MAJESTIC_SZ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-13-2021 , 21:52   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #6

Yes, that controls the damage inflicted -- but as mentioned above, it is not the amount of hp lost by the victim if that is what you're trying to get to.
__________________
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 03-22-2023 , 16:00   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #7

Hi!
Sorry to reopen this, but is it possible to edit the plugin so it wont take effect with C4 and grenades?
Thank you!
MAJESTIC_SZ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-25-2023 , 14:36   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #8

Try this.. If you don't want knife to count either, change "( DMG_BULLET | DMG_SLASH )" to just "DMG_BULLET"
PHP Code:

#include <amxmodx>
#include <hamsandwich>
#include <fakemeta>

const m_LastHitGroup 75;

public 
plugin_init() 
{
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage" );
}

public 
HamTakeDamagevictim inflictor attacker Float:fDamage bitDamage 
{     
    if ( ( 
get_pdata_intvictim m_LastHitGroup ) == HIT_HEAD ) && ( bitDamage & ( DMG_BULLET DMG_SLASH ) ) )
    {
        
SetHamParamFloat999.0 );
        return 
HAM_HANDLED;
    }
    
    return 
HAM_IGNORED;

__________________

Last edited by Bugsy; 03-25-2023 at 14:39.
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 03-31-2023 , 09:37   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #9

Thank you a lot, it is working fine

Here is a challenge:

Can you create a ini file, or by another way, the possibility to edit this per weapon?
I mean, turn it OFF for AWP and AK47 for example but ON for other weapons?
Is it possible?

Thank you in advance!
MAJESTIC_SZ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-31-2023 , 18:12   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #10

Yes, pretty easy. I can add a menu for handling adds/removes
__________________
Bugsy 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 00:31.


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