Shared chat between 2 factions.
#1

I have tried creating a dept radio system which includes two factions, but the problem is the following thing, the first faction which is the police one can use the command and receive messages from the other faction, but the second faction doesn't see what they type in the shared chat and can not receive any messages from the second faction. This is the code.

PHP код:
 #define SendSplitMessageF(%1,%2,%3) SendSplitMessage(%1, %2, (format(sgstr, sizeof(sgstr), %3), sgstr))
new sgstr[256];
if(
strcmp(cmd"/dept"true) == || strcmp(cmd"/dr"true) == 0)
    {
    new 
length strlen(cmdtext);
      new 
name[24], string[256];
          new 
DeptName[10];
        
GetPlayerName(playeridnamesizeof(name));
        while ((
idx length) && (cmdtext[idx] <= ' ')){idx++;}
        new 
offset idx,result[64];
        while ((
idx length) && ((idx offset) < (sizeof(result) - 1))){result[idx offset] = cmdtext[idx];idx++;}
        
result[idx offset] = EOS;
        if(!
strlen(result))return SendClientMessage(playeridred"USAGE: /dr [text]");
        if(
gTeam[playerid] == POLICEDeptName "SASP";
        else if(
gTeam[playerid] == APDeptName "SACFD";
        for(new 
0MAX_PLAYERSi++)
        {
             if(
IsPlayerConnected(i))
            {
             if(
gTeam[i] == POLICE)
              
SendSplitMessageF(iCOLOR_ORANGE"[%s] %s says: %s"DeptNamenameresult);
            continue;
              }
            if(
gTeam[i] == AP)
            {
            
SendSplitMessageF(iCOLOR_ORANGE"[%s] %s says: %s"DeptNamenameresult);
            continue;
            }
            
format(gstrsizeof(gstr), "%s says (dept. radio): %s"nameresult);
            
ProxDetector(15.0playeridgstrCOLOR_FADE1COLOR_FADE2COLOR_FADE3COLOR_FADE4COLOR_FADE5);
            return 
1;
        }
    }
stock SendSplitMessage(playeridcolormsg[])
{
    new 
ml 115result[160], len strlen(msg), repeat;
    if(
len ml)
    {
        
repeat = (len ml);
        for(new 
0<= repeati++)
        {
            
result[0] = 0;
            if(
len - (ml) > ml)
            {
                
strmid(resultmsgml iml * (i+1));
                
format(resultsizeof(result), "%s"result);
            }
            else
            {
                
strmid(resultmsgml ilen);
                
format(resultsizeof(result), "%s"result);
            }
            
SendClientMessage(playeridcolorresult);
        }
    }
    else
    {
        
SendClientMessage(playeridcolormsg);
    }
    return 
true;

I ran out of any ideas on what could be the problem so if possible, help me out.
Edit 1: Seems like the third faction which is not even included here can see the chat too.
Reply


Messages In This Thread
Shared chat between 2 factions. - by cs_waller - 15.11.2016, 18:18
Re: Shared chat between 2 factions. - by justinnater - 15.11.2016, 23:53
Re: Shared chat between 2 factions. - by Luis- - 15.11.2016, 23:54
Re: Shared chat between 2 factions. - by TwinkiDaBoss - 16.11.2016, 00:19

Forum Jump:


Users browsing this thread: 1 Guest(s)