02.01.2015, 12:55
Please fix to me that code
If someone who is not in faction and is only Family members want to do it can not because it gives only to players that they are in faction,
PHP код:
CMD:members(playerid, params[])
{
new string[128], online;
if(!IsPlayerLoggedIn(playerid)) return SendClientMessage(playerid, COLOR_GREY, "You need to login first before using any command.");
if(!PlayerInfo[playerid][pFac] && PlayerInfo[playerid][pFam]) return SendClientMessage(playerid, COLOR_GREY, "You are not part of family/faction.");
if(PlayerInfo[playerid][pFac])
{
foreach(Player, i)
{
if(PlayerInfo[i][pFac] == PlayerInfo[playerid][pFac])
{
online ++;
}
}
format(string, sizeof(string), "Online Faction Members: %d", online);
SendClientMessage(playerid, COLOR_ORANGE, string);
foreach(Player, i)
{
if(PlayerInfo[i][pFac] == PlayerInfo[playerid][pFac])
{
if(PlayerInfo[i][pFacLeader])
{
if(PlayerInfo[playerid][pFacLeader] && PlayerInfo[i][pFacDiv]) format(string, sizeof(string), "- ** Leader %s, Division:%s, Rank(%d): %s", RPN(i), RPFDN(i), PlayerInfo[i][pFacRank], RPFRN(i)); //[Leader][Division:][Chief(10)][name]
else format(string, sizeof(string), "- [Leader] [%s (%d)] %s", RPFRN(i), PlayerInfo[i][pFacRank], RPN(i));
if(PlayerInfo[playerid][pFac] == 3) format(string, sizeof(string), "- [Leader] [%s (%d)] %s (Success: %d | Fail: %d)", RPFRN(i), PlayerInfo[i][pFacRank], RPN(i), PlayerInfo[i][pCSuccess], PlayerInfo[i][pCFail]);
}
else
{
if(PlayerInfo[playerid][pFacLeader] && PlayerInfo[i][pFacDiv]) format(string, sizeof(string), "- Member %s, Division:%s, Ranks(%d): %s", RPN(i), RPFDN(i), PlayerInfo[i][pFacRank], RPFRN(i));
else format(string, sizeof(string), "- [%s (%d)] %s", RPFRN(i), PlayerInfo[i][pFacRank], RPN(i));
if(PlayerInfo[playerid][pFac] == 3) format(string, sizeof(string), "- [%s (%d)] %s (Success: %d | Fail: %d)", RPFRN(i), PlayerInfo[i][pFacRank], RPN(i), PlayerInfo[i][pCSuccess], PlayerInfo[i][pCFail]);
}
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
if(PlayerInfo[playerid][pFam])
{
online = 0;
foreach(Player, i)
{
if(PlayerInfo[i][pFam] == PlayerInfo[playerid][pFam])
{
online ++;
}
}
format(string, sizeof(string), "Online Family Members: %d", online);
SendClientMessage(playerid, COLOR_ORANGE, string);
foreach(Player, i)
{
if(PlayerInfo[i][pFam] == PlayerInfo[playerid][pFam])
{
format(string, sizeof(string), "- [%s (%d)] %s", RPFaRN(i), PlayerInfo[i][pFamRank], RPN(i));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
}
}
}
return 1;
}