Raised This Month: $ Target: $400
 0% 

Ignoring a weapon for a plugin


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
smgcz
Member
Join Date: Nov 2008
Old 01-05-2009 , 17:50   Ignoring a weapon for a plugin
Reply With Quote #1

Hello everyone, over a month ago I found this plugin called no_hs_with_helmet.amxx written by Simon Logic. I have been using it on my cz server, but one thing I have not been able to figure out, is how to get the no_hs_with_helmet.amxx plugin to ignore the m3 pump shotgun. I searched the archives here and have not been able to figure out a solution. I also asked on simon logic's post for the no_hs_with_helmet.amxx plugin over a month ago, but he has not responded. In a nutshell, I want the plugin to ignore the damage the m3 pump shotgun does when it hits the head. Ie. the shotgun could do a headshot normally, while the rest of the weapons in the game are under the control of no_hs_with_helmet.amxx plugin.

For those of you not familiar with the script I will paste it below. Any help is greatly appreciated

Code:
#include <amxmodx>
#include <fakemeta>
#include <cstrike>

#define MY_PLUGIN_NAME    "No Headshot With Helmet"
#define MY_PLUGIN_VERSION "1.1.0"
#define MY_PLUGIN_AUTHOR  "Simon Logic"

#define HIT_SHIELD 8

new g_iMaxPlayers
new g_cvarSHelmetThreshold

public plugin_init()
{
    g_iMaxPlayers = get_maxplayers()

    register_plugin(MY_PLUGIN_NAME, MY_PLUGIN_VERSION, MY_PLUGIN_AUTHOR)
    register_cvar("version_no_headshot_with_helmet", MY_PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)

    g_cvarSHelmetThreshold = register_cvar("amx_superhelmet_when_armor", "0")

    //register_forward(FM_TraceLine, "onTraceLine")
    register_forward(FM_TraceLine, "onTraceLinePost", 1)
}

public onTraceLinePost(Float:v1[3], Float:v2[3], fNoMonsters, pentToSkip, ptr)
{
    //engfunc(EngFunc_TraceLine, v1, v2, fNoMonsters, pentToSkip, ptr)
    
    static iHitEnt; iHitEnt = get_tr2(ptr, TR_pHit)
    
    if(1 <= iHitEnt <= g_iMaxPlayers)
    {
        static iArmor
        static CsArmorType:tArmor
        
        iArmor = cs_get_user_armor(iHitEnt, tArmor)
        
        if(iArmor > 0 && tArmor == CS_ARMOR_VESTHELM
        && get_tr2(ptr, TR_iHitgroup) == HIT_HEAD)
        {
            iHitEnt = get_pcvar_num(g_cvarSHelmetThreshold) // re-use iHitEnt
            if(iHitEnt > 0 && iArmor >= iHitEnt)
                iHitEnt = HIT_SHIELD
            else
                iHitEnt = HIT_GENERIC
            
            set_tr2(ptr, TR_iHitgroup, iHitEnt)
        }
    }

    //return FMRES_SUPERCEDE
}

.

Last edited by smgcz; 01-05-2009 at 17:54.
smgcz is offline
 



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 09:11.


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