Need help with Team Chat..
#1

So the problem is I can't see what I'am writing in global chat..

Team chat is working fine!

Code:

PHP код:
SendBALLASMessage(colortext[])
{
    foreach(
Playeri)
    {
        if (
gTeam[i] == BALLAS)
        {
            
SendClientMessage(icolortext);
        }
    }
    return 
1;
}
SendGROVEMessage(colortext[])
{
    foreach(
Playeri)
    {
        if(
gTeam[i] == GROVE)
        {
            
SendClientMessage(icolortext);
        }
    }
    return 
1;
}
SendVAGOSMessage(colortext[])
{
    foreach(
Playeri)
    {
        if(
gTeam[i] == VAGOS)
        {
            
SendClientMessage(icolortext);
        }
    }
    return 
1;
}
SendAZTECAMessage(colortext[])
{
    foreach(
Playeri)
    {
        if(
gTeam[i] == AZTECA)
        {
            
SendClientMessage(icolortext);
        }
    }
    return 
1;
}
public 
OnPlayerText(playeridtext[])
{
    if(
text[0] == '#')
    {
        new 
NameP[256], string[256];
        for(new 
i=0i<256i++)
        {
            if(
gTeam[playerid] == BALLAS)
            {
                
GetPlayerName(playerid,NameP,sizeof(NameP));
                
format(string,sizeof(string),"|- Ballas Radio -| (%s): %s",NameP,text[1]);
                
SendBALLASMessage(GetPlayerColor(playerid), string);
                return 
0;
            }
            if( 
gTeam[playerid] == GROVE)
            {
                
GetPlayerName(playerid,NameP,sizeof(NameP));
                
format(string,sizeof(string),"|- Grove Radio -| (%s): %s",NameP,text[1]);
                
SendGROVEMessage(GetPlayerColor(playerid), string);
                return 
0;
            }
            if( 
gTeam[playerid] == VAGOS)
            {
                
GetPlayerName(playerid,NameP,sizeof(NameP));
                
format(string,sizeof(string),"|- Vagos Radio -| (%s): %s",NameP,text[1]);
                
SendVAGOSMessage(GetPlayerColor(playerid), string);
                return 
0;
            }
            if( 
gTeam[playerid] == AZTECA)
            {
                
GetPlayerName(playerid,NameP,sizeof(NameP));
                
format(string,sizeof(string),"|- Varios Radio -| (%s): %s",NameP,text[1]);
                
SendAZTECAMessage(GetPlayerColor(playerid), string);
                return 
0;
            }
        }
    }
    return 
0;

Reply
#2

Try this:
pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
        new NameP[256], string[256];
        for(new i = 0; i < 256; i ++)
        {
            if(gTeam[playerid] == BALLAS)
            {
                GetPlayerName(playerid, NameP, sizeof(NameP));
                format(string, sizeof(string), "|- Ballas Radio -| (%s): %s", NameP, text[1]);
                SendBALLASMessage(GetPlayerColor(playerid), string);
                return 0;
            }
            if( gTeam[playerid] == GROVE)
            {
                GetPlayerName(playerid, NameP, sizeof(NameP));
                format(string, sizeof(string), "|- Grove Radio -| (%s): %s", NameP, text[1]);
                SendGROVEMessage(GetPlayerColor(playerid), string);
                return 0;
            }
            if( gTeam[playerid] == VAGOS)
            {
                GetPlayerName(playerid, NameP, sizeof(NameP));
                format(string, sizeof(string), "|- Vagos Radio -| (%s): %s", NameP, text[1]);
                SendVAGOSMessage(GetPlayerColor(playerid), string);
                return 0;
            }
            if( gTeam[playerid] == AZTECA)
            {
                GetPlayerName(playerid, NameP, sizeof(NameP));
                format(string, sizeof(string), "|- Varios Radio -| (%s): %s", NameP, text[1]);
                SendAZTECAMessage(GetPlayerColor(playerid), string);
                return 0;
            }
        }
    }
    return 1;
}
Reply
#3

+rep
Reply
#4

Woah woah woah, why is the loop in there for?

pawn Код:
public OnPlayerText(playerid, text[])
{
    if(text[0] == '#')
    {
        new NameP[24], string[150];
        GetPlayerName(playerid, NameP, sizeof(NameP));
        switch(gTeam[playerid])
        {
            case BALLAS:
            {
                format(string, sizeof(string), "|- Ballas Radio -| (%s): %s", NameP, text[1]);
                SendBALLASMessage(GetPlayerColor(playerid), string);
                return 0;
            }
            case GROVE:
            {
                format(string, sizeof(string), "|- Grove Radio -| (%s): %s", NameP, text[1]);
                SendGROVEMessage(GetPlayerColor(playerid), string);
                return 0;
            }
            case VAGOS:
            {
                format(string, sizeof(string), "|- Vagos Radio -| (%s): %s", NameP, text[1]);
                SendVAGOSMessage(GetPlayerColor(playerid), string);
                return 0;
            }
            case AZTECA:
            {
                format(string, sizeof(string), "|- Varios Radio -| (%s): %s", NameP, text[1]);
                SendAZTECAMessage(GetPlayerColor(playerid), string);
                return 0;
            }
        }
    }
    return 1;
}
Reply
#5

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
Woah woah woah, why is the loop in there for?
Holly Jesus! I noticed that too, now!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)