01.09.2012, 22:26
What's wrong with this code?
It sends the message in every color.
pawn Код:
public OnPlayerText(playerid, text[])
{
new pname[24];
GetPlayerName(playerid, pname, sizeof(pname));
new str[128];
format(str, sizeof(str), "%s[%i]: %s", pname, playerid, text);
if(TextColor[playerid] == None)
{
SendClientMessageToAll(0xFFFFFFAA, str);
}
if(TextColor[playerid] == Red)
{
SendClientMessageToAll(0xFF0000AA, str);
}
if(TextColor[playerid] == Orange)
{
SendClientMessageToAll(0xFFA500AA, str);
}
if(TextColor[playerid] == Yellow)
{
SendClientMessageToAll(0xFFFF00AA, str);
}
if(TextColor[playerid] == Green)
{
SendClientMessageToAll(0x00FF00AA, str);
}
if(TextColor[playerid] == Blue)
{
SendClientMessageToAll(0x0000FFAA, str);
}
if(TextColor[playerid] == Purple)
{
SendClientMessageToAll(0x800080AA, str);
}
if(TextColor[playerid] == Grey)
{
SendClientMessageToAll(0x808080AA, str);
}
if(TextColor[playerid] == Cyan)
{
SendClientMessageToAll(0x00FFFFAA, str);
}
if(TextColor[playerid] == Pink)
{
SendClientMessageToAll(0xFF00FFAA, str);
}
return 0;
}
pawn Код:
public OnPlayerConnect(playerid)
{
TextColor[playerid] = None;
return 1;
}