AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Suggestions / Requests (https://forums.alliedmods.net/forumdisplay.php?f=12)
-   -   [REQUEST] 1 Headshot = 1 Kill (https://forums.alliedmods.net/showthread.php?t=331170)

MAJESTIC_SZ 03-08-2021 20:15

[REQUEST] 1 Headshot = 1 Kill
 
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. :)

CrazY. 03-08-2021 20:34

Re: [REQUEST] 1 Headshot = 1 Kill
 
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 }

Bugsy 03-08-2021 21:58

Re: [REQUEST] 1 Headshot = 1 Kill
 
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;



MAJESTIC_SZ 03-09-2021 19:24

Re: [REQUEST] 1 Headshot = 1 Kill
 
Thank you both for your help.
I will try if it works as i imagine.

MAJESTIC_SZ 03-13-2021 14:54

Re: [REQUEST] 1 Headshot = 1 Kill
 
Quote:

Originally Posted by Bugsy (Post 2739821)
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

Bugsy 03-13-2021 21:52

Re: [REQUEST] 1 Headshot = 1 Kill
 
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.

MAJESTIC_SZ 03-22-2023 16:00

Re: [REQUEST] 1 Headshot = 1 Kill
 
Hi!
Sorry to reopen this, but is it possible to edit the plugin so it wont take effect with C4 and grenades?
Thank you!

Bugsy 03-25-2023 14:36

Re: [REQUEST] 1 Headshot = 1 Kill
 
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;



MAJESTIC_SZ 03-31-2023 09:37

Re: [REQUEST] 1 Headshot = 1 Kill
 
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!

Bugsy 03-31-2023 18:12

Re: [REQUEST] 1 Headshot = 1 Kill
 
Yes, pretty easy. I can add a menu for handling adds/removes


All times are GMT -4. The time now is 10:22.

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