19.02.2015, 10:00
How can I choose a random player if one team has 0 members and send him a message
new count[3], randomid; // Define "count" and "randomid"
foreach(Player, i) // Loop through all connected players and define them as "i"
{
switch(GetPlayerTeam(i)) // Starts a switch to find the team of "i"
{
case 0: count[0] ++; // If "i"'s team is 0, it increases count[0] by one
case 1: count[1] ++; // If "i"'s team is 1, it increases count[1] by one
case 2: count[2] ++; // If "i"'s team is 2, it increases count[2] by one
}
randomid = random(sizeof(i)); // Declares "randomid" as a random value between "i"
// Not sure this ^ will work, i haven't tested it
}
if(count[0] == 0 || count[1] == 0 || count[2] == 0) SendClientMessage(randomid, -1, "One of the teams has 0 members.");
// Sends "randomid" (which was declared above) a message, if one of the "count"'s is 0