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

[L4D2] Team Switch Vote (v1.2.0)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
AbyssStaresBack
Junior Member
Join Date: Jan 2011
Location: Texas, USA
Plugin ID:
2188
Plugin Version:
1.2.0
Plugin Category:
General Purpose
Plugin Game:
Left 4 Dead
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    Makes teams vote to allow a player to switch to their team
    Old 01-24-2011 , 10:50   [L4D2] Team Switch Vote (v1.2.0)
    Reply With Quote #1

    L4D2 Team Switch Vote 1.2.0

    This is my first attempt at a SourceMod plugin and I welcome constructive criticism and/or ideas on how to make this plugin and my coding style better. (I am a software developer IRL, so I have some idea of how things should be.)

    First, I'd like to give credit to AtomicStryker, as I used his method of switching a player's team from his L4D2 Score/Team Manager. (If there is a better/more proper way to give credit for someone else's work, please let me know.)

    How the plugin is used in-game

    The primary goal of this plugin is to prevent griefing, while affecting legitimate switches as little as possible.

    When a player makes a selection on the normal team selection screen (default 'M'), he/she is informed that the other team must vote to allow the switch. The other team is informed that they must vote using a menu displayed to each player with choices "Allow" and "Deny". Once a majority votes to allow/deny, or the voting time limit is reached, the player is either switched or not, depending on the result.

    Other things to keep in mind:
    • People who do not vote are counted as if they voted to deny
    • Admins (of any kind) may switch at will
    • Infected players may not switch while spawned (or in control of the tank), since it can cause serious bugs
    • If a switch goes through while a player is spawned as infected, they are informed that they may switch once they are on cooldown/in ghost mode. They may do so by selecting the team again, without the other team needing to vote again
    • Only one player at a time may be voted on, so while one player is switching, all others must wait. This greatly simplifies the voting process.
    • If a player fails two switch votes, they are not allowed to request a switch for 5 minutes. This prevents spamming the vote system.

    Commands

    Admin (GENERIC flag):
    • sm_forceswitch - force the current vote to go through (allow the player to switch)
    • sm_cancelswitch - cancel the current vote (do not allow the player to switch)

    Anyone:
    • sm_allowswitch - vote to allow the current switch request (opposing team only)
    • sm_denyswitch - vote to deny the current switch request (opposing team only)
    • sm_voteswap - opens a menu to choose a player on the opposite team to swap places with; swap must be approved by both teams; useful when both teams are full

    Cvars
    • l4d2switchvote_ver - Version of this plugin
    • l4d2switchvote_connwait (default 60) - Seconds after a map begins that switching can occur
    • l4d2switchvote_timeout (default 45) - Seconds that a vote is active before results are tallied
    • l4d2switchvote_delaytimeout (default 90) - Seconds after a vote is passed that a delayed switch is allowed (i.e., when spawned as infected when a vote passes)
    • l4d2switchvote_announce (default 1) - Announce the !voteswap command to users (set to 0 to turn off announcement)

    Installation
    • Download the gamedata file below (teamswitchvote.l4d2.txt) and place it in addons/sourcemod/gamedata (this contains signatures required by the plugin)
    • Get the plugin below and drop teamswitchvote.smx into addons/sourcemod/plugins

    Changelog

    So y'all don't think that I fail at math, here's how I count versions:
    <Version number (not likely to change)> . <Feature addition> . <Bug fix or tweak>
    • 1.2.0 - Added !voteswap command; removed Left 4 Downtown 2 dependency
    • 1.1.0 - Updated voting to use a menu and hint notifications, limiting gameplay interruption. Limit how often players can try to switch.
    • 1.0.4 - Reworked how voting is tallied (now using client ids as indexes into voting arrays); disconnected client votes are no longer counted
    • 1.0.3 - Fixed an oversight in how jointeam can be used; uncommented the section allowing admins to switch at will (it was commented out for testing...oops).
    • 1.0.2 - Fixed bug with timers on map change; admins who already receive the normal request to vote will not also receive the admin notification "Player x is attempting to change teams"
    • 1.0.1 - Switch request is cancelled when requesting client disconnects
    • 1.0.0 - Initial release

    Future Plans
    • Remember when a player spectates, so that they can rejoin their team without being voted in.
    • Fix the bugs with switching while controlling a spawned infected, so that people can switch even while spawned.
    • Translations; I can probably do the German translation, but the rest are up to Google Translate unless y'all help me out .
    • {DONE} Limit how often a player can request a switch
    Attached Files
    File Type: txt teamswitchvote.l4d2.txt (673 Bytes, 866 views)
    File Type: sp Get Plugin or Get Source (teamswitchvote.sp - 1717 views - 52.9 KB)

    Last edited by AbyssStaresBack; 03-28-2011 at 02:40. Reason: Corrected typo
    AbyssStaresBack is offline
    AbyssStaresBack
    Junior Member
    Join Date: Jan 2011
    Location: Texas, USA
    Old 01-29-2011 , 05:54   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #2

    I just updated this plugin to 1.1.0, which I feel makes a HUGE improvement in usability. I would really appreciate some feedback, even if it's just "I don't see any need for this plugin"...at least it could get people talking about it!

    So, what's changed? Instead of having players type !allowswitch or !denyswitch to vote, they are presented with a panel menu with options "Allow" and "Deny". This allows players to simply hit one button to vote instead of having to stop moving and type. Also, the voting notifications are now presented as hint messages, which seem to get the attention of players much better.

    I have been using this plugin on my server for the past couple of weeks and it has prevented numerous rage-switch-griefing moments (as players have tried to switch teams on map change, were denied, and then quit ). In addition, legitimate switches have gone extremely smoothly, showing that players catch on to the system quickly (mostly followed by comments of "nice...we get to vote on switchers!").

    As I said at the beginning, I'd love some feedback on how well/not well the plugin works for you, and what it needs to make it better.
    AbyssStaresBack is offline
    StartV.
    Junior Member
    Join Date: Dec 2010
    Old 01-29-2011 , 21:02   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #3

    Can you set half of the team say yes so the player can change the team.
    But not all players..

    And when a player changing his team ,I dun see a vote hint that contain allow or deny.
    Is it my problem. But I can press 1 to allow 2 to deny

    Last edited by StartV.; 01-29-2011 at 21:05. Reason: Forget sth
    StartV. is offline
    AbyssStaresBack
    Junior Member
    Join Date: Jan 2011
    Location: Texas, USA
    Old 01-30-2011 , 01:18   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #4

    Right now, the vote counting works just like the normal L4D2 voting. If you have 4 people on one team, then 3 must vote yes for the vote to pass. If 2 vote yes, and 2 vote no, then the vote does not pass. Of course, this means that if you have 2 people on a team, both will have to vote yes. Is that how the system is working for you? If so, then what do you think should be different? If not, then I definitely need to fix something!

    I think you are not seeing the vote hint, because you are on the same team as the person who wants to switch. Admins on the non-voting team will see a menu like this:

    <Player Name>
    wants to switch teams
    1. (Admin) Force Allow
    2. (Admin) Force Deny

    Admins on the voting team, will see a menu like this:

    <Player Name>
    wants to switch to your team
    1. Allow
    2. Deny
    3. (Admin) Force Allow
    4. (Admin) Force Deny

    The second menu comes with a voting hint. The first menu does not come with a voting hint, since you can't actually vote, only Force Allow or Force Deny. I could add a hint to the first menu if you want, though.
    AbyssStaresBack is offline
    seattle_ice
    Member
    Join Date: Dec 2010
    Old 01-30-2011 , 02:51   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #5

    I think it is a good idea for pub servers.

    So does this bypass the one team switch per map for a player? By context, I think it would, but just asking to be sure.
    seattle_ice is offline
    AbyssStaresBack
    Junior Member
    Join Date: Jan 2011
    Location: Texas, USA
    Old 01-30-2011 , 03:33   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #6

    Yes, this plugin allows for unlimited switches (it doesn't actually change the limiting cvar, it just bypasses the limit).
    AbyssStaresBack is offline
    Silvers
    SourceMod Plugin Approver
    Join Date: Aug 2010
    Location: SpaceX
    Old 01-30-2011 , 06:11   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #7

    This sounds very nice! Is there any change you can have like !voteswap command? To switch 2 players around in VS? Currently we use AtomicStykers plugin (I think) to swap players and manage teams, but useless if there are no admins.

    You should maybe mention that Left4Downtown is not exactly required, think you're only using the gamedata .txt signatures right?
    __________________
    Silvers is offline
    AbyssStaresBack
    Junior Member
    Join Date: Jan 2011
    Location: Texas, USA
    Old 01-30-2011 , 06:36   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #8

    That's a good point...although can't players just type "!spectate" and then switch teams? Of course, they might not know about that, and one player would have to wait to be voted on until the other switches, so I can look into adding a feature to swap two players.

    And you're right, I'm only using two signatures from the gamedata file, so should I just post my own gamedata file with the required signatures?

    Last edited by AbyssStaresBack; 01-30-2011 at 08:09. Reason: clarification
    AbyssStaresBack is offline
    seattle_ice
    Member
    Join Date: Dec 2010
    Old 01-30-2011 , 12:40   Re: [L4D2] Team Switch Vote (v1.1.0)
    Reply With Quote #9

    Quote:
    Originally Posted by AbyssStaresBack View Post
    And you're right, I'm only using two signatures from the gamedata file, so should I just post my own gamedata file with the required signatures?
    Not a bad idea, then you could say either/or without the requirement.
    seattle_ice is offline
    AbyssStaresBack
    Junior Member
    Join Date: Jan 2011
    Location: Texas, USA
    Old 02-14-2011 , 23:02   Re: [L4D2] Team Switch Vote (v1.2.0)
    Reply With Quote #10

    Version 1.2.0 is now up, and includes some suggestions I received...

    I have added a !voteswap command to allow two players to switch teams simultaneously (primarily for when both teams are full). One player enters !voteswap in chat, which brings up a menu listing the players on the opposing team. He/she then selects a player to swap with. Each team votes to allow/deny like normal, but both teams must approve the swap for it to go through.

    Also, I have removed the Left 4 Downtown 2 requirement by pulling out the two signatures I need into their own gamedata file. Credit goes to psychonic and ProdigySim for the signatures.

    So yeah, let me know what you think, and don't forget to delete the old cfg file, as I added a new cvar.
    AbyssStaresBack 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 01:33.


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