Send Message to Only Certain Teams
#1

Hello. I'm working on my gamemode and I've run into a slight problem.

I'm trying to script a /911 command. I want the command to be useable by only gangs, not by any public service players.
I've gotten started on it, but I don't really know how to script it. Here's what I have so far:

http://pastebin.com/mf23f608

I'm having trouble with the message being sent to the public service players.
Can someone please help me fix this?


Thanks.
Reply
#2

Try this (I'm not sure if it works):

pawn Код:
if(!strcmp(cmdtext, "/911", true, 4)) // 4 is the length of /911
    {
      if(!gTeam[playerid] == TEAM_TRIAD || !gTeam[playerid] == TEAM_VAGOS || !gTeam[playerid] == TEAM_GROVE || !gTeam[playerid] == TEAM_BALLA || !gTeam[playerid] == TEAM_BIKER || !gTeam[playerid] == TEAM_TRUCKER) return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this cmd.");
        {
          if(!cmdtext[4]) return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /911 [State Situation]");
          new string[128];
          new name[16];
          GetPlayerName(playerid, name, sizeof(name));
          format(string, 128, "%s %s", name, cmdtext[4]);
          for (new i=0; i<MAX_PLAYERS; i++)
          {
              if(gTeam[i] == TEAM_LSPD || gTeam[i] == TEAM_SFPD || gTeam[i] == TEAM_LVPD || gTeam[i] == TEAM_AREA69 || gTeam[i] == TEAM_GIRLCOP)
                {
                    SendClientMessage(i, COLOR_ORANGE, string);
                    break;
                }
            }
        }
    }
Reply
#3

Got this from TouchX
pawn Код:
stock SendMessageToTeam(team,color,mess[])
{
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(gTeam[i] == team)
{
SendClientMessage(i,color,mess);
}
}
}
}
pawn Код:
SendMessageToTeam(TEAM_NAME,COLOR_LIGHTBLUE,string);
Reply
#4

This will work:

Код:
	if(!strcmp(cmdtext, "/911", true, 4))
	{
	  if(gTeam[playerid] == TEAM_TRIAD || gTeam[playerid] == TEAM_VAGOS || gTeam[playerid] == TEAM_GROVE || gTeam[playerid] == TEAM_BALLA || gTeam[playerid] == TEAM_BIKER || gTeam[playerid] == TEAM_TRUCKER)
	  {
		  if(!cmdtext[5])
				return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /911 [State Situation]");
		  new string[128];
		  new name[16];
		  GetPlayerName(playerid, name, sizeof(name));
		  format(string, 128, "%s %s", name, cmdtext[5]);
		  for(new i = 0; i < MAX_PLAYERS; i++)
		  {
			  if(gTeam[i] == TEAM_LSPD || gTeam[i] == TEAM_SFPD || gTeam[i] == TEAM_LVPD || gTeam[i] == TEAM_AREA69 || gTeam[i] == TEAM_GIRLCOP)
				{
					SendClientMessage(i, COLOR_ORANGE, string);
				}
			}
		}
		else
		{
		  return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this command.");
		}
	}
Reply
#5

Quote:
Originally Posted by StrickenKid
This will work:

Код:
	if(!strcmp(cmdtext, "/911", true, 4))
	{
	  if(gTeam[playerid] == TEAM_TRIAD || gTeam[playerid] == TEAM_VAGOS || gTeam[playerid] == TEAM_GROVE || gTeam[playerid] == TEAM_BALLA || gTeam[playerid] == TEAM_BIKER || gTeam[playerid] == TEAM_TRUCKER)
	  {
		  if(!cmdtext[5])
				return SendClientMessage(playerid, 0xFF0000FF, "USAGE: /911 [State Situation]");
		  new string[128];
		  new name[16];
		  GetPlayerName(playerid, name, sizeof(name));
		  format(string, 128, "%s %s", name, cmdtext[5]);
		  for(new i = 0; i < MAX_PLAYERS; i++)
		  {
			  if(gTeam[i] == TEAM_LSPD || gTeam[i] == TEAM_SFPD || gTeam[i] == TEAM_LVPD || gTeam[i] == TEAM_AREA69 || gTeam[i] == TEAM_GIRLCOP)
				{
					SendClientMessage(i, COLOR_ORANGE, string);
				}
			}
		}
		else
		{
		  return SendClientMessage(playerid, 0xFF0000FF, "You cannot use this command.");
		}
	}
Thanks dude!
I`ll give it a shot and let you know how it goes
Reply
#6

It worked for him btw
Reply
#7

Quote:
Originally Posted by Torran
It worked for him btw
Haha thanks Torran!

Yes, it worked! Thank youuuu
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)