01.06.2011, 18:50
Hey all. I need help with my chat. When players is in some faction/org his name is ex. Blue and chat he write too like this Berzelius:test. So could i make smth like this -Berzelius:test.
#define COLOR_BLUE 0x0000FF96
new fname[20];
static Team[MAX_PLAYERS];
public OnPlayerCommandText(playerid, cmdtext[])
{
new string[128];
if(strcmp(cmd, "/family", true) == 0 || strcmp(cmd, "/f", true) == 0)
{
for(new i=0; i<256; i++)
{
if( /* Check if player in that faction */ Team[playerid] == /* faction name*/Berzelius)
{
GetPlayerName(playerid,fname,sizeof(fname));
format(string,sizeof(string),"(%s): %s",fname,cmdtext[3]);
SendClientMessageToAll(COLOR_BLUE, string);
printf("%s: %s", fname, cmdtext[3]);
}
}
}
return 1;
}
public OnPlayerText(playerid, text[])
{
new
string[128],
pName[MAX_PLAYER_NAME];
GetPlayerName(playerid, pName, sizeof(pName));
format(string, sizeof(string), "{0000FF}%s {FFFFFF}: ''%s''", pName, text[0]); // Blue playername, white text.
SendClientMessageToAll(colorwanted, string);
return true;
}