CMD:members(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new string[128];
new sendername[MAX_PLAYER_NAME];
new teamnumber;
if (PlayerInfo[playerid][pLeader] != 0) teamnumber = PlayerInfo[playerid][pLeader];
else if (PlayerInfo[playerid][pMember] != 0) teamnumber = PlayerInfo[playerid][pMember];
else if (PlayerInfo[playerid][pFMember] != 255) teamnumber = PlayerInfo[playerid][pFMember];
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not a member of an organization!");
return 1;
}
SendClientMessage(playerid, 0x808000AA, "Members Online:");
for(new i = 0; i < MAX_PLAYERS; i++)
{
if (IsPlayerConnected(i))
{
GetPlayerName(playerid, sendername, sizeof(sendername));
format(string, sizeof(string), "");
if(PlayerInfo[playerid][pLeader] || PlayerInfo[playerid][pMember])
{
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]);
}
}
else if(PlayerInfo[playerid][pFMember] != 255)
{
if (PlayerInfo[i][pFMember] == teamnumber)
{
format(string, sizeof(string), "%s, Rank: %d.",sendername, PlayerInfo[i][pRank]);
}
}
if (strlen(string) > 1) SendClientMessage(playerid, 0xF5DEB3AA, string);
}
}
}
return 1;
}
CMD:members(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
new string[128];
new sendername[MAX_PLAYER_NAME];
new teamnumber;
if (PlayerInfo[playerid][pLeader] != 0) teamnumber = PlayerInfo[playerid][pLeader];
else if (PlayerInfo[playerid][pMember] != 0) teamnumber = PlayerInfo[playerid][pMember];
else if (PlayerInfo[playerid][pFMember] != 255) teamnumber = PlayerInfo[playerid][pFMember];
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not a member of an organization!");
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] || PlayerInfo[i][pMember])
{
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]);
}
}
else if(PlayerInfo[i][pFMember] != 255)
{
if (PlayerInfo[i][pFMember] == teamnumber)
{
format(string, sizeof(string), "%s, Rank: %d.",sendername, PlayerInfo[i][pRank]);
}
}
if (strlen(string) > 1) SendClientMessage(playerid, 0xF5DEB3AA, string);
}
}
}
return 1;
}
pawn Код:
btw, it's not needed to check for "IsPlayerConnected(playerid)" when a player uses a command. A player can't use a command if he's not connected... (the first line in your command itself) |