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

[CS:S | CS:GO] KDR Weapon Limit


Post New Thread Reply   
 
Thread Tools Display Modes
Author
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Plugin ID:
3613
Plugin Version:
1.0.0.2a
Plugin Category:
General Purpose
Plugin Game:
Counter-Strike: Source
Plugin Dependencies:
    Servers with this Plugin:
    4 
    Plugin Description:
    Restrict players from weapons when they reach a certain KDR
    Old 04-10-2013 , 23:46   [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #1

    DESCRIPTION:
    This plugin is a fairly configurable weapon restriction plugin based on Kill:Death Ratio (KDR). There are 2 different levels of KDR you can set along with two corresponding CVars to list the restricted weapons for each of those levels.

    You can set the restriction to take affect the moment the player exceeds your set KDR values, or have it set the restriction the next time they spawn.

    You can define the primary and secondary replacement weapons for each level of the KDR or use "none" to not give any replacements and just have the player drop the weapon.

    This plugin has the option to maintain the restrictions even if the player disconnects and reconnects to attempt to circumvent the restriction. It is reset on map change.

    If you desire, you can utilize the built in immunity. By default, immunity to this plugin is off. You can also override the default admin flag of "t" by overriding the command "no_kdr_restrict" to whatever it is you want.

    You can also count bot kills towards a player's KDR or not.

    CVars


    REQUIREMENTS:
    SourceMod Version: 1.5.0-dev+3765
    SDKHooks (latest version of 1.5 comes with SDKHooks)

    Optional:
    Updater

    INSTALLATION AND NOTES:
    1. Put .smx file in your sourcemod/plugins folder
    2. Put the phrases.txt files in your sourcemod/translations folder
    3. Restart your server and edit the config file created in cfg/sourcemod named plugin.kdr_weapon_limit.cfg then restart the plugin (or better server) if you make changes.

    CREDITS:
    The following people helped alpha and beta test this and many thanks for bearing with the errors and left over debug junk:
    Noitartsiger
    pubhero
    They also helped provide the other translation language files


    Change Log
    Attached Files
    File Type: zip KDR Weapon Limit 1.0.0.2a.zip (30.6 KB, 818 views)
    __________________
    View my Plugins | Donate

    Last edited by TnTSCS; 03-31-2015 at 08:47.
    TnTSCS is offline
    Noitartsiger
    Member
    Join Date: Jul 2011
    Old 04-11-2013 , 05:51   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #2

    Thanks a lot for this great plugin

    But I found 2 malfunctions yet:

    - again the calculation issue:
    Quote:
    [SM] Your KDR (1.60) is above the allowed limit (2.00) and you can no longer buy/use these weapons: awp sg550 g3sg1 m4a1 ak47
    It happened after I reached sm_kdrwl_minkills. But can also be a general issue. I played with bots.

    - when I reach sm_kdrwl_minkills and my KDR is between limit 1 and 2, it brings the message "off some":
    Quote:
    [SM] Your KDR 2.33 is below the second limit now. You are still restricted for: awp sg550 g3sg1
    This message should pop up only when player was above limit 2 once and then drops below.
    When the player is between limit 1 and 2 after minkills, it brings the appropriate message anyways (what is correct):
    Quote:
    [SM] Your KDR (2.33) is above the allowed limit (2.00) and you can no longer buy/use these weapons: awp sg550 g3sg1
    As long as there is this calculation issue, I cannot test it on productive server.


    Last edited by Noitartsiger; 04-11-2013 at 05:52.
    Noitartsiger is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 04-11-2013 , 10:20   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #3

    that's not a calculation issue - I'll look through the code. I think you were probably above the 2nd limit, but hadn't yet reached the minkills, then when you reached the min kills you had fallen below the 2nd limit which is why it gave you the "Off some" message...

    I'll post an update when I fix it.

    ...:: TnT Edit ::...
    In briefly looking through the code, it shouldn't have given you that message. Can you give me your CVar settings and I'll try to reproduce it with the _DEBUG version to see what I can see.
    __________________
    View my Plugins | Donate

    Last edited by TnTSCS; 04-11-2013 at 11:22.
    TnTSCS is offline
    Noitartsiger
    Member
    Join Date: Jul 2011
    Old 04-11-2013 , 17:54   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #4

    Well those are 2 different things:
    - the calculation issue (1.6 is above 2.0) and
    - the wrong message ('below second limit now' although beeing between 1 and 2 after minkills).
    (for the second: yes, that might be possible, that I was over second limit before I reached minkills)

    Another thing:
    - shouldn't it be that it starts restriction when 'over' a limit, not on the limit value itself already? E.g. at the moment it restricts already on 2.00 (if limit is 2.00), but it should start to restrict on 2.01 actually, no?

    Here my config:

    Quote:
    // Announce to all players when a player gets restricted
    // 1 = Yes
    // 0 = No.
    // -
    // Default: "0"
    sm_kdrwl_announce "1"

    // Ignore bot kills towards players KDR?
    // 0 = No, count with KDR
    // 1 = Yes, do not count with KDR.
    // -
    // Default: "0"
    sm_kdrwl_botkills "0"

    // When should player be forced to drop restricted weapon?
    // 1 = Immediately
    // 2 = Beginning of next round.
    // -
    // Default: "2"
    sm_kdrwl_drop "2"

    // Is plugin enabled?
    // 0 = No
    // 1 = Yes
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    sm_kdrwl_enabled "1"

    // Maintain restrictions until map changes?
    // If set to no (0) then players can just reconnect to be able to purchase restricted weapons again.
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    sm_kdrwl_maintain "1"

    // Minimum number of kills required to start counting KDR.
    // 0 = disabled, count KDR right away
    // N = Number of kills required before counting KDR
    // -
    // Default: "0"
    sm_kdrwl_minkills "10"

    // List the primary weapon to give the player if the reach ratio1 and are forced to drop their weapon
    // -
    // Default: "weapon_scout"
    sm_kdrwl_pw1 ""

    // List the primary weapon to give the player if the reach ratio2 and are forced to drop their weapon
    // -
    // Default: "weapon_scout"
    sm_kdrwl_pw2 ""

    // KDR Ratio a player must meet before stage 1 weapon limit is enforced against them.
    // -
    // Default: "3.0"
    sm_kdrwl_ratio1 "2.0"

    // KDR Ratio a player must meet before stage 2 weapon limit is enforced against them.
    // -
    // Default: "5.0"
    sm_kdrwl_ratio2 "3.0"

    // List the weapons a player cannot use once they've reached the ratio1 limit
    // -
    // Default: "awp sg550 g3sg1"
    sm_kdrwl_rw1 "awp scout m249 ak47 m4a1 sg552 aug m3 xm1014 p90"

    // List the weapons a player cannot use once they've reached the ratio2 limit
    // -
    // Default: "awp sg550 g3sg1 m4a1 ak47 deagle"
    sm_kdrwl_rw2 "awp scout m249 ak47 m4a1 sg552 aug galil famas m3 xm1014 p90 mp5navy ump45 deagle"

    // Path and file name of sound file to use for restriction sound relative to sound folder.
    // -
    // Default: "buttons/weapon_cant_buy.wav"
    sm_kdrwl_sound "buttons/weapon_cant_buy.wav"

    // List the secondary weapon to give the player if the reach ratio1 and are forced to drop their pistol
    // -
    // Default: "weapon_p228"
    sm_kdrwl_sw1 ""

    // List the secondary weapon to give the player if the reach ratio2 and are forced to drop their pistol
    // -
    // Default: "weapon_p228"
    sm_kdrwl_sw2 "weapon_p228"

    // Use the exemption system?.
    // -
    // Default: "0"
    sm_kdrwl_useexempt "0"

    // Play sound to player when they reach KDR and are forced to drop their weapon?
    // 0 = No
    // 1 = Yes
    // -
    // Default: "1"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    sm_kdrwl_usesound "1"

    // Utilize 'Updater' plugin to auto-update this plugin when updates are published?
    // 1 = Yes, 0 = No
    // -
    // Default: "0"
    // Minimum: "0.000000"
    // Maximum: "1.000000"
    sm_kdrwl_useupdater "0"

    // Automatically have client switch to replacement weapon when given?
    // 1 = Yes
    // 0 = No.
    // -
    // Default: "0"
    sm_kdrwl_weaponswitch "0"

    Last edited by Noitartsiger; 04-11-2013 at 17:55.
    Noitartsiger is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 04-11-2013 , 18:01   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #5

    Thanks for the config - Before posting this version, I changed it to restrict if "over" the set limit... before 1.0.0.0 it was restricting when at the limit.

    I'll look at the code tonight and work on the onSpawn drop mode. I only tested with drop immediate mode.

    ...:: TnT Edit ::...

    As for the sm_kdrwl_pw2/1 and sm_kdrwl_sw2/1, use "none" if you don't want to give a weapon. I'll update the description of those CVars to indicate that.
    __________________
    View my Plugins | Donate

    Last edited by TnTSCS; 04-11-2013 at 18:02.
    TnTSCS is offline
    pubhero
    Veteran Member
    Join Date: Aug 2012
    Location: Central Europe
    Old 04-13-2013 , 06:50   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #6

    Quote:
    Originally Posted by Noitartsiger View Post
    Here my config:
    - If i know well, the scoreboard show for you, but the plugin does not counting the bomb plant/defuse +3 points and the bot kill points.
    Maybe this is the answer.

    Last edited by pubhero; 04-13-2013 at 06:53.
    pubhero is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 04-13-2013 , 11:10   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #7

    in the bomb plant/defuse events, I add those to special points for the client, then subtract those points from the client's frag count to get a true frag count, then calculate the KDR.

    pubhero, do you also see the 1.60 is above 2.00 and get restricted?
    __________________
    View my Plugins | Donate
    TnTSCS is offline
    pubhero
    Veteran Member
    Join Date: Aug 2012
    Location: Central Europe
    Old 04-13-2013 , 11:18   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #8

    No. I see sometimes "16:0 / 16:1 and no weapon restriction" case.
    But i think, these stats all come from many bomb plantings / defuses 3 points.
    So i have no problem. I use an other plugin too, who ban the player for 15 minutes above the 16x stats.

    Last edited by pubhero; 04-13-2013 at 11:19.
    pubhero is offline
    TnTSCS
    AlliedModders Donor
    Join Date: Oct 2010
    Location: Undisclosed...
    Old 04-13-2013 , 11:19   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #9

    I'll be testing this later today after all of my RL stuff is done
    __________________
    View my Plugins | Donate
    TnTSCS is offline
    Noitartsiger
    Member
    Join Date: Jul 2011
    Old 04-13-2013 , 11:26   Re: [CS:S | CS:GO] KDR Weapon Limit
    Reply With Quote #10

    The calculation issue happened on a cs_assault, so there weren't any bomb/defuse points.
    I will test it again tomorrow and will log how the kill/death changed from first round until the miscalculation.
    sm_kdrwl_minkills was "5" when it happened, everything else was like in the config above.
    Noitartsiger 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 15:41.


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