Restricting class and weapons?

whiteskh

L1: Registered
Jun 22, 2008
5
1
Is there any way to restrict a class or block a class from entering a map? I messed around with filter_class but it didn't seem to work.

Also, is there a way to restrict certain weapons without the sv_cheats 1 method?

I've been tinkering for a while, but as a noob mapper I can't do it all myself. So I was hoping the people from this wonderful forum could help. :love:
 
T

The Asylum

It's weird isnt it, having an entity that's supposed to do what it says but ends up doing nothing. To my knowledge, filter_class just doesn't work. At all.

Now, if you meant banning a class from a map (like ctf_bball, where the only class allowed is Soldier,) then you'd have to resort to fancy server trickery
 

Jive Turkey

L3: Member
Jan 22, 2008
120
32
Filter_class works fine, the problem is in the context of "class" used here. All players are of the "player" class. The character class you use does not change this. Filter_class is not designed to make the distinction on that level. It only knows about entity classes, not which character you're using. This ability has been requested in a letter to Valve but at the moment there is no way to determine a player's character class in map logic.

I have seen a map which does something clever though, It starts all players in a sort of lobby room and provides exits which correspond to what class you want to be. When you exit, the server sets you to that class and teleports you into the map proper. If you try to change class outside the lobby you will be unable to, because the outside is not designated as a spawn room. You can try to change class and then kill yourself, but every time you die you end up back in the lobby and have to use an exit, which again changes you to that specific class. It's like a firewall for class selection. You can just leave out whichever classes you don't want allowed.

I think you use the point_servercommand entity to do this.
 

whiteskh

L1: Registered
Jun 22, 2008
5
1
Filter_class works fine, the problem is in the context of "class" used here. All players are of the "player" class. The character class you use does not change this. Filter_class is not designed to make the distinction on that level. It only knows about entity classes, not which character you're using. This ability has been requested in a letter to Valve but at the moment there is no way to determine a player's character class in map logic.

I have seen a map which does something clever though, It starts all players in a sort of lobby room and provides exits which correspond to what class you want to be. When you exit, the server sets you to that class and teleports you into the map proper. If you try to change class outside the lobby you will be unable to, because the outside is not designated as a spawn room. You can try to change class and then kill yourself, but every time you die you end up back in the lobby and have to use an exit, which again changes you to that specific class. It's like a firewall for class selection. You can just leave out whichever classes you don't want allowed.

I think you use the point_servercommand entity to do this.

I figured out how to do it, Create a trigger multiple inside the spawnroom and create a point_clientcommand somewhere in the map. Then Set the output on the multiple "On trigger, <name of the point_clientcommand>, Command, join_class pyro(Or whatever you want)"