Why wont this work?
#1

Not finished yet, but it should choose 2 random teams and then send a clientmessage to all, saying which teams are chosen:
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);

}
The stock:
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;
}
And in game it prints:
pawn Код:
A random war has started between team  and !
Reply


Messages In This Thread
Why wont this work? - by Dan. - 20.08.2012, 19:22
Re: Why wont this work? - by RicaNiel - 20.08.2012, 19:27
Re: Why wont this work? - by Dan. - 20.08.2012, 19:30
Re: Why wont this work? - by RicaNiel - 20.08.2012, 19:35
Re: Why wont this work? - by Dan. - 21.08.2012, 07:47

Forum Jump:


Users browsing this thread: 1 Guest(s)