SourceOP
Melee votes - Printable Version

+- SourceOP (http://forums.sourceop.com)
+-- Forum: SourceOP Server (http://forums.sourceop.com/SourceOP-Server-forum)
+--- Forum: General Chat (http://forums.sourceop.com/General-Chat--25-forum)
+--- Thread: Melee votes (/Melee-votes-thread)

Pages: 1 2


Melee votes - Drunken F00l - Jan 18, 2008

I've implemented a melee vote system using SourceOP's Lua system. It's quite simple really. First I coded a generic Vote class which uses my Menu class to display voting options. Then, from that, I made an "AbstainableVote" class where players can choose to abstain. After that, coding the melee vote wasn't very difficult.

Code:
function meleevoteover( vote )
  local yesvotes    = vote.picks[1]
  local novotes     = vote.picks[2]
  local abstentions = vote.picks[3]

  if(yesvotes >= novotes) then
    wintext = "Yes wins:  "
    game.ConsoleCommand("DF_tf2_meleeonly 1")
  else
    wintext = "No wins:  "
    game.ConsoleCommand("DF_tf2_meleeonly 0")
  end

  wintext = wintext .. "Yes: " .. yesvotes .. ", No: " .. novotes .. ", Abstain: " .. abstentions .. "\n"
  sourceop.SayTextAll(wintext)
end

function meleevote( pPlayer, command, arguments )
  if(!pPlayer || pPlayer:IsAdmin(8, "admin_meleevote")) then
    AbstainableVote("Enable melee only mode?",
                    {"Yes", "No", "Abstain"}, 3, 30,
                    "Abstain is the default choice.\nAbstentions go to the majority.",
                    meleevoteover)
  end
end

if(sourceop.FeatureStatus(FEAT_ADMINCOMMANDS)) then
  concommand.Add("admin_meleevote", meleevote)
end

The code will probably change as I finalize some things. 30 is the number of seconds the vote stays up. 3 just tells AbstainableVote which choice is the Abstain one (3rd one).

The vote can only be started by admins and isn't automatic or on a schedule (unless people want it like that?).

I just thought I'd share some recent development.

Oh, and here is what it looks like in game:
http://www.sourceop.com/screenshots/meleevote.jpg


Melee votes - OmegaZero_Alpha - Jan 18, 2008

I think it should be able to be initiated by the winning team, or the point leader.


Melee votes - Biggs - Jan 18, 2008

Seems like a pretty good setup.


Just a suggestion, but it'd be cool if it did a vote right before sudden death to make SD melee only.

I know another server I've played on automatically switches everyone to the same class (it's random which class it is) on sudden death and makes it melee only. It's pretty fun and makes SD go a lot faster, but it would be much better if it were setup on a vote system so that the players decide whether to do it or not.


Melee votes - Drunken F00l - Jan 18, 2008

I don't want to annoy players with a vote every 15 minutes though.


Melee votes - OmegaZero_Alpha - Jan 19, 2008

you could make it one per map.


Melee votes - Biggs - Jan 19, 2008

Drunken_F00l Wrote:I don't want to annoy players with a vote every 15 minutes though.
Yea, didn't think about that. Votes can be quite distracting sometimes too.


Melee votes - Drunken F00l - Jan 19, 2008

OmegaZero_Alpha Wrote:you could make it one per map.

Even once per map would get annoying.


Melee votes - OmegaZero_Alpha - Jan 19, 2008

I wouldn't mind one vote per map. (especially when the deadlocks on 2fort last for hours.)

Than again, people could abuse the system in strategic situations.

I would keep it as an administrator-only feature unless you re-implement the credit system.


Melee votes - Dynamo - Jan 26, 2008

Personally I think the vote should just come up at the beginning of 2fort.


Melee votes - Drunken F00l - Jan 26, 2008

Ya, that's because you loved it so much when I did it last night (or really early this morning I guess).