team chat
#3

Try and use pawn tags next time please

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;
}
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!!)
Reply


Messages In This Thread
team chat - by shoru93 - 22.05.2010, 19:19
Re: team chat - by dice7 - 22.05.2010, 19:27
Re: team chat - by Joe_ - 22.05.2010, 19:27

Forum Jump:


Users browsing this thread: 1 Guest(s)