Raised This Month: $ Target: $400
 0% 

What can I add to script to ignore the m3


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
smgcz
Member
Join Date: Nov 2008
Old 04-12-2009 , 15:31   What can I add to script to ignore the m3
Reply With Quote #1

HI 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 would like 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. What can I add to the script to make ignore the m3 pump shotgun.
Thank you all

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


#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_helme t", 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
}
smgcz is offline
padilha007
Senior Member
Join Date: Jul 2008
Old 04-12-2009 , 15:54   Re: What can I add to script to ignore the m3
Reply With Quote #2

PHP 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_NAMEMY_PLUGIN_VERSIONMY_PLUGIN_AUTHOR)
    
register_cvar("version_no_headshot_with_helme t"MY_PLUGIN_VERSIONFCVAR_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], fNoMonsterspentToSkipptr)
{
    
//engfunc(EngFunc_TraceLine, v1, v2, fNoMonsters, pentToSkip, ptr)

    
static iHitEntiHitEnt get_tr2(ptrTR_pHit)

    if(
<= iHitEnt <= g_iMaxPlayers)
    {
        static 
iArmor
        
static CsArmorType:tArmor
        
        iArmor 
cs_get_user_armor(iHitEnttArmor)
        
        if(
iArmor && tArmor == CS_ARMOR_VESTHELM && get_tr2(ptrTR_iHitgroup) == HIT_HEAD && get_user_weapon(iHitEnt) != CSW_M3)
        {
            
iHitEnt get_pcvar_num(g_cvarSHelmetThreshold// re-use iHitEnt
            
if(iHitEnt && iArmor >= iHitEnt)
            
iHitEnt HIT_SHIELD
            
else
            
iHitEnt HIT_GENERIC
            
            set_tr2
(ptrTR_iHitgroupiHitEnt)
        }
    }

    
//return FMRES_SUPERCEDE

__________________

padilha007 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-12-2009 , 16:00   Re: What can I add to script to ignore the m3
Reply With Quote #3

Try this version :
(You asked for m3 but not for xm1014 ;)
PHP Code:
/*    AMX Mod X script.
    
    No Headshot With Helmet plugin

    (c) Copyright 2007, Simon Logic '[email protected]'
    This file is provided AS IS (no warranties).

    Info:
        When player has a helmet he can't be killed by headshot.

    Requirements:
        * CS/CZ mod
        * AMX/X 1.7x or higher
        * CStrike module
        * Fakemeta module

    New cvars:
        * amx_superhelmet_when_armor <num> (default=0)
            set armor threshold when helmet acts as shield

    Credits:
        * Cheap_Suit for 'hitgroup 8' idea

    Changelog:
    v1.1.0 [2007-06-22]
    + added cvar 'amx_superhelmet_when_armor'
    + kevlar can act as shield (req. by Stixsmaster)
    * optimized core as XxAvalanchexX suggested (experimental)
    v1.0.0 [2007-06-14]
    * first public release
*/

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

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

#define HIT_SHIELD 8

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayers
new g_cvarSHelmetThreshold

public plugin_init()
{
    
g_iMaxPlayers get_maxplayers()

    
register_plugin(MY_PLUGIN_NAMEMY_PLUGIN_VERSIONMY_PLUGIN_AUTHOR)
    
register_cvar("version_no_headshot_with_helmet"MY_PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY)

    
g_cvarSHelmetThreshold register_cvar("amx_superhelmet_when_armor""1")

    
RegisterHam(Ham_TraceAttack"player""Player_TraceAttack")
}

public 
Player_TraceAttack(idiAttackerFloat:flDamageFloat:vecDir[3], ptriDamageType)
{
    if( 
IsPlayer(iAttacker) && get_user_weapon(iAttacker) != CSW_M3 )
    {
        new 
CsArmorType:tArmoriArmor cs_get_user_armor(idtArmor)
        if(
iArmor && tArmor == CS_ARMOR_VESTHELM    && get_tr2(ptrTR_iHitgroup) == HIT_HEAD)
        {
            
set_tr2(ptrTR_iHitgroupget_pcvar_num(g_cvarSHelmetThreshold) ? HIT_SHIELD HIT_GENERIC)
            return 
HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

__________________
- tired and retired -

- my plugins -
ConnorMcLeod is offline
smgcz
Member
Join Date: Nov 2008
Old 04-15-2009 , 01:01   Re: What can I add to script to ignore the m3
Reply With Quote #4

Awesome Ty Connor I have been trying it out on my server for the last few days and it seems to work well. I tested it out on an enemy with full kevlar and a helmet & was able to get a head shot like normal at close range. I have noticed though that the awp for some reason with the plugin in general will not from time to time register any damage from an awp when you aim for the head. I see blood, but no damage is done. Not really sure why.

I noticed you asked why I didnt have the auto shotty ignored and it got me thinking what other weapons that are low on head shots could be added to the list for this specific plugin. Is there a format based on what you wrote I can follow to say add the t & ct awp and scout? Thanks, smgcz
smgcz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-15-2009 , 01:12   Re: What can I add to script to ignore the m3
Reply With Quote #5

Not sure if I understand you correctly but this is how you can add additional weapons.

PHP Code:
public Player_TraceAttack(idiAttackerFloat:flDamageFloat:vecDir[3], ptriDamageType)
{
    new 
iWeapon get_user_weapon(iAttacker)
    
    if( 
IsPlayer(iAttacker) && ( iWeapon != CSW_M3 ) && ( iWeapon != CSW_SCOUT ) && ( iWeapon != CSW_AWP ) )
    {
        new 
CsArmorType:tArmoriArmor cs_get_user_armor(idtArmor)
        if(
iArmor && tArmor == CS_ARMOR_VESTHELM    && get_tr2(ptrTR_iHitgroup) == HIT_HEAD)
        {
            
set_tr2(ptrTR_iHitgroupget_pcvar_num(g_cvarSHelmetThreshold) ? HIT_SHIELD HIT_GENERIC)
            return 
HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

__________________

Last edited by Bugsy; 04-15-2009 at 01:14.
Bugsy is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-15-2009 , 04:00   Re: What can I add to script to ignore the m3
Reply With Quote #6

Best way (most efficient in my mind) to add weapons is to make a bitsum :

PHP Code:
const WEAPONS_BITSUM = (1<<CSW_M3)|(1<<CSW_XM1014
Then in the function make this check :

instead of
PHP Code:
if iWeapon == CSW_M3 
PHP Code:
if( WEAPONS_BITSUM & (1<<iWeapon) ) 
->
PHP Code:
public Player_TraceAttack(idiAttackerFloat:flDamageFloat:vecDir[3], ptriDamageType)
{
    if( 
IsPlayer(iAttacker) &&  WEAPONS_BS & (1<<get_user_weapon(iAttacker)) )
    {
        new 
CsArmorType:tArmoriArmor cs_get_user_armor(idtArmor)
        if(
iArmor && tArmor == CS_ARMOR_VESTHELM    && get_tr2(ptrTR_iHitgroup) == HIT_HEAD)
        {
            
set_tr2(ptrTR_iHitgroupget_pcvar_num(g_cvarSHelmetThreshold) ? HIT_SHIELD HIT_GENERIC)
            return 
HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

This way you have only 1 check in the function instead of multiples ones.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-16-2009 at 04:53.
ConnorMcLeod is offline
smgcz
Member
Join Date: Nov 2008
Old 04-15-2009 , 15:07   Re: What can I add to script to ignore the m3
Reply With Quote #7

so is this what it would look like with bitsum if I want the plugin to ignore the m3, awp, and scout?

PHP Code:
/*    AMX Mod X script.
    
    No Headshot With Helmet plugin

    (c) Copyright 2007, Simon Logic '[email protected]'
    This file is provided AS IS (no warranties).

    Info:
        When player has a helmet he can't be killed by headshot.

    Requirements:
        * CS/CZ mod
        * AMX/X 1.7x or higher
        * CStrike module
        * Fakemeta module

    New cvars:
        * amx_superhelmet_when_armor <num> (default=0)
            set armor threshold when helmet acts as shield

    Credits:
        * Cheap_Suit for 'hitgroup 8' idea

    Changelog:
    v1.1.0 [2007-06-22]
    + added cvar 'amx_superhelmet_when_armor'
    + kevlar can act as shield (req. by Stixsmaster)
    * optimized core as XxAvalanchexX suggested (experimental)
    v1.0.0 [2007-06-14]
    * first public release
*/

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

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

#define HIT_SHIELD 8

#define IsPlayer(%1)    ( 1 <= %1 <= g_iMaxPlayers )

new g_iMaxPlayers
new g_cvarSHelmetThreshold

public plugin_init()
{
    
g_iMaxPlayers get_maxplayers()

    
register_plugin(MY_PLUGIN_NAMEMY_PLUGIN_VERSIONMY_PLUGIN_AUTHOR)
    
register_cvar("version_no_headshot_with_helmet"MY_PLUGIN_VERSIONFCVAR_SERVER|FCVAR_SPONLY)

    
g_cvarSHelmetThreshold register_cvar("amx_superhelmet_when_armor""1")

    
RegisterHam(Ham_TraceAttack"player""Player_TraceAttack")
}

public 
Player_TraceAttack(idiAttackerFloat:flDamageFloat:vecDir[3], ptriDamageType)
{
    const 
WEAPONS_BITSUM = (1<<CSW_M3)|(1CSW_AWP)|(1CSW_SCOUT)
    if( 
WEAPONS_BITSUM & (1<<iWeapon) )
    if( 
IsPlayer(iAttacker) &&  WEAPONS_BS & (1<<get_user_weapon(iAttacker)) )
    {
        new 
CsArmorType:tArmoriArmor cs_get_user_armor(idtArmor)
        if(
iArmor && tArmor == CS_ARMOR_VESTHELM    && get_tr2(ptrTR_iHitgroup) == HIT_HEAD)
        {
            
set_tr2(ptrTR_iHitgroupget_pcvar_num(g_cvarSHelmetThreshold) ? HIT_SHIELD HIT_GENERIC)
            return 
HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

smgcz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-16-2009 , 00:13   Re: What can I add to script to ignore the m3
Reply With Quote #8

Are you setting cvar amx_superhelmet_when_armor to 1?

The default is 0 which will register a HIT_GENERIC (probably causing the 60 damage). Setting this to 1 will block all damage by registering a HIT_SHIELD.
__________________

Last edited by Bugsy; 04-16-2009 at 00:33.
Bugsy is offline
smgcz
Member
Join Date: Nov 2008
Old 04-16-2009 , 00:44   Re: What can I add to script to ignore the m3
Reply With Quote #9

I am sorry maybe I am not explaining this correctly. I want the plugin to do generic damage on most weapons like it was written, for the head shot. The plugin was written so that if you had a helmet and got shot in the head, it would take a few shots instead of one to kill you. I do not want the helmet to be a shield and take zero damage. Instead, I want the plugin to be ignored when some one uses the m3, scout, & awp against the enemy. Meaning if I have a helmet and get shot at close range with the m3 I get hit with 330 damage (one shot kill), instead of 60 damage as the plugin allows.
smgcz is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-07-2009 , 21:36   Re: What can I add to script to ignore the m3
Reply With Quote #10

Here is the repository of available commands: http://www.amxmodx.org/funcwiki.php

For this type of plugin I would do in a similar approach to the above plugin; use a bitsum of weapons you want available at certain kill levels. You can use the Ham_Killed forward to hook when a player is killed to check the killers kills\deaths. Since you want to ignore bomb kills you will need to keep track of a players score manually or keep track of defusals so you can subtract defusals*3 from get_user_kills(). If you need help with anything you can PM me or post here. I can write it if you don't want to.
__________________

Last edited by Bugsy; 05-07-2009 at 21:52.
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 02:26.


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