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
#2

try doing it as value
and define each value as team
might work
i hate string's kuje strcmp i cant get it work
Reply
#3

Also giving a warning:
pawn Код:
warning 204: symbol is assigned a value that is never used: "RandomTeams"
I'd like to get it work in this way.
Reply
#4

Quote:
Originally Posted by Dan.
Посмотреть сообщение
Also giving a warning:
pawn Код:
warning 204: symbol is assigned a value that is never used: "RandomTeams"
I'd like to get it work in this way.
Maybe you have define it and you havent used it
Reply
#5

Well I have used it, haven't I?
pawn Код:
team1 = random(sizeof(RandomTeams));
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)