if(strcmp(cmd, "/jaillist", true) == 0 || strcmp(cmd, "/jl", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pLeader] == 3)
{
new x;
SendClientMessage(playerid, COLOR_DBLUE, "-= JAIL LIST =-");
for(new i=0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(PlayerInfo[i][pJailTime] > 0)
{
GetPlayerName(i, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "Name: %s%s | ID: %d | Jail Time: %d sec", string,giveplayer,i,PlayerInfo[i][pJailTime]);
x++;
if(x > 3)
{
SendClientMessage(playerid, COLOR_YELLOW, string);
x = 0;
format(string, sizeof(string), "");
}
else
{
format(string, sizeof(string), "%s, ", string);
}
}
}
}
if(x <= 3 && x > 0) {
string[strlen(string)-2] = '.';
SendClientMessage(playerid, COLOR_YELLOW, string);
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You are not PD / FBI / LS Council !");
}
}//not connected
return 1;
}
Send the message before 'x' reaches 3 |
if(strcmp(cmd, "/jail", true) == 0) { if(IsSpawned[playerid] == 0) { SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command"); return 1; } if(gTeam[playerid] != TEAM_COP) { SendClientMessage(playerid,COLOR_ERROR,"Only Police can see who is in Jail"); return 1; } SendClientMessage(playerid, 0xA9A9A9AA, "|_Listing Players Currently In Jail_|"); new jailedresult =0; for(new i=0;i<MAX_PLAYERS;i++) { if(IsPlayerConnected(i) && Jailed[i] == 1 ) { jailedresult ++; new prisoner[30]; GetPlayerName(i,jailbirdname,30); format(string, sizeof(string), "%s(%d) Is in jail at Police Department HQ. Time Left: %d Seconds",prisoner,i,JailTime[i]); SendClientMessage(playerid, 0x00C7FFAA, string); } } if(jailedresult == 0) { SendClientMessage(playerid, 0x00C7FFAA, "There jail cells are empty. No players are in jail"); } return 1; }