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
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-04-2023 , 22:26   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #3

Are you using number key pad or the numbers above your alphabet keys?

Glock works
__________________
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 04-05-2023 , 17:30   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #4

I tried both keypads and nothing mate.
Only the numbers above my alphabet keys do something:
Key 1 does nothing, key 2 changes option 1.
Key 3 does nothing, key 4 changes option 3.
From here forward, no key work, only page next and pager after keys work.
MAJESTIC_SZ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-05-2023 , 18:14   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #5

I'm not sure what your issue is. When I open the menu it shows the below options and all keys (1-7) toggle the respective weapon.

1. p28
2. scout
3. xm1014
4. mac10
5. aug
6. elite
7. fiveseven

8. Back
9. More
0. Exit
__________________
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 04-05-2023 , 18:19   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #6

Quote:
Originally Posted by Bugsy View Post
I'm not sure what your issue is. When I open the menu it shows the below options and all keys (1-7) toggle the respective weapon.

1. p28
2. scout
3. xm1014
4. mac10
5. aug
6. elite
7. fiveseven

8. Back
9. More
0. Exit
For example:
When i press 1 for p28, it stays OFF.
If i press 2 (scout key), it changes p28 to ON.
MAJESTIC_SZ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-05-2023 , 18:21   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #7

I understand what is happening/what you experience is, what I meant is I do not understand why it works perfectly for me but not for you. Can someone else try running it and report back?
__________________

Last edited by Bugsy; 04-05-2023 at 18:22.
Bugsy is offline
MAJESTIC_SZ
Senior Member
Join Date: Mar 2020
Location: Portugal
Old 04-05-2023 , 18:24   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #8

Using rehlds + amx10 have anything to do with it?
(latest builds)

Last edited by MAJESTIC_SZ; 04-05-2023 at 18:25.
MAJESTIC_SZ is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-05-2023 , 18:29   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #9

It shouldn't, this is a very basic plugin/menu system. Do menus from other plugins work normally?
__________________
Bugsy is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-05-2023 , 18:32   Re: [REQUEST] 1 Headshot = 1 Kill
Reply With Quote #10

Any errors?
__________________
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 10:22.


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