loop problem
#1

Hello. When I put some messages under a loop , the message gets send twice if 2 players are online? Why?
Reply
#2

Because you have scripted it like that.
Reply
#3

Well, that sounds like you're using the function SendClientMessageToAll in a loop, in which case why are you using a loop? If you want to send a message to everyone, just use SendClientMessageToAll on its own.
Reply
#4

That was a nice answer MadeMan.

And yes JaTochNietDan

but how in this case?

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
    {
        if(IsPlayerConnected(i))
        {
            if(gTeam[i] == 1)
            {
                SendClientMessageToTeam(team1,teamcolor, "....");
            }
            if(gTeam[i] == 2)
            {
                SendClientMessageToTeam(team2,teamcolor2, "....");
            }
        }
    }
Reply
#5

Quote:
Originally Posted by fissekarl
Посмотреть сообщение
That was a nice answer MadeMan.
It was a nice question too.
Reply
#6

ok MadeMan....

So how could I do that with gteam?

Should I do it outside a loop?
Reply
#7

What are you trying to do?
Reply
#8

This is why I want to use the loop

pawn Код:
for (new i = 0; i < MAX_PLAYERS; i++)
{
    if(IsPlayerConnected(i))
    {
        if(gTeam[i] == 1)
        {
            SetTeamPos(1, X , Y , Z);
            SetPlayerFacingAngle(i, angle);
            SetCameraBehindPlayer(i);
            SendClientMessageToTeam(team1,teamcolor, "....");
        }
        if(gTeam[i] == 2)
        {
            SetTeamPos(2, X , Y , Z);
            SetPlayerFacingAngle(i, angle);
            SetCameraBehindPlayer(i);
            SendClientMessageToTeam(team2,teamcolor2, "....");");
        }
    }
}
but is the loop needed?
Reply
#9

What does SetTeamPos do?
Reply
#10

It sets all players from Team 1's pos to X,Y,Z
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)