Now guys I am doing a TeamsWar and I don't know how to do the automatic team choice for every player that sign up !
so I made two methods may you please tell me if they will work properly.
and tell me what method to choose from, BTW I am not a good coder I am still a beginner so just don't come here to make fun of me. if you have a better way to do it may you please explain how :)
Here is the code !
so I made two methods may you please tell me if they will work properly.
and tell me what method to choose from, BTW I am not a good coder I am still a beginner so just don't come here to make fun of me. if you have a better way to do it may you please explain how :)
Here is the code !
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Conquer_Online_Server.Client;
using Conquer_Online_Server.Network.GamePackets;
namespace Conquer_Online_Server.Game.Features.Tournaments
{
class TeamsWar
{
public static string EventName = "TeamsWar";
public static const int BlueTN = 1000
, RedTN = 1001
, BlackTN = 1002
, GreenTN = 1003;
public static int BlueTeamKills, RedTeamKills, BlackTeamKills, GreenTeamKills;
public static int MapID = 11123;
public static int BlueTC = 0
, RedTC = 0
, BlackTC = 0
, GreenTC = 0;
#region TeamChoice2
public static bool isBlueC = false
, isRedC = false
, isBlackC = false
, isGreenC = false;
#endregion
public static void killingFromEnemies(GameClient killer, GameClient Killed)
{
Message msg;
msg = new Message("", System.Drawing.Color.Red, Message.FirstRightCorner);
msg = new Message("BlueTeamKills Kills ! : " + BlueTeamKills, System.Drawing.Color.Red, Message.ContinueRightCorner);
msg = new Message("RedTeamKills Kills ! : " + RedTeamKills, System.Drawing.Color.Red, Message.ContinueRightCorner);
msg = new Message("BlackTeamKills Kills ! : " + BlackTeamKills, System.Drawing.Color.Red, Message.ContinueRightCorner);
msg = new Message("GreenTeamKills Kills ! : " + GreenTeamKills, System.Drawing.Color.Red, Message.ContinueRightCorner);
// Effect place !
Kernel.SendWorldMessage(msg, Program.GamePool, (ushort)MapID);
}
public static void TeamChoice()
{
int choice = 0;
Client.GameClient client = new GameClient(null);
if (BlueTC > RedTC && BlueTC > BlackTC && BlueTC > GreenTC)
choice = Kernel.RandFromGivingNums(RedTN, BlackTN, GreenTN);
else if (RedTC > BlueTC && RedTC > BlackTC && RedTC > GreenTC)
choice = Kernel.RandFromGivingNums(BlueTN, BlackTN, GreenTN);
else if (BlackTC > BlueTC &&
BlackTC > RedTC &&
BlackTC > GreenTC)
{
choice = Kernel.RandFromGivingNums(BlueTN, RedTN, GreenTN);
}
else if (GreenTC > BlueTC &&
GreenTC > BlackTC &&
GreenTC > RedTC)
{
choice = Kernel.RandFromGivingNums(BlueTN, RedTN, BlackTN);
}
else
{
choice = Kernel.RandFromGivingNums(BlueTN, RedTN, BlackTN, GreenTN);
}
switch (choice)
{
case BlueTN:
{
BlueTC++;
client.Entity.isBlueTeam = true;
break;
}
case RedTN:
{
RedTC++;
client.Entity.isRedTeam = true;
break;
}
case BlackTN:
{
BlackTC++;
client.Entity.isBlackTeam = true;
break;
}
case GreenTN:
{
GreenTC++;
client.Entity.isBlackTeam = true;
break;
}
break;
}
}
public static void TeamChoice2()
{
Client.GameClient client = new GameClient(null);
if (isBlueC == true && isRedC == true && isBlackC == true && isGreenC == true)
{
isBlueC = false;
isRedC = false;
isBlackC = false;
isGreenC = false;
}
if (isBlueC == false && isRedC == false && isBlackC == false && isGreenC == false)
{
isBlueC = true;
client.Entity.isBlueTeam = true;
BlueTC++;
}
else if (isBlueC == true)
{
isRedC = true;
client.Entity.isRedTeam = true;
RedTC++;
}
else if (isRedC == true)
{
isBlackC = true;
client.Entity.isBlackTeam = true;
BlackTC++;
}
else if (isBlackC == true)
{
isGreenC = true;
client.Entity.isGreenTeam = true;
GreenTC++;
}
}
}
}