[QUICK HELP] Need help - 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: [QUICK HELP] Need help (
/showthread.php?tid=620279)
[QUICK HELP] Need help -
StrikerZ - 28.10.2016
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;
}
Re: [QUICK HELP] Need help -
SyS - 28.10.2016
if you use any special id for each faction that would be better but in this case you can do a check on name of faction like this (ALGORITHM)
Код:
Onplayertext......
{
check for the symbol ! in chat
{
loop of players
{
check faction name of player and each iteration values
{
send message to player in this iteration
}
}
}
}
instead of that i would prefer you to make a custom function that would do the same since they can be used in future development of this system which may include group messages and you may only need to call this function

well choice is yours.
Re: [QUICK HELP] Need help -
StrikerZ - 29.10.2016
Actually the faction system is like a family system and not of cops bla bla. its a type of gang/family system