Loop problem.
#3

The previous code was translated for better understanding, this is the code:

pawn Код:
public LippLoppeb()
{
    new string[256];
    format(string, sizeof(string),"LIPUMДNG: Mдng on lхppenud! {FF0000}PUNANE:{FFFFFF} %d, {00FF1A}ROHELINE:{FFFFFF} %d,{FFFFFF} vхitja tiimi liikmed saavad auhinna!",LipuInfo[lPunaneskoor], LipuInfo[lRohelineskoor]);
    SendClientMessageToAll(C_WHITE, string);

    for(new i= 0; i<MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(RohelineTiim[i] == true || PunaneTiim[i] == true)
            {
                SetPlayerInterior(i, 0);
                SpawnPlayer(i);
            }
            {
                if(LipuInfo[lPunaneskoor] > LipuInfo[lRohelineskoor])
                {
                    if(PunaneTiim[i] == true)
                    {
                        GivePlayerMoney(i, 10000);
                        SendClientMessage(i, C_GREEN, "LIPUMДNG: {D7DE16}Jesss!{33AA33} Olid vхitja tiimis ning teenisid 10 000$!");
                    }
                }
                else if(LipuInfo[lPunaneskoor] < LipuInfo[lRohelineskoor])
                {
                    if(RohelineTiim[i] == true)
                    {
                        GivePlayerMoney(i, 10000);
                        SendClientMessage(i, C_GREEN, "LIPUMДNG: {D7DE16}Jesss!{33AA33} Olid vхitja tiimis ning teenisid 10 000$!");
                    }
                }
                else if(LipuInfo[lPunaneskoor] == LipuInfo[lRohelineskoor])
                {
                    if(RohelineTiim[i] == true || PunaneTiim[i] == true)
                    {
                        GivePlayerMoney(i, 5000);
                        SendClientMessage(i, C_GREEN, "LIPUMДNG: {D7DE16}Jesss!{33AA33} Oli viik ning teenisid 5 000$!");
                    }
                }
            }
        }
    }
    return 1;
}
So this message:
pawn Код:
SendClientMessage(i, C_GREEN, "LIPUMДNG: {D7DE16}Jesss!{33AA33} Oli viik ning teenisid 5 000$!");
And the others too (except the first one that's outside the loop) are sent twice when 2 players are in the flag game. When 4 players playing the game, the message is sent 4 times to every player.
Reply


Messages In This Thread
Loop problem. - by Dan. - 12.05.2012, 11:39
Re: Loop problem. - by AndreT - 12.05.2012, 11:58
Re: Loop problem. - by Dan. - 12.05.2012, 13:00
Re: Loop problem. - by RedWingz - 12.05.2012, 13:05
Re: Loop problem. - by Dan. - 12.05.2012, 13:08
Re: Loop problem. - by RedWingz - 12.05.2012, 13:10
Re: Loop problem. - by Dan. - 12.05.2012, 13:16
Re: Loop problem. - by Dan. - 12.05.2012, 18:48
Re: Loop problem. - by AndreT - 12.05.2012, 20:29

Forum Jump:


Users browsing this thread: 3 Guest(s)