PDA

View Full Version : Need Help with /members command


IceBilizard
25/11/2012, 04:13 AM
Hello guys i have organization script and in org script a command is /members if any one join the org and he is not online then leader cant see his name in member list. I want if some one join any org and if he is not online then leader can his name /members please help me here is the code of /members


CMD:members(playerid, params[])
{
#pragma unused params
if (!IsLeader(playerid)) return SendClientMessage(playerid, COLOR_RED,"You're not the leader of an organization");
new string[60];
new count = 0;
SendClientMessage(playerid, COLOR_YELLOW,"Employees online");
for (new i=0;i<MAX_PLAYERS;i++)
{
if (IsPlayerConnected(i))
{
if (PlayerOrg[i] == PlayerOrg[playerid] && i != playerid)
{
format(string,sizeof(string),"%s - %s", PlayerName(i), PlayerRank[i]);
SendClientMessage(playerid, COLOR_WHITE, string);
count++;
}
}
}

if (count == 0)
{
SendClientMessage(playerid, COLOR_YELLOW,"None of your employees are online");
}

else
{
format(string,sizeof(string),"%d member(s) online", count);
SendClientMessage(playerid, COLOR_WHITE, string);
}

return 1;
}

iTzZh
25/11/2012, 06:43 AM
The reason you can't see everyone in the organization is because what your script is telling the server is check every player online and if they are logged in and they are part of the organization, list their name.

If you want to make it so everyone appears you will need to save every user to a organization file or if you're using SQL it would be way easier to check every player to see if they're in the organization.