Code
public OnPlayerText(playerid,text[])
{
if(text[0] == '!')
{
new name[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, name, sizeof(name));
strdel(text,0,1);
format(string, sizeof(string), "*%s: %s", name, text);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
}
return 1;
}
Добавлено (08.07.2012, 21:37)
---------------------------------------------
А если добавлять id игрока перед сообщением, то
Code
public OnPlayerText(playerid,text[])
{
new mstr[512], pname[MAX_PLAYER_NAME];
GetPlayerName(playerid,pname,sizeof(pname));
format(mstr,sizeof(mstr),"%s[%d]", pname, playerid);
SendClientMessageToAll(0xFFFFFFAA,mstr);
if(text[0] == '!')
{
new name[MAX_PLAYER_NAME], string[256];
GetPlayerName(playerid, name, sizeof(name));
strdel(text,0,1);
format(string, sizeof(string), "*%s: %s", name, text);
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == gTeam[playerid])
SendClientMessage(i, GetPlayerColor(playerid), string);
}
}
}
return 1;
}