Faction members
#1

Hy,sa-mp users.

I want when i type /members to show all members of the faction(offline & online).Who i can do that ? I use dini and command is :
Код:
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])
	{
		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] [%s (%d)] %s", RPFDN(i), RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
		            else format(string, sizeof(string), "- [Leader] [%s (%d)] %s", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
		            if(PlayerInfo[playerid][pFac] == 3) format(string, sizeof(string), "- [Leader] [%s (%d)] %s (Success: %d | Fail: %d)", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i), PlayerInfo[i][pCSuccess], PlayerInfo[i][pCFail]);
		        }
		        else
		        {
		            if(PlayerInfo[playerid][pFacLeader] && PlayerInfo[i][pFacDiv]) format(string, sizeof(string), "- [%s] [%s (%d)] %s", RPFDN(i), RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
		            else format(string, sizeof(string), "- [%s (%d)] %s", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i));
  					if(PlayerInfo[playerid][pFac] == 3) format(string, sizeof(string), "- [%s (%d)] %s (Success: %d | Fail: %d)", RPFRN(i), PlayerInfo[i][pFacRank], NORPN(i), PlayerInfo[i][pCSuccess], PlayerInfo[i][pCFail]);

				}
		        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		    }
		}
	}
	if(PlayerInfo[playerid][pFam])
	{
	    on‌line = 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], NORPN(i));
		        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
		    }
		}
	}
	return 1;
}
( Gamemode Ross Country RP )

I give + REP to person who help me
Reply
#2

You're codes above working fine , but you can't check offline player while you are using INI files , you'll need to move to something like MySQL , SQLite , or you'll need to store the player names of each one who join familly and read the names from that file. (so i suggest you to move to MySQL which will help you on many other functions for offline players).
Reply
#3

or you'll need to store the player names of each one who join familly and read the names from that file.
Tell me more about this xD
Reply
#4

bump
Reply
#5

With INI for showing offline members will be tricky.. but MySQL it will be a walk in the park.
Reply
#6

BUT who i can show offline members using INI
Reply
#7

What SilentSoul was saying is that with files the only way to do it is to store the players' name into a file for each faction so you can read the names from that file.
Reply
#8

And how i can do that?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)