Votemap plugin 1.6
Based on @VSpeed 's Votekick plugin
Current features:
For All Users:
vote for nextmap
vote for specified map
vote for map restart
vote for specified mode
vote for specified map with mode
For Admin:
change map to next
change to specified map with mode. Ex: !map un ffa
fast restart map
change to specified mode. Ex: !mode ffa
Requirements:
Requires @Nukem Server Addon 1.206
install:
Extract all files in this rar to the plugins folder
add the following to sv_config.ini:
HOW TO USE ?
Available commands:
For All Users:
For Admin:
Map lists:
Modelist:
Changelog:
Credits:
@Nukem the great addon
@iAegle source of votekick
@VSpeed improve source of votekick make it get work
Test Server:
CO=TEAM 2# 221.136.82.193:27017
Source:
sorry for my poor english...
anyone who downloaded 1.6 yesterday, pls download it again
Based on @VSpeed 's Votekick plugin
Current features:
For All Users:
vote for nextmap
vote for specified map
vote for map restart
vote for specified mode
vote for specified map with mode
For Admin:
change map to next
change to specified map with mode. Ex: !map un ffa
fast restart map
change to specified mode. Ex: !mode ffa
Requirements:
Requires @Nukem Server Addon 1.206
install:
Extract all files in this rar to the plugins folder
add the following to sv_config.ini:
Code:
[VOTEMAP]
//cooldown between two vote progress
cooldown=120
//time from vote start to end
votetime=60
//time between each notice
votemsginterval=3
successpercent=50HOW TO USE ?
Available commands:
For All Users:
Code:
!cmds show all commands of this plugin
!vn call a vote for nextmap
!maplist show map list
!modelist show mode list
!vm (shortname) [gametype] vote for specified map with mode(selectable). Ex: !vm un ffa
!y vote YES
!n vote NO
!vfr call a vote for fast restartFor Admin:
Code:
!nm change map to next
!map (shortname) [gametype] change to specified map with mode. Ex: !map un ffa
!fr fast restart map
!mode [gametype] change to specified mode. Ex: !mode ffaMap lists:
Code:
[Map name] [shortname]
Underground un
Outpost ou
Dome do
Resistance re
Carbon ca
Fallen fa
Lockdown lo
Mission mi
Seatown se
Bootleg bo
Hardhat ha
Bakaara ba
Interchange in
Downturn dt
Arkaden ar
Village vi
dlc1
Liberation li
Black box bb
Piazza pi
Overwatch ov
dlc2
Foundation fo
Getaway ge
Sanctuary sa
Oasis oa
Lookout lt
dlc3
Vortex vo
U-Turn ut
Intersection is
dlc4
Parish pa
Boardwalk bw
Gulch gu
Decommission de
Offshore of
FREE MULTIPLAYER MAP
Erosion er
Aground ag
Terminal teModelist:
Code:
[Mode name] [gametype]
Free-For-All ffa
Search and Destroy sd
Team Deathmatch tdm
Domination dom
Capture the Flag ctf
Headquarters hq
Gun Game gun
Sabotage sab
Team Defender tdef
Kill Confirmed kc
Drop Zone dz
Infected inf
Juggernaut jug
Team Juggernaut tj
One In The Chamber oicChangelog:
Code:
1.6 all DLC support(MP and FaceOff maps)
fix bug on Getaway
1.5 add 6 maps support
1.4 add DLC1,2 map support
1.3 add gametype support
when amount of Need reached, map or mode would be changed in 5 seconds
add commands for Admin
1.21 maplist style change
1.2 fix cooldown bug
add successful vote percent option
add !vfr command
add 5s delay in !cmds make it easy to read
do some cleaning
1.1 decrease hud message length make it easy to read
changed !vm useage now: !vm(shortname) For example: !vmun
1.0 Initial versionCredits:
@Nukem the great addon
@iAegle source of votekick
@VSpeed improve source of votekick make it get work
Test Server:
CO=TEAM 2# 221.136.82.193:27017
Source:
Spoiler (Click to View)
Code:
using System;
using System.Collections.Generic;
using System.Threading;
using Addon;
namespace mw3_votemap
{
public class Votemap : CPlugin
{
string map_name;
string mapname;
Vote vote;
int Interval;
int VoteTime;
int votemsginterval;
List<int> validPN;
int Vtime;
int successpercent;
public override void OnServerFrame()
{
if (Interval > 0)
Interval--;
if (VoteTime > 0 && vote.InProgress)
{
if (VoteTime % votemsginterval == 0)
{
validPN = new List<int>();
foreach (ServerClient player in GetClients())
{
if (player.Ping < 999 && player.Ping > 0)
{
validPN.Add(player.ClientNum);
}
}
if (validPN.Count == 0)
{
vote.votenext = false;
vote.votemaprestart = false;
vote.votemap = false;
vote.InProgress = false;
}
foreach (ServerClient player in GetClients())
{
if (vote.votemaprestart)
{
//TellClient(player.ClientNum, "^1(" + VoteTime / 50 + "s) ^2" + player.Name + " ^5called a vote for nextmap. Type ^3!y ^5or ^3!n ^5to vote [^3Need " + Math.Ceiling(validPN.Count * 0.6) + " ^2Yes " + vote.Agree.Count + " ^1No " + (vote.Against.Count) + "]", true);
iPrintLnBold("^1(" + VoteTime / 50 + "s)^5Restart map? Type ^3!y ^5or ^3!n ^5to vote [^3Need " + Math.Ceiling(validPN.Count * successpercent * 0.01) + " ^2Y " + vote.Agree.Count + " ^1N " + (vote.Against.Count) + "]", player);
}
if (vote.votenext)
{
//TellClient(player.ClientNum, "^1(" + VoteTime / 50 + "s) ^2" + player.Name + " ^5called a vote for nextmap. Type ^3!y ^5or ^3!n ^5to vote [^3Need " + Math.Ceiling(validPN.Count * 0.6) + " ^2Yes " + vote.Agree.Count + " ^1No " + (vote.Against.Count) + "]", true);
iPrintLnBold("^1(" + VoteTime / 50 + "s)^5Go to ^3NEXTMAP^5? Type ^3!y ^5or ^3!n ^5to vote [^3Need " + Math.Ceiling(validPN.Count * successpercent * 0.01) + " ^2Y " + vote.Agree.Count + " ^1N " + (vote.Against.Count) + "]", player);
}
if (vote.votemap)
{
//TellClient(player.ClientNum, "^1(" + VoteTime / 50 + "s) ^2" + player.Name + " ^5vote for ^3<" + mapname + ">^5. Type ^3!y ^5or ^3!n ^5to vote [^3Need " + Math.Ceiling(validPN.Count * 0.6) + " ^2Yes " + vote.Agree.Count + " ^1No " + (vote.Against.Count) + "]", true);
iPrintLnBold("^1(" + VoteTime / 50 + "s)^5Go to ^3" + mapname + "^5? Type ^3!y ^5or ^3!n ^5to vote[^3Need " + Math.Ceiling(validPN.Count * successpercent * 0.01) + " ^2Y " + vote.Agree.Count + " ^1N " + (vote.Against.Count) + "]", player);
}
}
}
VoteTime--;
if (VoteTime == 0 && vote.InProgress)
{
if (vote.votemaprestart)
{
if ((Convert.ToDouble(vote.Agree.Count) / Convert.ToDouble(validPN.Count) * 100) >= successpercent)
{
ServerSay("^3VOTE PASSED:MAP RESTART", true);
ServerCommand("fast_restart");
}
else
ServerSay("^3VOTE FAILED: NOT ENOUGH PLAYERS AGREE TO RESTART MAP.", true);
}
if (vote.votenext)
{
if ((Convert.ToDouble(vote.Agree.Count) / Convert.ToDouble(validPN.Count) * 100) >= successpercent)
{
ServerSay("^3VOTE PASSED:MAP CHANGED", true);
ServerCommand("map_rotate");
}
else
ServerSay("^3VOTE FAILED: NOT ENOUGH PLAYERS AGREE TO CHANGE MAP.", true);
}
if (vote.votemap)
{
if ((Convert.ToDouble(vote.Agree.Count) / Convert.ToDouble(validPN.Count) * 100) >= successpercent)
{
ServerSay("^3VOTE PASSED:MAP CHANGED", true);
ServerCommand("map " + map_name);
}
else
ServerSay("^3VOTE FAILED: NOT ENOUGH PLAYERS AGREE TO CHANGE MAP.", true);
}
ResetVars();
}
}
}
public override void OnServerLoad()
{
ServerPrint("Votemap plugin 1.21 loaded. Author: zhp0083 Special thanks: Nukem, iAegle, VSpeed");
votemsginterval = Convert.ToInt32(GetServerCFG("VOTEMAP", "votemsginterval", "")) * 50;
Vtime = Convert.ToInt32(GetServerCFG("VOTEMAP", "votetime", "")) * 50;
successpercent = Convert.ToInt32(GetServerCFG("VOTEMAP", "successpercent", ""));
}
public override ChatType OnSay(string Message, ServerClient Client)
{
string lowMsg = Message.ToLower();
if (lowMsg.Equals("!vn"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votenext = true;
VoteTime = Vtime;
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!y"))
{
if (!vote.InProgress)
{
TellClient(Client.ClientNum, "^3There is currently no vote in progress! To start a vote, type ^2!vn ^3or ^2!vm(shortname) ^3in chat.", true);
}
if (vote.InProgress)
{
if (!vote.Agree.Contains(Client.XUID) && !vote.Against.Contains(Client.XUID))
{
vote.Agree.Add(Client.XUID);
ServerSay("^3"+ Client.Name+" ^2voted ^1<YES>",true);
}
else if (vote.Agree.Contains(Client.XUID) || vote.Against.Contains(Client.XUID))
{
TellClient(Client.ClientNum, "^3You already voted!", true);
}
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!n"))
{
if (!vote.InProgress)
{
TellClient(Client.ClientNum, "^3There is currently no vote in progress! To start a vote, type ^2!vn ^3or ^2!vm(shortname) ^3in chat.", true);
}
if (vote.InProgress)
{
if (!vote.Agree.Contains(Client.XUID) && !vote.Against.Contains(Client.XUID))
{
vote.Against.Add(Client.XUID);
ServerSay("^3" + Client.Name + " ^2voted ^1<NO>", true);
}
else if (vote.Agree.Contains(Client.XUID) || vote.Against.Contains(Client.XUID))
{
TellClient(Client.ClientNum, "^3You already voted!", true);
}
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!mlist"))
{
Thread shru = new Thread(showmaplist);
shru.Start(Client);
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmun"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Underground";
map_name = "mp_underground";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmou"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Outpost";
map_name = "mp_radar";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmdo"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Dome";
map_name = "mp_dome";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmre"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Resistance";
map_name = "mp_paris";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmca"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Carbon";
map_name = "mp_carbon";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmin"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Interchange";
map_name = "mp_interchange";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmdt"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Downturn";
map_name = "mp_exchange";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmar"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Arkaden";
map_name = "mp_plaza2";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmlo"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Lockdown";
map_name = "mp_alpha";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmmi"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Mission";
map_name = "mp_bravo";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmse"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Seatown";
map_name = "mp_seatown";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmbo"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Bootleg";
map_name = "mp_bootleg";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmha"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Hardhat";
map_name = "mp_hardhat";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmba"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Bakaara";
map_name = "mp_mogadishu";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmvi"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Village";
map_name = "mp_village";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vmfa"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemap = true;
VoteTime = Vtime;
mapname = "Fallen";
map_name = "mp_lambeth";
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!vfr"))
{
if (Interval > 0)
{
TellClient(Client.ClientNum, "^3You can't start a vote now! wait " + Interval / 50 + " seconds.", true);
return ChatType.ChatNone;
}
if (vote.InProgress)
{
TellClient(Client.ClientNum, "^3There's already a vote in progress!", true);
}
else
{
vote.Agree = new List<string>();
vote.Against = new List<string>();
vote.InProgress = true;
vote.votemaprestart = true;
VoteTime = Vtime;
}
return ChatType.ChatNone;
}
else if (lowMsg.Equals("!cmds"))
{
Thread shru = new Thread(showcmds);
shru.Start(Client);
return ChatType.ChatNone;
}
return ChatType.ChatContinue;
}
public struct Vote
{
public bool InProgress;
public ServerClient Client;
public List<string> Agree;
public List<string> Against;
public bool votenext;
public bool votemap;
public bool votemaprestart;
}
private void ResetVars()
{
//reset vars
validPN.Clear();
VoteTime = 0;
vote.Agree.Clear();
vote.Against.Clear();
vote.InProgress = false;
vote.votenext = false;
vote.votemap = false;
vote.votemaprestart = false;
//set cooldown timer
Interval = Convert.ToInt32(GetServerCFG("VOTEMAP", "cooldown", "")) * 50;
}
private void showcmds(object cli)
{
ServerClient Client = (ServerClient)cli;
TellClient(Client.ClientNum, "^3!vfr ^5--- ^2call a vote for fast restart", true);
Thread.Sleep(5000);
TellClient(Client.ClientNum, "^3!vn ^5--- ^2call a vote for nextmap", true);
Thread.Sleep(5000);
TellClient(Client.ClientNum, "^3!mlist ^5--- ^2show map list and short name", true);
Thread.Sleep(5000);
TellClient(Client.ClientNum, "^3!vm(shortname) ^7--- ^2vote for specified map. ^1Ex:^3!vmun", true);
Thread.Sleep(5000);
TellClient(Client.ClientNum, "^3!y ^5--- ^2vote YES, ^3!n ^5--- ^2vote NO", true);
}
private void showmaplist(object cli)
{
ServerClient Client = (ServerClient)cli;
TellClient(Client.ClientNum, "^3[Map name] [shortname]", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Underground un", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Mission mi", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Interchange in", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Fallen fa", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Seatown se", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Village vi", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Bakaara ba", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Dome do", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Downturn dt", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Lockdown lo", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Outpost ou", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Arkaden ar", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Carbon ca", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Bootleg bo", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Hardhat ha", true);
Thread.Sleep(2500);
TellClient(Client.ClientNum, "^3Resistance re", true);
}
}
}sorry for my poor english...

anyone who downloaded 1.6 yesterday, pls download it again



![[Image: back_us_button.png]](http://static.squarespace.com/static/51cca4bae4b0bf9a1f4deb75/t/52ea6a9ee4b0f767960f8c35/1390493521990/back_us_button.png)
