AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   TF2 Class limit (https://forums.alliedmods.net/showthread.php?t=62630)

Nican 10-31-2007 21:39

TF2 Class limit
 
18 Attachment(s)
TF2 MaxClass

Description: The server will block anyone trying to change a class on specific limits, this limits can be changed in MaxClass.txt

Instalation
  • Download the plugin from the button of this post and MaxClass.txt
  • Put MaxClass.smx into tf\addons\sourcemod\plugins
  • Put MaxClass.txt into tf\addons\sourcemod\configs
  • To edit the limits of each class, look into MaxClass.txt and it should be fairly easy to understand

Commands
  • sm_classlimit - Re-reads and prints the limits from file

Cvars
  • sm_maxclass_allow (default: 1) - Enable/Disable this plugin
  • sm_maxclass_exclude_admins (default: 0) - Admin immunity
  • sm_maxclass_count_admins (default: 0) - Enable/Disable admins counting towards class limits
  • sm_maxclass_config (default: MaxClass.txt) - config file location

Change log
  • October 31, 2007
    • Initial release
  • November 6, 2007
    • Fixed, client not in game, bug
  • November 12, 2007
    • Fixed format errors
    • Fixed spelling errors
    • No more need for TF2Tools
  • November 24, 2007
    • Added per team support
    • Fixed problem of changing to the same class
    • Fixed bug of no reading KV (v2.1)
  • December 29, 2007
    • Fixed for new TF2 update
  • August 19, 2008
    • Made the naris version official
    • Fixed bug on naris plugin
  • 4.0 (-=|JFH|=-Naris (Murray Wilson))
    • Use tf2_stocks
    • Pick random class to switch to
    • Use ConVars for admin settings
    • Display class selection menu when switching
  • 4.3 (cadavor)
    • Add translations
  • 4.4 (JameLess)
    • Fixed skin glitching
  • 4.5 (Thraka)
    • Added the ability to load settings based on the prefix of the map. Example: pl is payload, cp is capture point.
    • Logs which section of the config is loading the settings.
  • 4.6 (Thraka)
    • Added the NO! class sounds when player chooses a class that is full. This was pulled from DJ Tsunami's class restriction plugin
  • 4.7 (Thraka & Jameless)
    • Request from snelvuur - Added the sm_maxclass_allow_adminsdeadclass cvar. If set to 0, this will not let admins play restricted classes
  • 4.8 (Jameless)
    • Added the sm_maxclass_admin_flag cvar. This will allow you to change what flag is immune.

Fredd 10-31-2007 23:53

Re: TF2 Class limit
 
Code:

Engenner
Lol. and you need to hook a convar change for enable disable..other than that it's awesome xD gj :D

Nican 11-01-2007 17:33

Re: TF2 Class limit
 
Quote:

Originally Posted by Fredd (Post 548227)
Code:

Engenner
Lol. and you need to hook a convar change for enable disable..other than that it's awesome xD gj :D

Huh? I added one...

Fredd 11-01-2007 20:26

Re: TF2 Class limit
 
it's spelled 'engineer' and no you didn't add a convar hook for change

W][LDF][RE 11-03-2007 00:36

Re: TF2 Class limit
 
:)

flubber 11-04-2007 19:51

Re: TF2 Class limit
 
Can't take the file, failed to compil :'(

Nican 11-04-2007 20:03

Re: TF2 Class limit
 
I put the .smx there,

but don't forget to fulfill the requirements please

flubber 11-05-2007 20:52

Re: TF2 Class limit
 
Back on this thread, :).
It's working like a charm, but i was wondering if you can add a way to translate the phrase into another language.

Anyway thanks for this our ctf_rugby map really needed a class restrict...
edit:Nevermind i didn't though that i can just take the source.

aakerlind 11-06-2007 10:41

Re: TF2 Class limit
 
Im getting these:

[SM] Successfully toggled debug mode on plugin MaxClass.smx.
L 11/06/2007 - 16:38:58: [SM] Native "GetClientTeam" reported: Client 6 is not in game
L 11/06/2007 - 16:38:58: [SM] Displaying call stack trace for plugin "MaxClass.smx":
L 11/06/2007 - 16:38:58: [SM] [0] Line 93, MaxClass.sp::RecountClasses()
L 11/06/2007 - 16:38:58: [SM] [1] Line 50, MaxClass.sp::Playerchangeclass()

Nican 11-06-2007 10:46

Re: TF2 Class limit
 
Fixed...

Can someone please tell me if this works when there is >1 player, I just tested it with my self

aakerlind 11-06-2007 12:53

Re: TF2 Class limit
 
I do not get the errors anymore, havent had time to actually play on the server yet

aakerlind 11-06-2007 13:14

Re: TF2 Class limit
 
and its spelled engineer aswell ;P

MaxPlayers[TF2_ENG] = KvGetNum(kv, "engenner", -1);

Lurks 11-08-2007 10:35

Re: TF2 Class limit
 
Right, I really really need this so I went to some trouble. Fixed the spelling mistake but this does not compile. Can't find TF2, which is from the #include <tf2> line. If you get rid of that you get errors on not recognising symbols.

bl4nk 11-08-2007 13:00

Re: TF2 Class limit
 
You can get the tf2.inc file here.

Nican 11-08-2007 15:52

Re: TF2 Class limit
 
Thank you bl4nk :D

Lurks 11-10-2007 07:00

Re: TF2 Class limit
 
Alright, but the compiler on the site doesn't have the include and I don't have the compiler. Can't you just put those functions in the class balance plug-in so it would compile, people could download it and use it and stuff like that? :)

BrutalGoerge 11-10-2007 12:13

Re: TF2 Class limit
 
I don't think I want to restrict classes the whole game, but when it goes to sudden death, we try to enforce only 1 engineer per team. It'd be schweet if there was a way to enable restrictions only in sudden death. :)

nolanrh 11-12-2007 15:43

Re: TF2 Class limit
 
Here is my config for the MaxClass plugin:
Quote:

"MaxClassPlayers"
{
"default"
{
"1-16"
{
"scout" "2"
"sniper" "2"
"soldier" "2"
"demoman" "2"
"medic" "2"
"heavy" "2"
"pyro" "2"
"spy" "2"
"engenner" "2"
}
}
}
It is working but the message that describes how many are allowed after a failed attempt to switch says a massive number, I forgot to copy and paste but its definitely not right. Haven't bothered to look at the code yet.

Nican 11-12-2007 18:35

Re: TF2 Class limit
 
Update

I believe I covered most things people asked for

LouLouBizou 11-13-2007 18:14

Re: TF2 Class limit
 
Well first thing: thanks for this wonderfull plugin !

then, it is a suggestion, can you add some more fonctionnalities like:

- if a player choose a class wich has reached the limit, re-open the menu (class option) instead of back to game,

- and then print a message in center say on screen class panel (like tf class limit beetles mod plugin).

can you do that please ?

Thanks !

Nican 11-13-2007 18:42

Re: TF2 Class limit
 
And that is exactly the problem I am trying to fight

I have been looking up/down the source mod engine on how to do that, and I was only able to block the function

I tried executing the command to open the menu again, but nothing happens

The only option left would be to hack the computer memory and call the function manually, but I am not good at doing that kind of stuff

flubber 11-13-2007 20:17

Re: TF2 Class limit
 
It works like a charms, I restrict on one map on our server (ctf_rugby) feel free to join us to verify that the plugin works : 217.70.184.250:27016

LouLouBizou 11-14-2007 05:25

Re: TF2 Class limit
 
Maybe one thing that can help you ! if my memorie is correct, in plugin BAT by EKS, when you try to swap a player to another team (like red -> blue), player dont be swaped and come in class menu ! mabe have a look at the source code of BAT.

No ?

Laser32 11-18-2007 06:22

Re: TF2 Class limit
 
Hi all.

sorry for my Englisch.

this script dont work on my Server. 24 Slot , 2fort only

installed sourcmod 1.7...

Put MaxClass.smx into tf\addons\sourcemod\plugins
Put MaxClass.txt into tf\addons\sourcemod\configs

This is my MaxClass.txt

"MaxClassPlayers"
{
//Put the map name as the name for specif-map config
"ctf_2fort"
{
//When there is 1 to 5 players in the server
"1-24"
{
//Put -1 for no limit, 0 for disalowed, and any other number to set the limit
"scout" "-1"
"sniper" "2"
"soldier" "-1"
"demoman" "1"
"medic" "-1"
"heavy" "1"
"pyro" "1"
"spy" "1"
"engineer" "2"
}

//When there is 6 players in the server
}
}


pls help me

Rothgar 11-18-2007 07:53

Re: TF2 Class limit
 
Hi Nican,

Nice plugin, will definitely be interested in this script to hopefully decrease snipers mainly and possibly limit heavy's.

Couple of ideas, rename the smx and sp file to tf2_maxclass or similar in case another mod is looking for a maxclass plugin?

Make the config file easier to use, maybe have a default section and then use 1-6 for example?

I thought the default config file meant 6 and over would have a limit however after printing the results to console I saw that it was indeed not the case and it was only trying to limit when there were only 6 people in the server...

having the flexibility to define classes on player count is useful in some situations however I think it needs an easier method to define a default section and then the rest over-ride, that way you could even shorten map specific blocks or player range blocks to only change a few classes and use the rest from default rather than specifying them all in every block.

Hopefully this makes sense to you since you said English is not your primary language, if you need clarification let me know.

Great plugin I'll be checking it out soon once I make the amendments.

Example:

Code:

"MaxClassPlayers"
{
    //Default config if the map tree is not found
    //Put -1 for no limit, 0 for disallowed, and any other number to set the limit

  "default"
  {
    "default"
    {
            "scout"        "-1"
            "sniper"    "-1"
            "soldier"    "-1"
            "demoman"    "-1"
            "medic"        "-1"
            "heavy"        "-1"
            "pyro"        "5"
            "spy"        "-1"
            "engineer"    "6"
    }
    "1-5"
    {
            "heavy"        "1"
    }

    "6-24"
    {
            "sniper"    "2"
    }
  }

  "ctf_2fort"
  {
    "default"
    {
            "pyro"        "0"
    }

    "6-24"
    {
            "engineer"    "3"
    }
  }
}

So in the example:
The default > default block takes effect on all maps and sets the base defaults.
The default > players blocks take affect on all maps and over-rides the defaults.
The map > default block over-rides the defaults outlined in both "default > default" and "default > players blocks".
The map > player block over-rides all other blocks.

Once again hope this makes sense, I am not sure if it's currently setup like this or not already.

tcviper 11-18-2007 09:26

Re: TF2 Class limit
 
This doesnt work at all for me? I see 5 engineers while its set to 2 and I keep seeing over 5 heavy's while its set to 1. The plugin is loaded and the MaxConfigs file is set. Any idea?

FlyingMongoose 11-18-2007 10:54

Re: TF2 Class limit
 
1 it's MaxClass.txt and it's under addons/sourcemod/configs ....also...this isn't on either of your tf2 servs!

t1mk1ll 11-18-2007 20:37

Re: TF2 Class limit
 
I have tried to get this running for ctf_rugby to limit snipers and it just will not take.

Quote:

"MaxClassPlayers"
{
//Default config if the map tree is not found
"default"
{
//When there is 1 to 5 players in the server
"1-5"
{
//Put -1 for no limit, 0 for disalowed, and any other number to set the limit
"scout" "-1"
"sniper" "-1"
"soldier" "-1"
"demoman" "-1"
"medic" "-1"
"heavy" "-1"
"pyro" "-1"
"spy" "-1"
"engineer" "-1"
}

//When there is 6 players in the server
"6"
{
//Put -1 for no limit, 0 for disalowed, and any other number to set the limit
"scout" "-1"
"sniper" "-1"
"soldier" "-1"
"demoman" "-1"
"medic" "-1"
"heavy" "-1"
"pyro" "-1"
"spy" "-1"
"engineer" "-1"
}
//Anything that is not set, will be -1 (no limit)
}
//Put the map name as the name for specif-map config
"ctf_rugby"
{
//When there is 1 to 5 players in the server
"1-5"
{
//Put -1 for no limit, 0 for disalowed, and any other number to set the limit
"scout" "-1"
"sniper" "2"
"soldier" "-1"
"demoman" "-1"
"medic" "-1"
"heavy" "-1"
"pyro" "-1"
"spy" "-1"
"engineer" "-1"
}

//When there is 6 players in the server
"6"
{
//Put -1 for no limit, 0 for disalowed, and any other number to set the limit
"scout" "-1"
"sniper" "2"
"soldier" "-1"
"demoman" "-1"
"medic" "-1"
"heavy" "-1"
"pyro" "-1"
"spy" "-1"
"engineer" "-1"
}
//Anything that is not set, will be -1 (no limit)
}
}

flubber 11-18-2007 21:07

Re: TF2 Class limit
 
Quote:

Originally Posted by t1mk1ll (Post 554470)
I have tried to get this running for ctf_rugby to limit snipers and it just will not take.

First, being one of the "creator" (at least i gave some idea thru the mapping process)of the map thanks for playing it :o. We have rugby on our server, and TF2 Class works. You just have to add what i put in red :

Code:

//When there is 6 players or more in the server
        "6-24"
        {
            //Put -1 for no limit, 0 for disalowed, and any other number to set the limit
            "scout"        "-1"
            "sniper"    "2"
            "soldier"    "-1"
            "demoman"    "-1"
            "medic"        "-1"
            "heavy"        "-1"
            "pyro"        "-1"
            "spy"        "-1"
            "engineer"    "-1"
        }

May i suggest a scout limit too :).

t1mk1ll 11-18-2007 21:13

Re: TF2 Class limit
 
Quote:

Originally Posted by flubber (Post 554475)
First, being one of the "creator" (at least i gave some idea thru the mapping process)of the map thanks for playing it :o. We have rugby on our server, and TF2 Class works. You just have to add what i put in red :

Code:

//When there is 6 players or more in the server
        "6-24"
        {
            //Put -1 for no limit, 0 for disalowed, and any other number to set the limit
            "scout"        "-1"
            "sniper"    "2"
            "soldier"    "-1"
            "demoman"    "-1"
            "medic"        "-1"
            "heavy"        "-1"
            "pyro"        "-1"
            "spy"        "-1"
            "engineer"    "-1"
        }

May i suggest a scout limit too :).

nice thanks. no one has complainied about scouts...yet.:wink:

LouLouBizou 11-19-2007 05:24

Re: TF2 Class limit
 
Quote:

Originally Posted by tcviper (Post 554232)
This doesnt work at all for me? I see 5 engineers while its set to 2 and I keep seeing over 5 heavy's while its set to 1. The plugin is loaded and the MaxConfigs file is set. Any idea?

i have see this bug when you swap some people to another team. i explain, for exemple you start at blue as an engeneer, then you swap yourself at red. if you look a class menu in red, you can see that you are not present in engeneer but you are really an engeneer, maybe i think its a bug of the game or the swap fonction (mani with metamod)

For now, the best plugin for class restriction is Beetles mod, but i dont like it because its a full administration etc ! People just want a simple plugin for class restriction.

Does anybody can do the same plugin as beetles mod but only with the class restriction ?

tcviper 11-19-2007 05:49

Re: TF2 Class limit
 
:( Ill see what i can do with one of my guys to develop a good one ;) But first Sourcebans.

Rothgar 11-19-2007 06:09

Re: TF2 Class limit
 
That would be great Viper, a decent class restriction plugin is definately necessary.

As for the inability to call the class selection screen couldn't you just utilize the client exec feature?

Nican 11-19-2007 17:34

Re: TF2 Class limit
 
*sigh*

I have been trying to sig scan the "joinclass" command to see if I can make this work better, but I can't find it D:


LouLouBizou, I may be able to fix that by hooking player_spawn and checking the class, I will try to do it right now


EDIT:
Viper, what is your idea? Maybe I can try it?


And can someone try the beta version on the first post? I can't find enough people to try it :/

LouLouBizou 11-20-2007 03:51

Re: TF2 Class limit
 
Quote:

Originally Posted by Nican (Post 554772)
*sigh*

I have been trying to sig scan the "joinclass" command to see if I can make this work better, but I can't find it D:


LouLouBizou, I may be able to fix that by hooking player_spawn and checking the class, I will try to do it right now


EDIT:
Viper, what is your idea? Maybe I can try it?


And can someone try the beta version on the first post? I can't find enough people to try it :/

I have installed it on my server, but i cant test it, im not at home ^^

So, you can have a look on my server: 91.121.82.83:27018 |FR| Les Tetes Brulees -=]LTB[=- (Tick 100)

I will post when i back home if i see problems !

flubber 11-20-2007 04:39

Re: TF2 Class limit
 
Quote:

Originally Posted by Nican (Post 554772)
*sigh*
And can someone try the beta version on the first post? I can't find enough people to try it :/


I'm installing it right now on our server only for ctf_rugby:
217.70.184.250:27016 [FR] Scout - Canard PC by gandi.net - (www.canardplus.com) (Custom Only)
i'll give you feedback as soon as the server is filled and tested.

Nican 11-20-2007 07:03

Re: TF2 Class limit
 
Thank you, I will go there after school

EDIT: Dang, the server is full

flubber 11-21-2007 10:17

Re: TF2 Class limit
 
It worked perfectlly, i tried to swap a scout to the other team, and he had to respawn in another class (was not so happy btw).

Nican 11-21-2007 14:20

Re: TF2 Class limit
 
Great, now I need to find a way to open the class menu

flubber 11-23-2007 12:00

Re: TF2 Class limit
 
Is there a way to change the allowed numbre via a super menu ingame, then re-read the maxclass.txt. I asked this because sometimes i get pissed of having a team with 4-5 sniper, and i was wonder if i can limit them on the fly.


All times are GMT -4. The time now is 22:22.

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