PDA

View Full Version : TF2: ClassChooser


bl4nk
03-23-2008, 14:52
ClassChooser
Choose a class for everyone to spawn as.

Requirements:
SourceMod snapshot build 2009 or later.

CVars:
sm_classchooser_enable

0 = Disable the plugin
1 = Enable the pluginsm_classchooser_class
scout, demoman (or demo), engineer (or engy), medic, pyro, soldier, spy, sniper, heavy (or hwg) - spawn as the chosen class
random - spawn as a random class each time
none (or anything not listed above) - spawn as the player's chosen classsm_classchooser_engineer_tools
0 = Disable engineers spawning with their build tools
1 = Enable engineers spawning with their build toolssm_classchooser_melee
0 = Disable melee only mode (players spawn with weapons)
1 = Enable melee only modeChangelog:

1.0.0
Initial release
1.0.1
Added cvar sm_classchooser_engineer_tools to control whether or not engineers will spawn with their build tools when the chosen class is set to engineer.
1.0.2
Fixed the engineer tools cvar; it now strips the proper weapons. It also will work using random mode now, since they will most likely become a different class next time they spawn.
Added cvar sm_classchooser_melee to control whether or the game is melee only. Turning this on will also strip all weapons from living players. There's also a enable/disable message printed to chat.
Changing the class cvar to something not defined will not crash the server; it will let the players choose their class. Notes:
With this plugin I'm releasing my TF2 include file. It includes a variety of useful stocks for TF2.
The TF2 extension included with SM now makes my include file useless. It's no longer a requirement.
You won't be able to compile the plugin using the online compilers since I use said include file.
You can now compile using the online compilers since my include isn't needed any longer.
You can only choose one class for the plugin to spawn players as currently.
If you choose engineer as the class to spawn as, players have to manually change their class to engy or else their buildings will be destroyed when they spawn (because they will try to spawn as their chosen class, but be forced to engineer).
Player's chosen class and desired class is now set, so this isn't a problem either.
If the class cvar is set to random and the engineer cvar is set to give no build tools, the engineers will spawn with their build tools. This is because the build tools cvar is meant to prevent camping.
The build tools cvar will now strip on random mode.

teddyruxpin
03-23-2008, 17:59
With this plugin would I be able to for example make my server all Scouts and then give them the soldiers rocket launcher for a weapon?

Thanks,

-Teddy

bl4nk
03-23-2008, 19:45
No. This is just a plugin to choose what class they spawn as. You can only make it so they all spawn as scouts.

bl4nk
03-27-2008, 04:32
Updated to Version 1.0.1

Neo_Bahamut_19
03-27-2008, 09:47
Thank you for the plugin, we shall be trying it out on our 32 man server soon w00t, ctf_hallofdeath 32 players all SOLDIER here we COME!!!

bl4nk
03-27-2008, 10:11
Hah, that's funny. I'm one of the head admins of the community that NIPPER (the maker of ctf_hallofdeath) is from. I sent him a message quoting what you said. :)

blissend
03-27-2008, 10:57
I tested this on my 32 player server and it worked great. Thanks for this wonderful mod.

I did notice one problem with the sudden death melee mod (which I don't think its related to your mod). When I make it medic only right before sudden death... everyone is stuck with the healing gun only. A player recorded this when it first happened (funny) http://www.bilange.net/tf2/

I haven't tested this against maxclass mod so I can only wonder what would happen with that.

bl4nk
03-29-2008, 13:44
I could have sworn I replied to this. I didn't make that sudden death melee plugin, but I'm thinking about remaking it. The guy who originally made it does it in such a weird way that a lot of problems arise (the one you posted being one of them I guess).

DontWannaName
03-31-2008, 03:41
This doesnt seem to work for me? Do I have to use it on map load?

bl4nk
03-31-2008, 08:21
No. What doesn't work about it? Mind you these are cvars and not admin commands.

DontWannaName
03-31-2008, 13:14
I use both rcon and just sm_classchooser_class heavy or random and it didnt work and the enable command didnt return anything back.

bl4nk
03-31-2008, 16:14
You have to have sm_classchooser_enable set to 1. Nothing will be returned once you set the values.

DontWannaName
04-01-2008, 01:04
Is it disabled by default? I swear I tried enabling it. I can try this again later.

DontWannaName
04-01-2008, 03:05
I found this only works on map load. I had to make a cfg for meleebarn and it worked well.

bl4nk
04-01-2008, 04:48
I enable it half-way through the game. I have no idea why you have problems with it.

DontWannaName
04-01-2008, 15:08
Maybe its conflicting with maxclass, I dunno but I got it to work when the commands are in the specific map cfg.

voogru
04-02-2008, 01:00
0 = Engineers do not spawn with their build tools
1 = Engineers do spawn with their build toolsChangelog:



take note that they can still build stuff by using the "build" command unless you disable it.

bl4nk
04-02-2008, 08:58
Hmm, I did not know that. I'll stick that in the next version that I'm working on. Having some troubles with it currently. :)

bl4nk
04-04-2008, 07:43
I couldn't reproduce what you said, voogru. In fact, if I equip a player with the engineer building tools after they've been stripped, they can't even build. There must be something else involved.

bl4nk
04-04-2008, 07:59
Maybe its conflicting with maxclass, I dunno but I got it to work when the commands are in the specific map cfg.

The plugin only changes the classes of players when they spawn. If they're currently alive, they will have to die (or be slain) before their class will change.

bl4nk
04-08-2008, 04:48
Updated to Version 1.0.2

Note: This version requires build 1995 or later. I suggest you read the notes section. Also, there seems to be some problems with the new tf2 extension. I edited two lines (lines 116 and 196) of the tf2_stocks.inc that were missing semi-colons (;) at the end to compile this plugin properly. I'm sure they'll fix it soon as I've submitted a bug report.

blissend
04-08-2008, 15:27
Will you be working on a version that works for the stable release (1946 I think is the latest) rather than snapshot releases? Or is this only possible on the new stuff being released in the snapshot stuff?

bl4nk
04-08-2008, 15:50
Sorry, I don't want to maintain two different releases. Just update your server to the snapshot release, there shouldn't be any problems.

bl4nk
04-09-2008, 06:05
This plugin should now be compilable as of r2009.

demm
04-16-2008, 13:01
I didn't make that sudden death melee plugin, but I'm thinking about remaking it. The guy who originally made it does it in such a weird way that a lot of problems arise (the one you posted being one of them I guess).
That would be great! The original plugin has so many bugs and doesn't work with the newest sourcemod version.

bl4nk
04-16-2008, 15:06
If you check out the last few pages of the Sudden Death Melee thread, you can see that I've already remade it. There are a few minor bugs that need to be fixed with my version, but already it's supposively working better than the original.

blissend
04-19-2008, 13:21
Sorry, I don't want to maintain two different releases. Just update your server to the snapshot release, there shouldn't be any problems.

The snapshot v1.0 branch crashes on me everytime (and reports no errors). This is even on the vanilla build without your mod. The stable version never crashes on me which is why I was hoping you'd do it on the stable version. So many good mods only available on snapshots *sigh*

DontWannaName
04-19-2008, 15:06
I think they fixed it but I need to go test it to make sure.

bl4nk
04-20-2008, 11:34
Yeah, they supposively fixed it a few builds ago. It was a problem with melee weapons and the new crit calculations when you weren't running pRED's critical modifier plugin.

DontWannaName
04-20-2008, 14:19
It still crashes, I opened a new ticket. Darn.

DontWannaName
04-23-2008, 02:22
Theres a extension that pred made that will work with the new build if you have crashes on windows like me. Its folder 2 in the file he put on the bug report. Put it in the ep2 extensions folder.

bl4nk
04-23-2008, 10:23
I think you're the only one having that problem. I've yet to see anyone else still complain about crashes.

DontWannaName
04-23-2008, 19:54
Must be the plugins I run. :P

urus
05-01-2008, 15:32
I find strange work resupply blocker.
On most maps all fine, but on cp_well, ctf_well, cp_wolf, ctf_2fort, ctf_quarry_v2 resupply blocker don`t work. Here 2 resupply per team - one blocked and one no (on ctf_quarry_v2 two not blocked).

stevieboy
05-08-2008, 19:33
Hey bl4nk,

thanks for the good plugin.

We discovered an bug today. If you set the mode to melee only and then, as a medic, select the weapons menu for changing e.g. to Blutsaugher, you'll have all weapons back.

I guess it's because the player isn't spawned again when changing the special weapons and thus the weapons won't be stripped again.

Can you fix that?

bl4nk
05-09-2008, 14:18
I'll see what I can do about the new medic weapons causing problems.

HHminty
05-13-2008, 19:27
Hi,

Installed this today on a new TF2 server with Sourcemod v1.0.1.2143 and when i go to a map that i have a cfg file that i just want melee weapons only on it's ok. But when i change the map back to a map not set for melee weapons only you can only have melee weapons nothing else. If i restart the server its ok until i go back to the melee only map.

This is what i have in my cfg file:-

mp_timelimit "20"

sm_classchooser_enable 1
sm_classchooser_class none
sm_classchooser_melee
sm_suddendeath_melee_class "random"

On all my standard maps the cfg file doesnt have this in.

Any ideas?

bl4nk
05-13-2008, 21:15
Put some default commands in your server.cfg. Something like:

sm_classchooser_enable "0"
sm_classchooser_melee "0"

HHminty
05-14-2008, 04:10
Thank you for that i will try it later

HHminty
05-14-2008, 09:25
Yeah that works great

stevieboy
05-19-2008, 15:24
Hey bl4nk,

me again ^^

Do you have any update on the medic-weapon-switch-problem?

Neo_Bahamut_19
05-22-2008, 06:56
any chance of possibly seeing some sort of a menu integration?

stevieboy
05-22-2008, 07:05
Just add this in your tf/addons/sourcemod/configs/dynamicmenu/menu.ini and you'll be fine. (works with a snapshot from 1.0.1)

"Commands"
{
"Custom server settings"
{
"admin" "sm_kick"
"Fixed Class"
{
"cmd" "sm_classchooser_enable #1;sm_classchooser_class #2;sm_say You will spawn as class: #2"
"execute" "server"
"1"
{
"type" "list"
"title" "Class chooser:"
"1" "1"
"1." "On"
"2" "0"
"2." "Off"
}
"2"
{
"type" "list"
"title" "Which class:"
"1" "none"
"1." "off / Player can choose"
"2" "random"
"2." "random class per spawn"
"3" "scout"
"4" "sniper"
"5" "soldier"
"6" "demoman"
"7" "medic"
"8" "heavy"
"9" "pyro"
"10" "spy"
}
}
"Melee only"
{
"cmd" "exec #1;sm_classchooser_class #2;sm_say You will spawn as class: #2"
"execute" "server"
"1"
{
"type" "list"
"title" "Melee only:"
"1" "meleeonlyon.cfg"
"1." "On"
"2" "meleeonlyoff.cfg"
"2." "Off"
}
"2"
{
"type" "list"
"title" "Which class:"
"1" "none"
"1." "off / Player can choose"
"2" "random"
"2." "random class per spawn"
"3" "scout"
"4" "sniper"
"5" "soldier"
"6" "demoman"
"7" "medic"
"8" "heavy"
"9" "pyro"
"10" "spy"
}
}
"Friendly Fire"
{
"cmd" "mp_friendlyfire #1"
"execute" "server"
"1"
{
"type" "onoff"
"title" "Friendly Fire:"
}
}
"Crits"
{
"cmd" "tf_weapon_criticals #1"
"execute" "server"
"1"
{
"type" "onoff"
"title" "Critical hits:"
}
}
"Respawntimes"
{
"cmd" "mp_disable_respawn_times #1"
"execute" "server"
"1"
{
"type" "list"
"title" "Respawn waiting time:"
"1" "0"
"1." "On"
"2" "1"
"2." "Off"
}
}
}
}
Hth,
Stevie

r3dh3adkid
06-15-2008, 04:06
Hey bl4nk,

I just checked my sourcemod_fatal log and it keeps telling me that classchooser has a memory leak over and over again.

Here is exactly what its saying

L 06/01/2008 - 01:04:40: [SM] Reloading plugin to free 15673 handles.
L 06/01/2008 - 01:04:40: [SM] Contact the author(s) of this plugin to correct this error.
L 06/01/2008 - 01:04:40: [SM] MEMORY LEAK DETECTED IN PLUGIN (file "classchooser.smx")It told me to tell you so i'm doing what i'm told haha. The date says 6/01/08, it hasnt entered the log since then, there are no error reports for the plugin. I'm not sure if it was a on time thing or if it was a problem with SM but it doesn't seem to have happened since then, in any case i'm just letting you know in case there is a problem.

I will provide as much info as you need.

Here's the basic stuff that you will probably need:

04:09:15 SourceMod Version Information:
SourceMod Version: 1.1.0.2200
JIT Version: JIT (x86), 1.1.0.2139
JIT Settings: Generic i686
http://www.sourcemod.net/And I am running the latest version of the plugin (1.0.2 I do believe)

bl4nk
06-15-2008, 13:37
Try this version out. I'm not exactly sure if what I did will fix the problem, but it's the only thing related to the error that I could find.

r3dh3adkid
06-15-2008, 15:15
Adding now.

I'll delete the log and keep checking for a new one.

MjrNuT
06-20-2008, 02:03
I have a request to make this plugin able to specify Class separately for Blue and for Red as an option.

Like have Red all scouts, and blue all Sniper. Would that be possible? Additionally to make cvars or something similar to enable while ingame if possible. It looks like the menu.ini could help w/ that.

Thanks!!

ColdFire
07-16-2008, 10:35
Would it be possible to make a version where you can force one specific player to change class?

Mass
07-23-2008, 05:44
I have a request to make this plugin able to specify Class separately for Blue and for Red as an option.

Like have Red all scouts, and blue all Sniper. Would that be possible? Additionally to make cvars or something similar to enable while ingame if possible. It looks like the menu.ini could help w/ that.

Thanks!!

This is something i'm looking for too

ChillyWI
08-01-2008, 09:57
There's a bug with this when random class is enabled along with engineer tools. When someone builds as an engineer and then respawns as another class their sentry stays. So, with a 12 person team you can essentially have 12 sentries plus whatever classes the players randomly assigned as. Can you destroy all of a players' buildings when their class is assigned?

bl4nk
08-01-2008, 13:09
There's a lot of problems with this. I'm thinking about rewriting it to make it work as intended.

demm
08-03-2008, 14:40
Maybe you could merge it with your sudden death melee plugin. They both do essentially the same thing and it would be neat to have one plugin control both situations.

bl4nk
08-03-2008, 14:52
Yeah, but SDMR is meant for sudden death, and this is meant for everything.

stevieboy
08-18-2008, 05:40
Hey bl4nk,

thx again for making this great plugin.

We have an issue to report concerning the Melee-Only-Mode. Sadly we had to notice that the locker returns all stripped weapons back to the player. Maybe even if he'd walk over an ammopack it would restore the weapons (not tested yet).

Is there any way you can prevent getting back the weapons with going to the locker?

Thx in advance,

Stevie

bl4nk
08-18-2008, 10:35
All of the weapon lockers should be disabled, but for some reason it doesn't work properly. I'm going to be recoding the plugin in the future, and that will be one of the main things I fix. Until then, there's a TF2 Melee Mode plugin out there that will do what you want (hopefully).

air853
03-27-2009, 18:07
By any chance will this plugin be made to work again?

AllWaySinner
06-23-2009, 21:57
i am fairly new to this. where do i place the Cvars? or where to find them to change them. ive managed to get everyother mod im using to work.

bl4nk
06-24-2009, 13:54
You can place the cvars in your server.cfg. They're located in the first post of this thread.

MrSaturn
07-10-2009, 22:01
I hope you get around to recoding/fixing this soon! The concept is great.

Here is for people's custom admin menus.

"OneClass Commands"
{
"Enable OneClass"
{
"cmd" "sm_cvar sm_classchooser_enable @1"
"admin" "sm_slay"
"execute" "server"
"1"
{
"type" "list"
"title" "Enable/Disable?"
"1" "1"
"1." "On"
"2" "0"
"2." "Off"
}
}
"OneClass Type"
{
"cmd" "sm_cvar sm_classchooser_class @1"
"admin" "sm_slay"
"execute" "server"
"1"
{
"type" "list"
"title" "What Class?"
"1" "scout"
"1." "Scout"
"2" "demoman"
"2." "Demoman"
"3" "engineer"
"3." "Engineer"
"4" "medic"
"4." "Medic"
"5" "pyro"
"5." "Pyro"
"6" "soldier"
"6." "Soldier"
"7" "spy"
"7." "Spy"
"8" "sniper"
"8." "Sniper"
"9" "heavy"
"9." "Heavy"
"10" "random"
"10." "Random"
}
}
"Engineer Tools"
{
"cmd" "sm_cvar sm_classchooser_engineer_tools @1"
"admin" "sm_slay"
"execute" "server"
"1"
{
"type" "list"
"title" "Allow Tools?"
"1" "0"
"1." "No"
"2" "1"
"2." "Yes"
}
}
"Melee Only"
{
"cmd" "sm_cvar sm_classchooser_melee @1"
"admin" "sm_slay"
"execute" "server"
"1"
{
"type" "list"
"title" "Melee Only?"
"1" "0"
"1." "No"
"2" "1"
"2." "Yes"
}
}
}

MrSaturn
07-12-2009, 10:40
blerb, nevermind about the menu.

It seems that this plugin creates alot of stuttering on my server.

jonescr2
07-14-2009, 14:40
Just wanted to say, I love this plugin! :) One problem though.

I installed this on my server, and in my "sourcemod.cfg" file I have this:

sm_classchooser_melee 0
sm_classchooser_engineer_tools 1
sm_classchooser_class random

I use custom votes to enable it on/off in game using this cfg (I really didn't know what I was doing so I winged it :))

"randomclass"
{
"title" "Turn Random Class {!sm_classchooser_enable|onoff}?"
"type" "confirm"
"admin" "sm_admin"
"command" "sm_classchooser_enable {!sm_classchooser_enable}"
"trigger"
{
"command" "voterandom"
"notice" "%u wants to to initiate a Random Class"
"percent" "50"
}
}

With these settings, the plugin works... somewhat. You spawn as a different class, but with the last class's weapons. Why is that?

Otherwise this plugin rules. :)

P.S. - My first post on the forums. :)

Agent Wave
08-06-2009, 15:52
I really hope this plugin gets redone. We're running SM 1.3.0-dev Build 2751 and when a class is chosen for people to spawn as, nothing happens until they die...once they die, their HUD is changed to the new class but they still have their old weapons. The really ugly part of this is that you get the new class's ammo count... I just tried Demo and then Medic and I ended up with a grenade launcher with 150 reserve ammo. Going to a health locker switches all your stuff over to the new class.

Remy Lebeau
12-07-2009, 17:59
Hi guys, does this mod still work?

I'm testing it on my server, and there are a number of bugs (We're running sm 1.3.0-dev).

Firstly, disabling engy buildings doesn't work at all. I set it to 0, and engies can still build with no problems.

Secondly, melee only has problems. Any dispenser will give you your weapons back.

Thirdly, the class chooser itself has bugs. When I choose a particular class (say scout), people will spawn as that. However, if I then change my class, I respawn as the new class! Next time I die I go back to the set class.

Really, I only want it for melee only, and engy building disabling, neither of which are working!

bl4nk
12-09-2009, 00:01
I intend to completely redo this plugin in the near future. I'll try to get to it soon.

Anti Christ
12-22-2009, 19:04
I love your work, Bl4nk. I've been looking for a melee only mod for my server, and this finally works. I've used quite a few of your mods in the past, and they've all worked nicely. Keep on making great work! :D

SmackDaddy
03-07-2010, 13:48
I am looking forward to a redo of this plugin blank.....between this and the Randomizer, I hope work picks up for one of these, my community loves having events where we do something different for everyone.....

Drixevel
03-21-2010, 01:49
this plugin is so freakin buggy. Can anybody fix this? i want a mod where everyone spawns as a random class but has default weapons for that class.

bl4nk
03-25-2010, 20:47
It's been a little while since I've been around, but I finally got around to redoing this plugin. The only downside is that I currently can not test what I have. Attached is the new version; once someone tests it out and tells me how well it works, I'll push it to the front page as the new version.

Changelog for v2.0.0:


Removed the melee only mode from the plugin (engineer/resupply cabinet stuff removed along with it)
Changed the default value of the class cvar to "random"
Improved class changing methods
Players' desired classes are no longer kept; they are now forced

The only two cvars are now the "enable" cvar and the "class" cvar. All others (when testing this plugin) can be removed from your config files.

bl4nk
03-26-2010, 01:17
Oh, I forgot to mention that this version will not change the classes of players that are already alive. I'll add that in for the next version with a cvar to control it.

Darkimmortal
03-26-2010, 17:01
bool:IsPluginEnabled()
{
return GetConVarInt(g_hCvarEnable);
}

Should that not be GetConVarBool?

bl4nk
03-26-2010, 17:27
Yeah it probably should, but the ConVar is locked to 0/1 anyways.

Drixevel
03-31-2010, 05:39
it works but it needs alittle more constraint. Like sometimes i spawned the same class like 5 times before it switched again. Also try to see if you can make it so if they try to switch classes with , that their put at the same class they currently HAVE to play as. Or make it a cvar up to you. Besides that it's pretty good and it'll be a big hit at events. :]

bl4nk
03-31-2010, 17:22
@r3dw3r3w0lf:

Getting the same class multiple times: Easy fix, I'll add something in for that soon.

Switching classes: This requires a bit more work. I'd have to track if the player has been assigned a class, if they respawned (through dieing/round restarts/etc) or changed class, and some other stuff I can't think of off the top of my head without actually doing the coding work. It's possible, but it would make the plugin a lot more complex than I'd like it to be. If more people feel that this is needed, I'll add it in, but as of right now, I don't see me doing anything about it.

Drixevel
04-01-2010, 21:39
ok, i can deal without the class switching but the same class multiple times is something i'd like if ya don't mind for me. Im still trying to learn how to develop/edit plugins but i can't for nothin. -_-

Alvari
06-22-2010, 08:53
Anyway to use this plug-in to force a specific person to be class switched.

trenza
01-27-2015, 12:55
I can't seem to get this to work, sorry, I'm pretty new to sourcemod. Do I need to do anything besides put the sp in scripting and the smx in plugins?