16.01.2012, 20:41
anyone got a /flist which shows all online faction members. Thanks.
if (strcmp( "/fonline", cmdtext, true, 8) == 0)
{
new
string[128],
p_Name[24]
;
SendClientMessage(playerid, 0xFF0000FF, "* Online Faction Members:");
for(new u = 0; u < MAX_PLAYERS; u++) { //Looping through all the players, for what? We don't know yet.
if(gPlayerData[u][Faction] != 0) { //Checking if the looped players are in a faction (I'm assuming you don't use Faction ID zero.
GetPlayerName(u, p_Name, 24); //Max length of SA:MP Nicknames is 24 characters!
format(string, sizeof(string), "[Faction: %d] %s [Rank: %d]", gPlayerData[u][Faction], p_Name, gPlayerData[u][FactionRank]); //Creating the actual message itself, this is where you add their faction id, name, and rank!
SendClientMessage(playerid, 0xFFFFFF, string); //Send them the specified string!
}
}
return 1;
}