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

Edit the Headshot Only Plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Preetham_sai
New Member
Join Date: Dec 2020
Old 12-01-2020 , 05:59   Edit the Headshot Only Plugin
Reply With Quote #1

Hey. So what this plugin does is simple. With all the weapons, except the knife, you can hit headshots only. And with knife you can attack anywhere on the body like normal.

But I do not want headshot only mode to be in effect when the player is using AWP and Scout, just like knife.

I request you coders to do this.

The plugin I am attaching is made by Dores and I own nothing.

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

#define PLUGIN "HeadShot Only"
#define VERSION "1.2a"
#define AUTHOR "Dores"

#define USAGE    " 1 (on) or 0 (off)"

new HamHook:fw_TraceAttack;
new 
g_iMaxPlayers;
new 
p_knifep_team[3];

_Un_RegisterHamForwards(on 0)
{
    
on EnableHamForward(fw_TraceAttack) : DisableHamForward(fw_TraceAttack);
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
fw_TraceAttack RegisterHam(Ham_TraceAttack"player""Forward_TraceAttack");
    
register_clcmd("amx_hsonly""Cmd_ToggleHS"ADMIN_ADMINUSAGE);
    
g_iMaxPlayers get_maxplayers();
    
p_knife register_cvar("hsonly_knife""0");
    
p_team[1] = register_cvar("hsonly_t""1");
    
p_team[2] = register_cvar("hsonly_ct""1");
}

public 
Forward_TraceAttack(idattackerFloat:dmgFloat:dir[3], trdmgbit)
{
    if(
id != attacker && get_tr2(trTR_iHitgroup) != HIT_HEAD && get_pcvar_num(p_team[get_user_team(id)]))
    {
        if(
<= attacker <= g_iMaxPlayers)
        {
            if(!
get_pcvar_num(p_knife) && get_user_weapon(attacker) == CSW_KNIFE)
            {
                return 
HAM_IGNORED;
            }
            
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED;
}

public 
Cmd_ToggleHS(id)
{
    if(
read_argc() < 2)
    {
        
console_print(idUSAGE);
        return 
PLUGIN_HANDLED;
    }
    
    static 
arg[2] ; read_argv(1argcharsmax(arg));
    static 
val val str_to_num(arg);
    
_Un_RegisterHamForwards(val);
    
client_print(0print_chat"[AMXX] HeadShot Only mode is %s!"val "ON" "OFF");
    return 
PLUGIN_HANDLED;
}

public 
client_putinserver(id)
{
    
set_hudmessage(42255420.110.2206.012.0);
    
show_hudmessage(id"This server is using the HS Only plugin^nVersion %s"VERSION);

Preetham_sai is offline
ho83
Senior Member
Join Date: Aug 2020
Location: iran
Old 12-01-2020 , 08:27   Re: Edit the Headshot Only Plugin
Reply With Quote #2

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

#define PLUGIN "HeadShot Only"
#define VERSION "1.2a"
#define AUTHOR "Dores"

#define USAGE    " 1 (on) or 0 (off)"

new HamHook:fw_TraceAttack;
new 
g_iMaxPlayers;
new 
p_knifep_team[3];
new 
p_awp
new p_scout
_Un_RegisterHamForwards
(on 0)
{
    
on EnableHamForward(fw_TraceAttack) : DisableHamForward(fw_TraceAttack);
}

public 
plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
fw_TraceAttack RegisterHam(Ham_TraceAttack"player""Forward_TraceAttack");
    
register_clcmd("amx_hsonly""Cmd_ToggleHS"ADMIN_ADMINUSAGE);
    
g_iMaxPlayers get_maxplayers();
    
p_scout register_cvar("hsonly_scout""0");      
    
p_awp register_cvar("hsonly_awp""0");    
    
p_knife register_cvar("hsonly_knife""0");
    
p_team[1] = register_cvar("hsonly_t""1");
    
p_team[2] = register_cvar("hsonly_ct""1");
}

public 
Forward_TraceAttack(idattackerFloat:dmgFloat:dir[3], trdmgbit)
{
    if(
id != attacker && get_tr2(trTR_iHitgroup) != HIT_HEAD && get_pcvar_num(p_team[get_user_team(id)]))
    {
        if(
<= attacker <= g_iMaxPlayers)
        {
            if(!
get_pcvar_num(p_scout) && get_user_weapon(attacker) == CSW_SCOUT)
            {
                return 
HAM_IGNORED;
            }        
            if(!
get_pcvar_num(p_awp) && get_user_weapon(attacker) == CSW_AWP)
            {
                return 
HAM_IGNORED;
            }        
            if(!
get_pcvar_num(p_knife) && get_user_weapon(attacker) == CSW_KNIFE)
            {
                return 
HAM_IGNORED;
            }
            
            return 
HAM_SUPERCEDE;
        }
    }
    
    return 
HAM_IGNORED;
}

public 
Cmd_ToggleHS(id)
{
    if(
read_argc() < 2)
    {
        
console_print(idUSAGE);
        return 
PLUGIN_HANDLED;
    }
    
    static 
arg[2] ; read_argv(1argcharsmax(arg));
    static 
val val str_to_num(arg);
    
_Un_RegisterHamForwards(val);
    
client_print(0print_chat"[AMXX] HeadShot Only mode is %s!"val "ON" "OFF");
    return 
PLUGIN_HANDLED;
}

public 
client_putinserver(id)
{
    
set_hudmessage(42255420.110.2206.012.0);
    
show_hudmessage(id"This server is using the HS Only plugin^nVersion %s"VERSION); 
ho83 is offline
Preetham_sai
New Member
Join Date: Dec 2020
Old 12-01-2020 , 09:10   Re: Edit the Headshot Only Plugin
Reply With Quote #3

Thanks a lot ho83! Will test and let you know asap.
Preetham_sai 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 14:44.


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