Last active
January 3, 2016 13:19
-
-
Save MrBluePotato/8468431 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void NewVote() | |
{ | |
VoteIsOn = true; | |
} | |
public static void takeVote() | |
{ | |
VoteThread = new Thread(new ThreadStart(delegate | |
{ | |
NewVote(); | |
Server.Players.Message("&S--------------------------------------------------------------"); | |
Server.Players.Message("Vote for the next map!"); | |
Server.Players.Message("&S/Vote &c1&S for {0}&S, &c2&S for {1}&S, and &c3&S for {2}"); | |
Server.Players.Message("&S--------------------------------------------------------------"); | |
VoteIsOn = true; | |
Thread.Sleep(60000); | |
VoteCheck(); | |
})); VoteThread.Start(); | |
} | |
static void VoteCheck() | |
{ | |
if (VoteIsOn) | |
{ | |
if (Voted1 < Voted2 || Voted1 < Voted3) | |
{ | |
_winningWorld = world1; | |
return; | |
} | |
else if (Voted2 < Voted1 || Voted2 < Voted3) | |
{ | |
_winningWorld = world2; | |
return; | |
} | |
else if (Voted3 < Voted1 || Voted3 < Voted2) | |
{ | |
_winningWorld = world3; | |
return; | |
} | |
_world = _winningWorld; | |
Server.Players.Message("&S--------------------------------------------------------------"); | |
Server.Players.Message("&SVoting results are in! &A{0}&S:&C{1}, &A{2}&S:&C{3}, &A{4}&S:&C{5}", world1.ClassyName, | |
Voted1, world2.ClassyName, Voted2, world3.ClassyName, Voted3); | |
Server.Players.Message("&SThe next map is: {0]", _winningWorld.ClassyName); | |
Server.Players.Message("&S--------------------------------------------------------------"); | |
VoteIsOn = false; | |
foreach (Player V in Voted) | |
{ | |
V.HasVoted = false; | |
} | |
foreach (Player p in _world.Players) | |
{ | |
p.JoinWorld(_world, WorldChangeReason.Rejoin); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment