Raised This Month: $32 Target: $400
 8% 

[TF2] Force Class


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Bitl
Senior Member
Join Date: Jul 2012
Plugin ID:
3402
Plugin Version:
1.0
Plugin Category:
Gameplay
Plugin Game:
Team Fortress 2
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Forces all users to be a class.
    Old 12-08-2012 , 16:13   [TF2] Force Class
    Reply With Quote #1

    This changes all players to be a specific class. This force-kills all players when the round starts.

    ConVars:
    sm_fcc_class 1/9
    -Forces all users to change to a class.
    1 - Scout
    2 - Soldier
    3 - Pyro
    4 - Demoman
    5 - Heavy
    6 - Engineer
    7 - Medic
    8 - Sniper
    9 - Spy

    Patches:

    1.2
    - Removed round_start and player_changeclass
    - Documents all the class numbers when sm_fcc_class returns no values

    1.1
    - Removed the original 9 cvars and replaced them with sm_fcc_class (Thanks Dr. McKay!)

    1.0:
    -Release
    Attached Files
    File Type: sp Get Plugin or Get Source (forceclass.sp - 1882 views - 1.2 KB)
    __________________
    My Plugins
    Modified Plugins:
    Building Spawner
    Monster
    It's Raining Men!
    Tutorials:
    Custom Gamemode

    I DON'T DO PLUGIN REQUESTS.

    Last edited by Bitl; 12-08-2012 at 19:24.
    Bitl is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 12-08-2012 , 16:24   Re: [TF2] Force Class
    Reply With Quote #2

    Why couldn't you just use Class Restrictions and set the limit for everything except the one class to zero?
    __________________
    Dr. McKay is offline
    Bitl
    Senior Member
    Join Date: Jul 2012
    Old 12-08-2012 , 16:34   Re: [TF2] Force Class
    Reply With Quote #3

    Quote:
    Originally Posted by Dr. McKay View Post
    Why couldn't you just use Class Restrictions and set the limit for everything except the one class to zero?
    It just makes it easier.
    __________________
    My Plugins
    Modified Plugins:
    Building Spawner
    Monster
    It's Raining Men!
    Tutorials:
    Custom Gamemode

    I DON'T DO PLUGIN REQUESTS.
    Bitl is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 12-08-2012 , 16:48   Re: [TF2] Force Class
    Reply With Quote #4

    Quote:
    Originally Posted by Bitl View Post
    It just makes it easier.
    Unfortunately, making the behavior of an existing plugin easier is still duplication and is ineligible to be approved. If you add something that another plugin doesn't do already, it'll be reviewable, but it's not in its current state.

    That being said, using nine individual cvars is not the best way to approach this. The best method would be to use a single cvar and assign a number to each class (1 = scout, 2 = soldier, etc).

    Then you could just change the cvar to the class that you want to force.

    I'm unapproving this for now, but PM me or another approver if you add something that sets this plugin apart from those that already exist.
    __________________
    Dr. McKay is offline
    Bitl
    Senior Member
    Join Date: Jul 2012
    Old 12-08-2012 , 17:06   Re: [TF2] Force Class
    Reply With Quote #5

    Quote:
    Originally Posted by Dr. McKay View Post
    Unfortunately, making the behavior of an existing plugin easier is still duplication and is ineligible to be approved. If you add something that another plugin doesn't do already, it'll be reviewable, but it's not in its current state.

    That being said, using nine individual cvars is not the best way to approach this. The best method would be to use a single cvar and assign a number to each class (1 = scout, 2 = soldier, etc).

    Then you could just change the cvar to the class that you want to force.

    I'm unapproving this for now, but PM me or another approver if you add something that sets this plugin apart from those that already exist.
    I was going to add a single cvar, but I didn't know how I would implement it with the numbers, so that's why I added 9 cvars.
    __________________
    My Plugins
    Modified Plugins:
    Building Spawner
    Monster
    It's Raining Men!
    Tutorials:
    Custom Gamemode

    I DON'T DO PLUGIN REQUESTS.
    Bitl is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 12-08-2012 , 17:17   Re: [TF2] Force Class
    Reply With Quote #6

    You could do something like this:

    PHP Code:
    switch(GetConVarInt(myCvar)) {
        case 
    1TF2_SetPlayerClass(clientTFClass_Scout);
        case 
    2TF2_SetPlayerClass(clientTFClass_Soldier);
        case 
    3TF2_SetPlayerClass(clientTFClass_Pyro);
        
    // etc etc

    __________________
    Dr. McKay is offline
    Bitl
    Senior Member
    Join Date: Jul 2012
    Old 12-08-2012 , 17:33   Re: [TF2] Force Class
    Reply With Quote #7

    Quote:
    Originally Posted by Dr. McKay View Post
    You could do something like this:

    PHP Code:
    switch(GetConVarInt(myCvar)) {
        case 
    1TF2_SetPlayerClass(clientTFClass_Scout);
        case 
    2TF2_SetPlayerClass(clientTFClass_Soldier);
        case 
    3TF2_SetPlayerClass(clientTFClass_Pyro);
        
    // etc etc

    Thanks!

    On it.
    __________________
    My Plugins
    Modified Plugins:
    Building Spawner
    Monster
    It's Raining Men!
    Tutorials:
    Custom Gamemode

    I DON'T DO PLUGIN REQUESTS.
    Bitl is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 12-08-2012 , 19:12   Re: [TF2] Force Class
    Reply With Quote #8

    • The round_start event doesn't have a userid property (and I don't think it is even called in TF2?)
    • You should document what numbers correspond to what class
    • Hooking player_changeclass is superfluous since you're already hooking player_spawn and forcing the class there

    I'd recommend just removing everything except for the player_spawn hook and forcing the class there. Once that's done, I'd say this is approvable.
    __________________
    Dr. McKay is offline
    Bitl
    Senior Member
    Join Date: Jul 2012
    Old 12-08-2012 , 19:25   Re: [TF2] Force Class
    Reply With Quote #9

    Done all of those changes now!
    __________________
    My Plugins
    Modified Plugins:
    Building Spawner
    Monster
    It's Raining Men!
    Tutorials:
    Custom Gamemode

    I DON'T DO PLUGIN REQUESTS.
    Bitl is offline
    Dr. McKay
    Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
    Join Date: Aug 2011
    Location: Atlantis
    Old 12-08-2012 , 19:29   Re: [TF2] Force Class
    Reply With Quote #10

    Looks good to me, good job.
    __________________
    Dr. McKay 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 10:29.


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