SA-MP Forums Archive
samp faction chat - 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)
+--- Thread: samp faction chat (/showthread.php?tid=652845)



samp faction chat - Zeus666 - 20.04.2018

PHP код:
stock SendMessageToAllFaction(message[], color)
{
    foreach(
Playeri)
    {
        if(
pInfo[i][pFaction] == pInfo[playerid][pFaction]
        {
             
SendClientMessage(icolormessage);
         }
     }
    return 
1;

PHP код:
CMD:faction(playerid,params[])
{
    new 
factionstring[257];
     if((
pInfo[playerid][pFaction] == 0)) return SendClientMessage(playerid, -1"You are not in any faction");
    {
        if(!
strlen(params))
        {
            
SendClientMessage(playerid, -1""chat" /f [mesaj]");
            return 
1;
        }
        
format(factionstringsizeof(factionstring), ""COL_FCHAT"** (( %s %s: %s ))**",GetRankName(playerid),PlayerName(playerid), params);
        
SendMessageToAllFaction(factionstring, -1);
    }
    return 
1;

How can I fix this code? I want to set for each faction, not for all faction in one chat.


Re: samp faction chat - jasperschellekens - 20.04.2018

Exactly the same as your previous topic https://sampforum.blast.hk/showthread.php?tid=652821 ...
Loop trough all players and check if they have the same faction id
PHP код:
if(pInfo[i][pFaction] == pInfo[playerid][pFaction])
{
   
SendClientMessage(i, -1"text"); 




Re: samp faction chat - Zeus666 - 20.04.2018

Wasn't sure about it, thanks.