Raised This Month: $ Target: $400
 0% 

[ANY] Bullet Penetration Filter (1.3)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Plugin ID:
3379
Plugin Version:
1.3
Plugin Category:
Gameplay
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Allows server administrators to define bullet penetration rules.
    Old 11-22-2012 , 11:46   [ANY] Bullet Penetration Filter (1.3)
    Reply With Quote #1

    Bullet Penetration Filter

    Version 1.3 (final)


    Table of Contents
    ----------------------------------------------------
    Description
    Commands and Cvars
    Installation
    Dependencies
    Changelog
    Notes
    Download


    Description
    ----------------------------------------------------
    Allows server administrators to define bullet penetration rules.
    Bullets are prevented from penetrating certain entities.


    Commands and Cvars
    ----------------------------------------------------
    Cvars
    sm_penetration_version Plugin version.
    sm_penetration_players (Default 1) Determines which players bullets can penetrate (0 - any players, 1 - only enemies, 2 - only teammates, 3 - no players)
    sm_penetration_geometry (Default 1) Determines whether bullets can penetrate geometry and props (0 - no penetration, 1 - regular penetration)


    Installation
    ----------------------------------------------------
    Place bulletpenetrationfilter.smx into the server's /addons/sourcemod/plugins/ directory.


    Dependencies
    ----------------------------------------------------
    SDKHooks must be installed.


    Changelog
    ----------------------------------------------------
    Spoiler
    • Version 1.3 (27 November 2012)
      -Bug fix: Plugin now blocks damage correctly in the case where a bullet penetrates a non-player entity and continues to penetrate through one or more players.
      -Non-player entity penetration and player penetration are now tracked independently.
      -Added convar sm_penetration_geometry to determine bullet penetration through non-player entities.
      -Changed name of player filter convar to sm_penetration_players for consistency.


    Notes
    ----------------------------------------------------
    -The rationale of the plugin is to prevent players from shooting through their teammates when FF is off. This negates the cheap tactic of using your teammates as human shields.


    Download
    ----------------------------------------------------
    Attached Files
    File Type: sp Get Plugin or Get Source (bulletpenetrationfilter.sp - 1468 views - 6.3 KB)
    File Type: smx bulletpenetrationfilter.smx (4.5 KB, 885 views)
    __________________

    Last edited by Sheepdude; 11-27-2012 at 07:25. Reason: version 1.3
    Sheepdude is offline
    thetwistedpanda
    Good Little Panda
    Join Date: Sep 2008
    Old 11-22-2012 , 13:50   Re: [ANY] Bullet Penetration Filter (1.0)
    Reply With Quote #2

    Interesting method! It appears that it would be fairly trivial to also add support in for blocking damage for bullets that have penetrated corners of buildings or thin walls, if you were interested. Also, OnTakeDamage needs only to be hooked once within OnClientPutInServer.
    __________________

    Last edited by thetwistedpanda; 11-22-2012 at 13:51.
    thetwistedpanda is offline
    Leonardo
    Veteran Member
    Join Date: Feb 2010
    Location: 90's
    Old 11-22-2012 , 14:07   Re: [ANY] Bullet Penetration Filter (1.0)
    Reply With Quote #3

    Quote:
    Originally Posted by thetwistedpanda View Post
    Also, OnTakeDamage needs only to be hooked once within OnClientPutInServer.
    and OnPluginStart/OnMapStart (in case of late-load)
    __________________
    Leonardo is offline
    thetwistedpanda
    Good Little Panda
    Join Date: Sep 2008
    Old 11-22-2012 , 14:10   Re: [ANY] Bullet Penetration Filter (1.0)
    Reply With Quote #4

    Quote:
    Originally Posted by Leonardo View Post
    and OnPluginStart/OnMapStart (in case of late-load)
    Or just check in OnPluginsLoad2 for a late load scenario ;3.
    __________________
    thetwistedpanda is offline
    minimoney1
    SourceMod Donor
    Join Date: Dec 2010
    Old 11-22-2012 , 14:25   Re: [ANY] Bullet Penetration Filter (1.0)
    Reply With Quote #5

    Quote:
    Originally Posted by thetwistedpanda View Post
    Or just check in OnPluginsLoad2 for a late load scenario ;3.
    Rant:

    AskPluginLoad2(), you mean?
    __________________
    Need help? PM me or add me on Steam.
    My Steam




    Quote:
    Originally Posted by Rp.KryptoNite View Post
    For some reason his Plugin never worked for me ,
    @credits were added
    im not stealing any plugins dude its my THING

    Last edited by minimoney1; 11-22-2012 at 19:41.
    minimoney1 is offline
    Sheepdude
    SourceMod Donor
    Join Date: Aug 2012
    Location: Chicago
    Old 11-22-2012 , 20:15   Re: [ANY] Bullet Penetration Filter (1.0)
    Reply With Quote #6

    Should I unhook the players OnDisconnect too?
    __________________
    Sheepdude is offline
    thetwistedpanda
    Good Little Panda
    Join Date: Sep 2008
    Old 11-22-2012 , 20:23   Re: [ANY] Bullet Penetration Filter (1.0)
    Reply With Quote #7

    Negative, SDKHooks does this automatically.
    __________________
    thetwistedpanda is offline
    Sheepdude
    SourceMod Donor
    Join Date: Aug 2012
    Location: Chicago
    Old 11-23-2012 , 01:17   Re: [CS:GO] Bullet Penetration Filter (1.1)
    Reply With Quote #8

    Thanks for the feedback, I did what you guys suggested and uploaded it as "oldbulletpenetrationfilter.sp". Unfortunately the traceray solution had a couple problems which I couldn't remedy, one of which being that if the first player to be shot died, the traceray wouldn't be able to detect them and would think the second player was not being hit by a penetrating bullet. The second issue was that it was impossible to deal with bullet spread.

    When I started thinking about how to fix the first problem, I realized my solution didn't need tracerays at all. So here you go. This solution still has problems with shotguns, though.

    New Version
    • Version 1.1 (22 November 2012)
      -Plugin no longer uses tracerays to determine penetration. As a result:
      -Bug fix: Weapon spread is no longer an issue.
      -Bug fix: Penetration rules work as intended if the first player to get shot dies.
      -Plugin no longer affects bullet penetration through world entities and non-player entities.
      -Added convar sm_penetration_shotguns as a workaround for an introduced issue:
      -Known issue: Shotgun spread which hits multiple players may not work as intended. Use sm_penetration_shotguns 0 to fix this.
      -Plugin is now specific to CS:GO.
    __________________
    Sheepdude is offline
    RedSword
    SourceMod Plugin Approver
    Join Date: Mar 2006
    Location: Quebec, Canada
    Old 11-24-2012 , 04:19   Re: [CS:GO] Bullet Penetration Filter (1.1)
    Reply With Quote #9

    Just for your next update and code consistency, I suggest you put an "else" on L85, since you did put one on L94.

    And the no-TR version surprises me a bit... if I got it right, OnTakeDamage is executed multiple times, for every hit player, in the order the bullet goes through, right ?

    Cool thing.
    __________________
    My plugins :
    Red Maze
    Afk Bomb
    RAWR (per player/rounds Awp Restrict.)
    Kill Assist
    Be Medic

    You can also Donate if you appreciate my work

    Last edited by RedSword; 11-24-2012 at 04:24.
    RedSword is offline
    Sheepdude
    SourceMod Donor
    Join Date: Aug 2012
    Location: Chicago
    Old 11-24-2012 , 04:54   Re: [CS:GO] Bullet Penetration Filter (1.2)
    Reply With Quote #10

    Quote:
    Originally Posted by RedSword View Post
    Just for your next update and code consistency, I suggest you put an "else" on L85, since you did put one on L94.

    And the no-TR version surprises me a bit... if I got it right, OnTakeDamage is executed multiple times, for every hit player, in the order the bullet goes through, right ?

    Cool thing.
    Funny you say that. Yes, that's how it works - I came up with the idea when I was trying to solve the problem of the "disappearing obstruction" - that is, if a player that WOULD have been in the way dies, the traceray didn't detect that anything was in the way, because the player had already died by the time OnTakeDamage was called for the second player.

    HOWEVER. Completely eliminating tracerays did more harm than good. Since OnTakeDamage isn't called if players don't take damage, not using tracerays means that players who don't take damage (but are still in the way) aren't account for, such as friendlies when ff is off. And since the entire point of the plugin was to PREVENT bullets from going through friendlies, ESPECIALLY when friendly fire is off, I ended up removing the very feature I was trying to program!

    So I went back to the traceray method, but I still had to deal with the "disappearing obstruction", so I had to do two tracerays, one from the attacker to the victim, and another from the attacker BEYOND the victim, to see if anyone beyond the victim had the potential to get hurt by penetrating bullets.

    tl;dr I think I fixed the issues with the plugin. I'm still confused by the order in which damage from shotgun bullets fire, but the way I've coded it -should- account for multiple shotgun bullets penetrating, even if the player dies and those bullets intend to hit a second player.

    New Version
    • Version 1.2 (24 November 2012)
      -Reverted to traceray method, with bullet spread accounted for. As a result:
      -Bug fix: Previously, bullets would still penetrate players that were in the way but didn't take damage (such as friendlies with ff off).
      -Bug fix: Shotgun damage is handled correctly.
      -Plugin can now account for penetration through geometry and non-player entities.
      -Plugin now works on any mod.

    This plugin has been very trial-and-error for me. It's definitely tested and working, although it is quite difficult to thoroughly test the shotgun bullets (since there are three categories - bullets that hit player 1, bullets that hit player 2, and bullets that hit player 1 and pass through to player 2, further complicated by the fact that if player 1 dies in the process, he is no longer a traceray obstruction for player 2). I'll just have to have faith that it works as intended.
    __________________
    Sheepdude is offline
    Reply


    Thread Tools
    Display Modes

    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 19:01.


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