27.03.2014, 10:38
pawn Код:
forward RandomWar();
public RandomWar()
{
new string[128], team1, team2, team3;
new RandomTeams[][] =
{
{T_ENGLAND},
{T_RUSSIA},
{T_IRAQ},
{T_MEXICO}
};
team1 = random(sizeof(RandomTeams));
team2 = random(sizeof(RandomTeams));
team3 = random(sizeof(RandomTeams));
if(team1 == team2) team1 = team3;
if(team2 == team1 && team1 != team3) team2 = team3;
format(string, sizeof string, "A random war has started between team %s and %s!", TeamName(team1), TeamName(team2));
SendClientMessageToAll(C_WHITE, string);
}
pawn Код:
stock TeamName(teamid)
{
new team[32];
if(teamid == T_ENGLAND) team = ("England");
if(teamid == T_RUSSIA) team = ("Russia");
if(teamid == T_IRAQ) team = ("Iraq");
if(teamid == T_MEXICO) team = ("Mexico");
return team;
}
pawn Код:
A random war has started between team and !