SA-MP Forums Archive
[SOLVED] Team chat.. What's wrong? - 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: [SOLVED] Team chat.. What's wrong? (/showthread.php?tid=90470)



[SOLVED] Team chat.. What's wrong? - SiJ - 08.08.2009

Hey, sometimes other players (IN SAME TEAM) can't see team chat..
Code:
pawn Код:
//Team Chat
    if(text[0] == '!')
  {
    for(new i = 0; i <= MAX_PLAYERS; i++ )
    {
      new str[512];
      if(gTeam[playerid] == 255) return ErrorMsg(playerid,"You are not in any team right now!");
      if(gTeam[playerid] == gTeam[i])
      {
          format(str,512,"[Team] %s: %s",PlayerName(playerid),text[1]);
          SendClientMessage(i, COLOR_TITLE, str);
          return 0;
            }
    }
    return 0;
  }



Re: Team chat.. What's wrong? - dice7 - 08.08.2009

pawn Код:
format(str,512,"[Team] %s: %s",PlayerName(playerid),text[1]);
You are just sending the letter after '!' to other team players


Re: Team chat.. What's wrong? - SiJ - 08.08.2009

Quote:
Originally Posted by dice7
pawn Код:
format(str,512,"[Team] %s: %s",PlayerName(playerid),text[1]);
You are just sending the letter after '!' to other team players
So how can I make so It would send whole sentence after '!'


Re: Team chat.. What's wrong? - dice7 - 08.08.2009

You could replace the ! with a space and then delete the extra space in the format()


Re: Team chat.. What's wrong? - SiJ - 08.08.2009

Quote:
Originally Posted by dice7
You could replace the ! with a space and then delete the extra space in the format()
Sorry, but I didn't understood you..
Could you make me an example please?

Thanks..


Re: Team chat.. What's wrong? - dice7 - 08.08.2009

pawn Код:
//Team Chat
    if(text[0] == '!')
  {
    text[0] = ' ';
    for(new i = 0; i <= MAX_PLAYERS; i++ )
    {
      new str[512];
      if(gTeam[playerid] == 255) return ErrorMsg(playerid,"You are not in any team right now!");
      if(gTeam[playerid] == gTeam[i])
      {
          format(str,512,"[Team] %s:%s",PlayerName(playerid),text); /* note that there is no space after the first "%s:" to not make the message look weird for having to much space*/
          SendClientMessage(i, COLOR_TITLE, str);
          return 0;
            }
    }
    return 0;
  }



Re: Team chat.. What's wrong? - SiJ - 08.08.2009

Thanks.. Hope it works


Re: [SOLVED] Team chat.. What's wrong? - seimas2 - 26.11.2009

I tried this, but I get error:

error 017: undefined symbol "playername"


Re: [SOLVED] Team chat.. What's wrong? - Black_Shinigami - 20.01.2010

Then u need to define it


Re: [SOLVED] Team chat.. What's wrong? - KnooL - 20.01.2010

Quote:
Originally Posted by Black_Shinigami
Then u need to define it
No,
You'll have to create a new variable:

pawn Код:
new playernamer[MAX_PLAYER_NAME];