need help with a color chat
#1

i am trying to script a chat just like team chat but for colors (means if blue typed ![text] only other blues can see it) i have made a code but it has error , i will really appreciate if u guys can help me

Код:
public OnPlayerText(playerid, text[])
{

		new string[256];
 		if (text[0] == '!')
  	{
		new name[24];
		GetPlayerName(playerid, name, 24);
		format(string, 256, "[Color] %s : %s", name,text[1]);
		for (new a = 0; a < 20; a++) {
		if (IsPlayerConnected(a)) {
		if (GetPlayerColor[a] == GetPlayerColor[playerid]) SendClientMessage(a, orange, string);
		}
		}
		return 0;
	}
	return 1;
}
errors :
Код:
error 028: invalid subscript (not an array or too many subscripts): "GetPlayerColor"
Код:
warning 215: expression has no effect
Код:
error 001: expected token: ";", but found "]"
Код:
error 029: invalid expression, assumed zero
Код:
fatal error 107: too many error messages on one line
all of those are line : 213 which is :
Код:
if (GetPlayerColor[a] == GetPlayerColor[playerid]) SendClientMessage(a, orange, string);
Reply
#2

Quote:
Originally Posted by [AC
Etch ]
Код:
error 028: invalid subscript (not an array or too many subscripts): "GetPlayerColor"
all of those are line : 213 which is :
Код:
if (GetPlayerColor[a] == GetPlayerColor[playerid]) SendClientMessage(a, orange, string);
GetPlayerColor[a]
Use:
pawn Код:
GetPlayerColor(a)

Untested:
pawn Код:
public OnPlayerText(playerid, text[])
{
    new
        string[144];
    if (text[0] == '!')
    {
        new
            name[24],
            Color = GetPlayerColor(playerid);
        GetPlayerName(playerid, name, 24);
        format(string, 144, "[Color] %s : %s", name, text[1]);
        for(new a = 0; a < GetMaxPlayers(); a++)
        {
            if(IsPlayerConnected(a))
            {
                if(Color == GetPlayerColor(a))
                {
                    SendClientMessage(a, orange, string);
                }
            }
        }
        return 0;
    }
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)