[HELP] Anyone got any idea?
#1

Hello Again.
I want only my team to read this mesage.

Код:
	if (strcmp("/dispatch", cmdtext, true, 9) == 0)
	{
	  if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
	  new str[256], pname[256];
	  GetPlayerName(playerid, pname, 256);
	  format(str, 256, ":: Dispatcher %s:%s", pname, cmdtext[9]);
	  SendClientMessageToAll(COLOR_BLUE, str);
	  return 1;
	}
I've putted teams like this, this is team nr "5".

Код:
AddPlayerClassEx(5,288,2282.0640,2425.5608,3.4766,356.3850,3,1,41,500,24,500);
So basicly, I want only my team to read that message, I dont want everyone to read it.

Thanks
Reply
#2

Replace SendClientMessageToAll with something like:

pawn Код:
for(new i; i< MAX_PLAYERS; i++)
{
  if(GetPlayerTeam(playerid) == whatever)
  {
    SendClientMessage(playerid, COLOR_BLUE, str);
  }
}
Note: You must change the == whatever to suit your team setup.
Reply
#3

pawn Код:
if (strcmp("/dispatch", cmdtext, true, 9) == 0)
    {
      if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
      new str[256], pname[256];
      GetPlayerName(playerid, pname, 256);
      format(str, 256, ":: Dispatcher %s:%s", pname, cmdtext[9]);
      SendClientMessageToAll(COLOR_BLUE, str);
      return 1;
    }
Lol, the problem is in that: SendClientMessageToAll !

it should be like that:

pawn Код:
if (strcmp("/dispatch", cmdtext, true, 9) == 0)
    {
      if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
      new str[256], pname[256];
      GetPlayerName(playerid, pname, 256);
      format(str, 256, ":: Dispatcher %s:%s", pname, cmdtext[9]);
      SendClientMessage(COLOR_BLUE, str);
      string SendClientMessage(playerid, COLOR_BLUE, " Your string ");
      return 1;
    }
I THINK SO IT IS RIGHT.. not sure!
Reply
#4

Quote:
Originally Posted by Moustafa
pawn Код:
if (strcmp("/dispatch", cmdtext, true, 9) == 0)
    {
      if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
      new str[256], pname[256];
      GetPlayerName(playerid, pname, 256);
      format(str, 256, ":: Dispatcher %s:%s", pname, cmdtext[9]);
      SendClientMessageToAll(COLOR_BLUE, str);
      return 1;
    }
Lol, the problem is in that: SendClientMessageToAll !

it should be like that:

pawn Код:
if (strcmp("/dispatch", cmdtext, true, 9) == 0)
    {
      if(GetPlayerTeam(playerid) != 5) return SendClientMessage(playerid,COLOR_RED, "Identification Error - You need rank 1 to do this.");
      new str[256], pname[256];
      GetPlayerName(playerid, pname, 256);
      format(str, 256, ":: Dispatcher %s:%s", pname, cmdtext[9]);
      SendClientMessage(COLOR_BLUE, str);
      string SendClientMessage(playerid, COLOR_BLUE, " Your string ");
      return 1;
    }
I THINK SO IT IS RIGHT.. not sure!
This just send a message to "me", not my team.
Reply
#5

You could use the callback OnPlayerTeamPrivMsg possibly,
Reply
#6

Quote:
Originally Posted by JoeDaDude
You could use the callback OnPlayerTeamPrivMsg possibly,
Hmm... ok, how should I put it in?
Reply
#7

pawn Код:
public OnPlayerTeamPrivmsg(playerid, text[])
{
  new
    sSenderName[24],
    sString[128];
 
  GetPlayerName(playerid, sSenderName, sizeof sSenderName);
  format(sString, sizeof sString, "TeamMessage <%s>: %s", senderName, text);
 
  for(new iPlayer = 0 ; iPlayer < MAX_PLAYERS; iPlayer++)
  {
    if(IsPlayerAdmin(iPlayer))
    {
      SendPlayerMessage(iPlayer, 0xFFFFFFAA, sString);
    }
  }
 
  return true;
}

The command is /tpm,
If you dont want to use that,
Then good luck lol
Reply
#8

Quote:
Originally Posted by JoeDaDude
pawn Код:
public OnPlayerTeamPrivmsg(playerid, text[])
{
  new
    sSenderName[24],
    sString[128];
 
  GetPlayerName(playerid, sSenderName, sizeof sSenderName);
  format(sString, sizeof sString, "TeamMessage <%s>: %s", senderName, text);
 
  for(new iPlayer = 0 ; iPlayer < MAX_PLAYERS; iPlayer++)
  {
    if(IsPlayerAdmin(iPlayer))
    {
      SendPlayerMessage(iPlayer, 0xFFFFFFAA, sString);
    }
  }
 
  return true;
}

The command is /tpm,
If you dont want to use that,
Then good luck lol
How can I change the /tpm? I already have the /tpm in my script hmm...
You know a simple police radio then?, I can make something from that... maybe.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)