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

[TF2] Anti Class-Leader


Post New Thread Reply   
 
Thread Tools Display Modes
Author
BonzaiRob
Junior Member
Join Date: Mar 2009
Plugin ID:
792
Plugin Version:
1
Plugin Category:
Server Management
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Prevents specified class from staying top of leaderboard per team.
    Old 03-02-2009 , 17:44   [TF2] Anti Class-Leader
    Reply With Quote #1

    Hi there, this is my first plugin. I wrote it for my clan's server, where we usually play dm_duel_v2; if you've ever been on the map, it's Sniper heaven, which gets annoying for everyone else. Clan Leader has limited Snipers to one per team, but what happens then is one player hogs the class and ends up with 100 more points than anyone else. So, at clan request, I wrote this, so we get some rotation on the class.

    UPDATE March 4 09: On player spawn, change team or change class, the plugin checks if the player is top of the leader board on his team (by points), and if he is, prevents him from choosing the specified class. When the leader dies, he will be forced to change class.
    Changed from just Sniper to all classes.

    Cvars:
    sm_anticlassleader_enabled: 0 or 1, default 1. Whether the plugin is active or not.
    sm_anticlassleader_immunity: 0 or 1, default 0. Whether admins/flagged are immune to the plugin or not.
    sm_anticlassleader_class: 1 to 9, default 8. The number of the class to block from leading. (8 = Sniper)

    Bugs:
    If two players have equal points, both of them will be able to choose the blocked class. Not particularly limiting, just something to bear in mind when using the plugin.

    Credits:
    Heavily based on the source of Tsunami's Class Restricions, which is quality work. Get it for your server.

    Now works for all classes!
    Attached Files
    File Type: sp Get Plugin or Get Source (anticlassleader.sp - 803 views - 5.7 KB)

    Last edited by BonzaiRob; 06-15-2009 at 18:53. Reason: Added Cvar
    BonzaiRob is offline
    flubber
    Senior Member
    Join Date: Oct 2007
    Old 03-02-2009 , 19:54   Re: [TF2] Anti Sniper-Leader
    Reply With Quote #2

    Whaou, that's a great idea, but can this be extend to any class?
    flubber is offline
    Cooltad
    Veteran Member
    Join Date: Apr 2008
    Old 03-02-2009 , 21:54   Re: [TF2] Anti Sniper-Leader
    Reply With Quote #3

    I modified the code to work for Heavies instead of Snipers, though a couple other parts of the code should be changed by the author to make it better for Heavies, as (i think) when modified for a heavy, you'll get the sound of a sniper dying or something like that. I saw a few sniper sounds being called in the code.

    You can look at the code in notepad and see where I modified it around line 98 so you can change it to a different class if you want.
    Attached Files
    File Type: sp Get Plugin or Get Source (antiHEAVYleader.sp - 902 views - 5.0 KB)
    __________________
    Please, give me some rep if you found what I posted useful. :]
    Cooltad is offline
    flubber
    Senior Member
    Join Date: Oct 2007
    Old 03-03-2009 , 04:00   Re: [TF2] Anti Sniper-Leader
    Reply With Quote #4

    Thx, i'll give that a look.
    flubber is offline
    BonzaiRob
    Junior Member
    Join Date: Mar 2009
    Old 03-04-2009 , 06:12   Re: [TF2] Anti Sniper-Leader
    Reply With Quote #5

    Wow, approved!
    I'll edit the plugin and make it easier to change between classes, probably by adding some convars.

    For now, @Cooltad, there's an array containing the sounds near the top of the file, line 22. Just change sniper to heavy. For anyone else who wants to change the class, line 95 is where the magic happens.

    Question for mods and more experienced members: The name of the plugin will probably end up changing. Should I submit a new one or just edit the first post w/ new title and everything?
    BonzaiRob is offline
    Cooltad
    Veteran Member
    Join Date: Apr 2008
    Old 03-04-2009 , 06:37   Re: [TF2] Anti Sniper-Leader
    Reply With Quote #6

    I kinda figured at line 22 that's what it was, but I wasn't sure if all you had to change was 'sniper' in them.
    __________________
    Please, give me some rep if you found what I posted useful. :]
    Cooltad is offline
    Antithasys
    Moderator
    Join Date: Apr 2008
    Old 03-06-2009 , 18:28   Re: [TF2] Anti Class-Leader
    Reply With Quote #7

    This is a great idea and you did a good job for your first plugin. Few suggestions...
    • Call AutoExecConfig(true, "plugin.anticlassleader") to create and load your convars in a .cfg file
    • Use FCVAR_DONTRECORD on your public cvar so its not written to the .cfg file.
    • Use MaxClients instead of GetMaxClients() on map load.

    If you are looking for a feature request... mine would be to allow the settings of multipule classes... not just 1. For example limit leaders from demo and sniper or somthing. You could even make it more useful by having it adjust depending on the map. Look at kvfiles and functions for a way to allow admins to config it. Just a thought.

    EDIT:

    Forgot to mention your public cvar field in this thread is blank. You used: sm_anticlassleader_version in your plugin, so that is what you need to put in this thread. It's 26 chars long and just a FYI, while it will work for this site, game-monitor.com limits it to 25 chars.
    __________________
    [my plugins]

    When you think about asking a question... consider what have you tried?

    Last edited by Antithasys; 03-06-2009 at 18:32.
    Antithasys is offline
    Cooltad
    Veteran Member
    Join Date: Apr 2008
    Old 03-06-2009 , 18:42   Re: [TF2] Anti Class-Leader
    Reply With Quote #8

    Quote:
    Originally Posted by Antithasys View Post
    This is a great idea and you did a good job for your first plugin. Few suggestions...
    • Call AutoExecConfig(true, "plugin.anticlassleader") to create and load your convars in a .cfg file
    • Use FCVAR_DONTRECORD on your public cvar so its not written to the .cfg file.
    • Use MaxClients instead of GetMaxClients() on map load.
    If you are looking for a feature request... mine would be to allow the settings of multipule classes... not just 1. For example limit leaders from demo and sniper or somthing. You could even make it more useful by having it adjust depending on the map. Look at kvfiles and functions for a way to allow admins to config it. Just a thought.

    EDIT:

    Forgot to mention your public cvar field in this thread is blank. You used: sm_anticlassleader_version in your plugin, so that is what you need to put in this thread. It's 26 chars long and just a FYI, while it will work for this site, game-monitor.com limits it to 25 chars.
    Having a billion different .cfg's actually gets annoying. Especially if there's only a few cvars. It's pointless.
    __________________
    Please, give me some rep if you found what I posted useful. :]
    Cooltad is offline
    Lebson506th
    Veteran Member
    Join Date: Jul 2008
    Old 03-06-2009 , 18:47   Re: [TF2] Anti Class-Leader
    Reply With Quote #9

    Instead of having 1 giant one that you have to make?

    I would prefer each having its own...
    __________________
    My Plugins
    Spray Tracer by Nican, maintained by me
    Simple TK Manager
    DoD:S Admin Weapons

    Links
    Resistance and Liberation (A HL2 Multiplayer Modification)
    Lebson506th is offline
    clad
    Senior Member
    Join Date: Oct 2006
    Old 03-10-2009 , 02:22   Re: [TF2] Anti Class-Leader
    Reply With Quote #10

    Would you please add the feature in to set a time limit a class can be played ?
    adjustable cvar.
    this would help us prevent snipers from jumping on the server and hogging it the whole time there on there.
    i've seen alot of crappy snipers that keep our limited 3slot sniper spots, and it causes others to just get pissed because they a not that good.
    i know the only way to get good is to pratice, but when someone pratices for a few hr's and there not doing to well. I think it would only be fair to give it up for a little while.
    __________________
    clad 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 03:54.


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