[SOLVED] Team chat.. What's wrong?
#1

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;
  }
Reply
#2

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

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 '!'
Reply
#4

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

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..
Reply
#6

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;
  }
Reply
#7

Thanks.. Hope it works
Reply
#8

I tried this, but I get error:

error 017: undefined symbol "playername"
Reply
#9

Then u need to define it
Reply
#10

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];
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)