SA-MP Forums Archive
Team chat [FINALLY WORKED] THANK YOU! - 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: Team chat [FINALLY WORKED] THANK YOU! (/showthread.php?tid=78736)



Team chat [FINALLY WORKED] THANK YOU! - Hot - 22.05.2009

I have no idea if this will work, I found it at forum, my I think it will only send a message on the players chat. not to THE ALL TEAM :S

pawn Код:
if(strcmp(cmd,"/pr",true)==0)
    {
        if (gTeam[playerid] == TEAM_COPS)
            {
                if ((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3))
                    {
                        GetPlayerName(playerid,name,sizeof(name));
                        format(string,sizeof(string),"Police Radio(%s):%s",name,cmdtext[128]);
                        SendCopMessage(0xFFFFFF, string);
                    }
                   
                    else return SendClientMessage(playerid, 0xFFFF00AA, "-> You mean: /pr [Message]");
                    }
                   
                    else return SendClientMessage(playerid, 0xFFFF00AA, "-> You are not a Police Officer");
                    }
pawn Код:
SendCopMessage(color, text[]) {
  for(new i = 0; i < MAX_PLAYERS; i ++) {
  if(IsPlayerConnected(i)) {
  if (gTeam[i] == TEAM_COPS) {
      SendClientMessage(i, color, text);
      }
    }
  }
}



Re: Team chat ' - Rks25 - 22.05.2009

it will send a message to whoever is connected and is a cop.


Re: Team chat ' - Hot - 22.05.2009

Thank you. So it's now working?


Re: Team chat ' - Rks25 - 22.05.2009

try it out..


Re: Team chat ' - Hot - 23.05.2009

No, it doesn't work :/


Re: Team chat ' - Weirdosport - 23.05.2009

pawn Код:
if((strlen(cmdtext) >= 1)&&(strlen(cmdtext) <= 3))
{
    GetPlayerName(playerid,name,sizeof(name));
    format(string,sizeof(string),"Police Radio(%s):%s",name,cmdtext[128]);
    SendCopMessage(0xFFFFFF, string);
}                  
else return SendClientMessage(playerid, 0xFFFF00AA, "-> You mean: /pr [Message]");
If the message is between 1 and 3 characters in length, display it, otherwise tell them they got it wrong.. Surely it should be the other way round? And also when you format the cmdtext, you'll send a message like:

Quote:

Police Radio(Bob):/pr Hello!




Re: Team chat ' - Hot - 23.05.2009

But, can you tell me the correct way?


Re: Team chat ' STILL NEEDING HELPPPPPPPPPPPPPPPPPPPP - Hot - 23.05.2009

Please I beg youuuu! I really need this to keep with my script!


Re: Team chat ' STILL NEEDING HELPPPPPPPPPPPPPPPPPPPP - Badger(new) - 23.05.2009

try this:
pawn Код:
if(strcmp(cmd,"/pr",true)==0)
{
    if (gTeam[playerid] == TEAM_COPS)
    {
        if ((strlen(cmdtext) > 4)&&(strlen(cmdtext) <= 50))
        {
            new message[50];
            new name[MAX_PLAYERS];
            strmid(message,cmdtext,4,strlen(cmdtext)-4);
            GetPlayerName(playerid,name,sizeof(name));
            format(string,sizeof(string),"Police Radio(%s):%s",name,message);
            SendCopMessage(0xFFFFFF, string);
            return 1;
        }
        else return SendClientMessage(playerid, 0xFFFF00AA, "-> You mean: /pr [Message]");
    }
    else return SendClientMessage(playerid, 0xFFFF00AA, "-> You are not a Police Officer");
}



Re: Team chat ' STILL NEEDING HELPPPPPPPPPPPPPPPPPPPP - Weirdosport - 23.05.2009

A definite improvement, i'd have probably used strdel to save making a new string but there's little in it...