18.04.2011, 22:40
pawn Code:
stock ChooseRandomPlayer() // Function by Admantis
{
new TMP, TOTAL; // Creates TMP and TOTAL
for(new I = 0; I < MAX_PLAYERS; I++) // Player loop
{
if (IsPlayerConnected(I)) { TMP += 1; } // If player is connected, count is increased
}
TOTAL = random(TMP); // TOTAL is equal of the random of online players
return TOTAL; // Returning a value (TOTAL)
}
pawn Code:
gTeam[ChooseRandomPlayer()] = 1;
SetPlayerTeam(ChooseRandomPlayer(), 1);