20.04.2010, 21:47
Hi, i need a help with command which shows how many members of faction are online (only numeric, not names)
I want to be something like this: *** There are 3/15 police officers online *** (if there are only 3 at that time)
here is the example to see their names:
can someone help?
I want to be something like this: *** There are 3/15 police officers online *** (if there are only 3 at that time)
here is the example to see their names:
pawn Код:
if(strcmp(cmd,"/members",true)==0)
{
if(IsPlayerConnected(playerid))
{
new teamnumber;
if (PlayerInfo[playerid][pLeader] != 0) teamnumber = PlayerInfo[playerid][pLeader];
else if (PlayerInfo[playerid][pMember] != 0) teamnumber = PlayerInfo[playerid][pMember];
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You're not faction member!");
return 1;
}
SendClientMessage(playerid, 0x808000AA, "**Members Online**");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(i, sendername, sizeof(sendername));
format(string, sizeof(string), "");
if (PlayerInfo[i][pLeader] == teamnumber) format(string, sizeof(string), "%s (Leader)",sendername);
else if (PlayerInfo[i][pMember] == teamnumber) format(string, sizeof(string), "%s, Rank: %d.",sendername, PlayerInfo[i][pRank]);
if (strlen(string) > 1) SendClientMessage(playerid, 0xF5DEB3AA, string);
}
}
}
return 1;
}