22.05.2010, 19:27
Try and use pawn tags next time please ![rolleyes](images/smilies/rolleyes.gif)
It SHOULD work, not tested
I also cleaned up your code.
Instead of two times making a varible, I made it only once, I also shortened the array 'string' to 128 cells instead of 256 (Not needed!!)
![rolleyes](images/smilies/rolleyes.gif)
pawn Код:
public OnPlayerText(playerid, text[])
{
new pName[MAX_PLAYER_NAME], string[128];
GetPlayerName(playerid, pName, sizeof(pName));
if(PlayerIsMuted[playerid] == 1)
{
SendClientMessage(playerid, COLOR_BRIGHTRED, "You are muted and cannot talk.");
return 0;
}
if(text[0] == '@')
{
if(PlayerInfo[playerid][AdminLevel] >= 1)
{
format(string, sizeof(string), "Admin Chat - %s: %s", pName, text[1]);
SendModMsg(COLOR_YELLOW, string);
return 1;
}
return 0;
}
if(text[0] == '!')
{
format(string, sizeof(string), "[Team] %s: %s", pName, text[1]);
printf("%s", string);
for(new i=0,b=GetMaxPlayers();i<b;i++)
{
if(gTeam[i] == gTeam[playerid]) SendClientMessage(i, GetPlayerColor(playerid), string);
}
return 1;
}
return 1;
}
I also cleaned up your code.
Instead of two times making a varible, I made it only once, I also shortened the array 'string' to 128 cells instead of 256 (Not needed!!)