SA-MP Forums Archive
Gangchat Problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Gangchat Problem (/showthread.php?tid=112918)



Gangchat Problem - Studio - 11.12.2009

pawn Код:
//=========================[TeamChat]===========================================
public OnPlayerText(playerid,text[]){

  if(PlayerData[playerid][Muted] == 1)
  {
    SendClientMessage(playerid, COLOR_RED, "Unable to talk. (REASON: Muted)");
    return 0;
  }
    if(text[0] == '!')  {
      new name[24], string[256];
      GetPlayerName(playerid, name, 24);
      format(string, sizeof(string), "*Teamchat %s: %s", name, text[1]);
        printf("%s", string);
        TeamChatLog(string);
      for(new i = 0; i < MAX_PLAYERS; i++)  {
            if(IsPlayerConnected(i))    {
                if(gTeam[i] == gTeam[playerid])     SendClientMessage(i, GetPlayerColor(playerid), string);
            }
        }
        return 1;
    }

    return 1;
}
When I submit a message it is visible in public chat too.


Re: Gangchat Problem - [GTA] - 11.12.2009

search:
Public TeamChatLog

tell me what you got under there


Re: Gangchat Problem - Studio - 11.12.2009

pawn Код:
//=========================[TeamChatLog]========================================
stock TeamChatLog(string[]){
    new entry[256];
    format(entry, sizeof(entry), "%s\n",string);
    new File:hFile;
    hFile = fopen("teamchat.txt", io_append);
    fwrite(hFile, entry);
    fclose(hFile);
}
There.


Re: Gangchat Problem - Studio - 11.12.2009

Still need help please.


Re: Gangchat Problem - Abernethy - 11.12.2009

Have you set gTeam to anything?


Re: Gangchat Problem - Zeex - 11.12.2009

Then you should return 0 instead of 1 when you send message to his team:

pawn Код:
//=========================[TeamChat]===========================================
public OnPlayerText(playerid,text[]){

  if(PlayerData[playerid][Muted] == 1)
  {
    SendClientMessage(playerid, COLOR_RED, "Unable to talk. (REASON: Muted)");
    return 0;
  }
    if(text[0] == '!')  {
      new name[24], string[256];
      GetPlayerName(playerid, name, 24);
      format(string, sizeof(string), "*Teamchat %s: %s", name, text[1]);
        printf("%s", string);
        TeamChatLog(string);
      for(new i = 0; i < MAX_PLAYERS; i++)  {
            if(IsPlayerConnected(i))    {
                if(gTeam[i] == gTeam[playerid])     SendClientMessage(i, GetPlayerColor(playerid), string);
            }
        }
        return 0;
    }
    return 1;
}