samp faction chat
#1

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.
Reply
#2

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"); 

Reply
#3

Wasn't sure about it, thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)