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

[CSS/CSGO] Only Headshot


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Bara
AlliedModders Donor
Join Date: Apr 2012
Location: Germany
Plugin ID:
4061
Plugin Version:
2.0.2
Plugin Category:
Gameplay
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    8 
    Plugin Description:
    Only Headshot Plugin for CSS and CSGO
    Old 01-26-2014 , 10:09   [CSS/CSGO] Only Headshot
    Reply With Quote #1

    You like this plugin or my work? Support is not a crime.

    Description:
    This is a Only Headshot Plugin for CSS and CSGO. Settings: You are able to choose what and how many weapons deal damage ( onlyhs_allow_oneweapon must be 1 ). Also there is the possibility that the weapons you have chosen are always killing with one shot.

    Supported Games:
    • Counter-Strike: Source
    • Counter-Strike: Global Offensive

    Features:
    • Only Headshot
    • One Shot
    • Damage weapons are configurable

    CVars: Enable/Disable Commands
    • onlyhs_enable - Enable / Disalbe Simple Only HeadShot Plugin (Default: 1)
    • onlyhs_oneshot - Enable / Disable kill enemy with one shot (Default: 0)
    • onlyhs_allow_weapons - Which weapon should be permitted ( Without 'weapon_' ) (Default: deagle)
    • onlyhs_allow_grenade - Enable / Disalbe Grenade Damage (Default: 0)
    • onlyhs_allow_world - Enable / Disalbe World Damge (Default: 0)
    • onlyhs_allow_knife - Enable / Disalbe Knife Damage (Default: 0)
    • onlyhs_allow_blood Enable / Disable No Blood (Default: 0)
    • onlyhs_allow_blood_splatter Enable / Disable No Blood Splatter (Default: 0)
    • onlyhs_allow_blood_splash Enable / Disable No Blood Splash (Default: 0)

    Requirements:
    • SourceMod (1.7+)

    Changelog:
    • Fixed bug with damagetype (Thanks Anjin)
    • Fixed bug with weapon string (Thanks Anjin)
    ToDo:
    • None

    Known Issues:
    • None

    Thanks to:
    Download:
    https://github.com/Bara/OnlyHS
    Attached Files
    File Type: sp Get Plugin or Get Source (onlyhs.sp - 8307 views - 6.9 KB)
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.

    Last edited by Bara; 12-12-2021 at 15:00. Reason: Updated Plugin to Version 2.0.2
    Bara is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 01-26-2014 , 16:58   Re: Simple Only Headshot
    Reply With Quote #2

    Changelog - 1.2.0
    • Added Team Fortress 2 Support ( not tested )
    • Added Day of Defeat: Source Support ( not tested )
    • Added Grenade Damage Support
    • Added Melee Damage Support
    • Added World Damage Support ( not tested )
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.
    Bara is offline
    Root_
    Veteran Member
    Join Date: Jan 2012
    Location: ryssland
    Old 01-26-2014 , 19:06   Re: [ANY] Simple Only Headshot
    Reply With Quote #3

    Nice plugin!
    I have some recommendations about the code.
    1) At first dont use GetGameFolderName to detect game, use GetEngineVersion() instead (or this stock).
    2) Then OnPluginStart at line 70 add IsClientInGame(i), otherwise you may have some errors if no players on a server and you decided to reload plgin.
    3) TraceAttack differs from OnTakeDamage not only by different parameters, but also it can make bullets go through player - this way you should return Plugin_Handled instead of doing damage = 0.0 and returning Plugin_Changed.
    4) You can ignore weapon_ prefix due to performance purposes using this way
    Code:
    if(StrEqual(weapon[7], "knife"))
    Or for TF2 use this
    Code:
    if(StrEqual(weapon[10], "bat")
    Or you can try to check if (inflictor == GetPlayerWeaponSlot(attacker, 2)), which is melee weapon and not compare melee classnames at all.
    5) Use global strings for weapons instead of declaring it all the time from ConVar within TraceAttack hook.
    6) For DoD:S you can add one more melee weapon: weapon_punch.
    7) At line 214 use damage = float(GetClientHealth(victim)) instead of current one.
    __________________


    dodsplugins.com - Plugins and Resources for Day of Defeat
    http://twitch.tv/zadroot
    Root_ is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 01-26-2014 , 20:23   Re: [ANY] Simple Only Headshot
    Reply With Quote #4

    Thanks, Root_!
    I update this plugin in the next hours / days.
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.
    Bara is offline
    Root_
    Veteran Member
    Join Date: Jan 2012
    Location: ryssland
    Old 01-27-2014 , 02:58   Re: [ANY] Simple Only Headshot
    Reply With Quote #5

    Bara I forgot to note that grenades damage cannot be changed in TraceAttack hook, it fires only when grenade collides with a player, so you should add OnTakeDamage hook or dont use grenades at all.
    __________________


    dodsplugins.com - Plugins and Resources for Day of Defeat
    http://twitch.tv/zadroot
    Root_ is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 02-01-2014 , 11:04   Re: [CSS/CSGO] Only Headshot
    Reply With Quote #6

    Changelog - 1.3.0:
    • Removed Team Fortress 2 Support ( No time for this )
    • Removed Day of Defeat: Source Support ( No time for this )
    • Code Optimization ( Thanks: Root_ and Peace-Maker)
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.
    Bara is offline
    Peace-Maker
    SourceMod Plugin Approver
    Join Date: Aug 2008
    Location: Germany
    Old 02-02-2014 , 16:51   Re: [CSS/CSGO] Only Headshot
    Reply With Quote #7

    Looks good. Let's hope that (1<<30) damage bit is really only used for headshot damage in cstrike
    __________________
    Peace-Maker is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 02-02-2014 , 17:01   Re: [CSS/CSGO] Only Headshot
    Reply With Quote #8

    Quote:
    Originally Posted by Peace-Maker View Post
    Looks good. Let's hope that (1<<30) damage bit is really only used for headshot damage in cstrike
    Thanks!

    Changelog - 1.3.1:
    • Removed SDHKUnhook
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.
    Bara is offline
    nguyenbaodanh
    AlliedModders Donor
    Join Date: Jun 2007
    Location: HCMC, Vietnam
    Old 02-20-2014 , 02:25   Re: [CSS/CSGO] Only Headshot
    Reply With Quote #9

    I put in plugin.hsonly.cfg
    Quote:
    onlyhs_allow_weapon "ak47;m4a1;m4a1_silencer;sg556;aug;galilar;fa mas;ssg08;awp;p90;nova;xm1014;sawedoff;mag7;g 3sg1;scar20;glock;p250;cz75a;usp_silencer;fiv eseven;deagle;elite;tec9;hkp2000"
    I want to allow those guns ,is this setting correct ? 'cos it not working on my server
    __________________

    Last edited by nguyenbaodanh; 02-20-2014 at 02:25.
    nguyenbaodanh is offline
    Bara
    AlliedModders Donor
    Join Date: Apr 2012
    Location: Germany
    Old 02-20-2014 , 08:18   Re: [CSS/CSGO] Only Headshot
    Reply With Quote #10

    Quote:
    Originally Posted by nguyenbaodanh View Post
    I put in plugin.hsonly.cfg

    I want to allow those guns ,is this setting correct ? 'cos it not working on my server
    Use this:
    onlyhs_oneweapon 0 (Enable / Disalbe Only One Weapon Damage)
    __________________
    Discord (Bara#5006) | My Plugins (GitHub)
    You like my work? Support is not a crime.
    Bara 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 00:52.


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