28.10.2016, 13:45
Hi. I made the faction system but now im confused in making faction chat. Like im using onplayertext and key '!' to make it. But how do i make the chat different for different factions? Like i don't want all the factions to see the every faction's chat.A type of classification you can say. Enum and createfaction cmd is here.
Код:
enum fInfo
{
FacName[50],
FacOwner[20],
FacLevels,
FacRanks,
FacSlots[10]
};
Код:
CMD:createfaction(playerid, params[])
{
if(pInfo[playerid][pLevel] >= 5)
{
new id,name[50],slot,fac = FacCount;
if(sscanf(params,"uis",id,slot,name)) return SCM(playerid,COLOR_ORANGE,"USAGE: /createfaction (playerid) (faction slot) (faction name)");
if(fac >= MAX_FACTIONS) return SCM(playerid,COLOR_RED,"Max faction limit reached!");
if(pInfo[id][flevel] == 0)
{
format(FactionInfo[fac][FacName], 50, "%s", name);
format(FactionInfo[fac][FacOwner], 20, "%s", PN(id));
FactionInfo[fac][FacRanks] = 5;
FactionInfo[fac][FacLevels] = 10;
pInfo[id][flevel] = 10;
pInfo[id][frank] = 5;
pInfo[id][fname] = name;
SaveStatus(id);
format(hf,sizeof(hf),"Factions/%i.ini",fac);
if(!fexist(hf))
{
new INI:fac2 = INI_Open(hf);
INI_WriteString(fac2,"Name",FactionInfo[fac][FacName]);
INI_WriteString(fac2,"Owner",FactionInfo[fac][FacOwner]);
INI_WriteInt(fac2,"Ranks",FactionInfo[fac][FacRanks]);
INI_WriteInt(fac2,"Levels",FactionInfo[fac][FacLevels]);
INI_Close(fac2);
}
new string[120];
format(string,sizeof(string),"You created a faction for %s with name %s.",PN(id),name);
SCM(playerid,COLOR_YELLOW,string);
format(string,sizeof(string),"Administrator %s has created a faction for you with name %s.",PN(playerid),name);
SCM(id,COLOR_YELLOW,string);
FacCount++;
}
}
return 1;
}


well choice is yours.