SA-MP Forums Archive
Help with command /jaillist - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Help with command /jaillist (/showthread.php?tid=102051)



Help with command /jaillist - tunetu - 13.10.2009

Hello, I have a tiny problem with my /jaillist command, the problem is when someone is jailed when a cop types /jaillist it shows the players that are jailed only on 1 columb example
Name: %s | ID: %d | Jail Time: %d sec,Name: %s | ID: %d | Jail Time: %d sec,Name: %s | ID: %d | Jail Time: %d sec and I dont want it like this

I want when he types /jaillist to show the list of the jailed people, for example:
Name: %s | ID: %d | Jail Time: %d sec
Name: %s | ID: %d | Jail Time: %d sec
Name: %s | ID: %d | Jail Time: %d sec


Here is the command:

pawn Код:
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;
    }
If someone knows please post here


Re: Help with command /jailtime - dice7 - 13.10.2009

Send the message before 'x' reaches 3


Re: Help with command /jailtime - tunetu - 13.10.2009

Quote:

Send the message before 'x' reaches 3

It doesnt work


Re: Help with command /jailtime - tunetu - 13.10.2009

So does anyone know how?


Re: Help with command /jaillist - kman - 18.10.2009

Код:
	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;
  }
This is example it has to fit your script