Raised This Month: $ Target: $400
 0% 

[REQUEST] 1 Headshot = 1 Kill


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 03-31-2023 , 19:24   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #1

Hardly tested. For now knife is not supported as I ran out of time, but I can add it if needed.
PHP Code:

#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <fakemeta>
#include <cstrike>
#include <nvault>

new const Version[] = "0.1";

const 
m_LastHitGroup 75;
const 
UnsupportedWeaponBits = ( ( << CSW_GLOCK ) | ( << CSW_HEGRENADE ) | ( << CSW_C4 ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_KNIFE ) );

new 
g_WeaponBits;
new 
g_Vault;

public 
plugin_init() 
{
    
register_plugin"Headshot Kill Weapons" Version "bugsy" );
    
    
RegisterHamHam_TakeDamage "player" "HamTakeDamage" );
    
    
register_clcmd"say hsweapon" "ManageWeaponsMenu" ADMIN_KICK "- Menu to manage Headshot Kill Weapons" );
    
    if ( ( 
g_Vault nvault_open"hs_kill" ) ) == INVALID_HANDLE )
        
set_fail_state"Error opening vault [hs_kill.vault]" );
    else
        
g_WeaponBits nvault_getg_Vault "WeaponBits" );
}

public 
plugin_end()
{
    new 
szWeaponBits13 ];
    
num_to_strg_WeaponBits szWeaponBits charsmaxszWeaponBits ) );
    
nvault_setg_Vault "WeaponBits" szWeaponBits );
    
    
nvault_closeg_Vault );
}

public 
HamTakeDamageiVictim iInflictor iAttacker Float:fDamage bitDamage 
{     
    if ( ( 
get_pdata_intiVictim m_LastHitGroup ) == HIT_HEAD ) && ( bitDamage DMG_BULLET ) )
    {
        if ( 
is_user_aliveiAttacker ) && ( g_WeaponBits & ( << cs_get_user_weaponiAttacker ) ) ) )
        {
            
SetHamParamFloat999.0 );
            return 
HAM_HANDLED;
        }
    }
    
    return 
HAM_IGNORED;


public 
ManageWeaponsMenuid level cid )
{
    if( !
cmd_accessid level cid ) )
        return 
PLUGIN_HANDLED;
    
    
ManageWeaponsid );
    
    return 
PLUGIN_HANDLED;
}

public 
ManageWeaponsid iMenuPage )
{
    new 
szWeapon19 ] , szMenuItem32 ] , iPos szIndex] , iMenu menu_create"Manage Headshot Kill Weapons" "WeaponHandler" );
    
    for ( new 
iWeaponID iWeaponID CSW_VEST iWeaponID++ )
    {
        if ( !( 
UnsupportedWeaponBits & ( << iWeaponID ) ) )
        {
            
iPos get_weaponnameiWeaponID szWeapon charsmaxszWeapon ) );
            
formatexszMenuItem charsmaxszMenuItem ) - iPos "%s - %s" szWeapon] , g_WeaponBits & ( << iWeaponID ) ? "On" "Off" );
            
num_to_striWeaponID szIndex charsmaxszIndex ) );
            
menu_additemiMenu szMenuItem szIndex );
        }
    }
    
    
menu_displayid iMenu iMenuPage );
}

public 
WeaponHandlerid iMenu iItem )
{
    if ( 
iItem == MENU_EXIT )
    {
        
menu_destroyiMenu );
    }
    else
    {
        new 
iMenuPage iNewMenu szInfo] , iWeaponID;
        
        
player_menu_infoid iMenu iNewMenu iMenuPage );
        
menu_item_getinfoiMenu iItem _szInfo charsmaxszInfo ) );
        
iWeaponID str_to_numszInfo );
        
        if ( 
g_WeaponBits & ( << iWeaponID ) )
            
g_WeaponBits &= ~( << iWeaponID );
        else
            
g_WeaponBits |= ( << iWeaponID );
        
        
ManageWeaponsid iMenuPage );
    }

__________________

Last edited by Bugsy; 03-31-2023 at 19:30.
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 04-04-2023 , 21:31   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #2

Nice idea!
I tried to use it but when i press numbers to turn On or Off, it does nothing.
And why glock is not suported?

And thank you for your time!

Last edited by MAJESTIC_SZ; 04-04-2023 at 21:31.
MAJESTIC_SZ 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 10:22.


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