SendTeamMessage
#1

Does someone have this for me? and it should work with GetPlayerTeam Instead of Gteam, Thanks!
Reply
#2

Dunno if this will work but, it won't hurt to try rite :

pawn Код:
stock SendTeam1Message(playerid, color, string[])
{
  if(GetPlayerTeam(playerid) == 1)
  {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
      {
          SendClientMessage(i, Color, string);
      }
    }
  }
  return 0;
}
Reply
#3

Could you also tell me how i can use this? SOrry but i think there is more than just SendTeamMessage...
Reply
#4

Better version, you can specify the team in this, as well as the color:

pawn Код:
forward SendTeamMessage(teamid, color, const message[]);

public SendTeamMessage(teamid, color, const message[])
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        if(!IsPlayerConnected(i)) continue;
        if(GetPlayerTeam(i) != teamid) continue;

        SendClientMessage(i, color, message);
    }
    return 1;
}
Just use it like a normal SendClientMessage, but replace 'playerid', with the teamid the message has to be sent to.
Reply
#5

this wont work actually.. Its ment for a team radio, so people can talk in there themselves.. if i can use this for that aswell, please tell me how to do so.
Reply
#6

Like so?

pawn Код:
format(string, sizeof(string), "* Radio: %s: %s", playername, message);
SendTeamMessage(GetPlayerTeam(playerid), COLOR_WHATEVER, string);
Reply
#7

YES, thank you!
Reply
#8

I tried to fix it, its now this:


Stock:
Код:
stock SendPoliceMessage(COLOR, string[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
     if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
     {
        SendClientMessage(i, COLOR_LIGHTBLUE, string);
     }
  }
  return 0;
}
And the Command itself:
Код:
	if((strcmp(cmd, "/r", true) == 0) || (strcmp(cmd, "/radio", true) == 0))
	{
	if(GetPlayerTeam(playerid) == 1)
	{
	format(string, sizeof(string), "* Radio: %s: %s", pName, string);
	SendPoliceMessage(COLOR_LIGHTBLUE, string);
	}
	return 1;
	}
ERROR:

Quote:

C:\Documents and Settings\Wouter\Bureaublad\SA-MP Scripting\pawno\PoliceFaction.pwn(293) : warning 203: symbol is never used: "COLOR"

Reply
#9

come on, im pretty much screwed untill this is fixed..
Reply
#10

Quote:
Originally Posted by DragonBlaster50
Посмотреть сообщение
I tried to fix it, its now this:


Stock:
Код:
stock SendPoliceMessage(COLOR, string[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
     if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
     {
        SendClientMessage(i, COLOR_LIGHTBLUE, string);
     }
  }
  return 0;
}
And the Command itself:
Код:
......
Try changing it to this:
Код:
stock SendPoliceMessage(string[])
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
     if(IsPlayerConnected(i) && GetPlayerTeam(i) == 1)
     {
        SendClientMessage(i, COLOR_LIGHTBLUE, string);
     }
  }
  return 0;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)