SA-MP Forums Archive
Need help with sorting out /admins - 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: Need help with sorting out /admins (/showthread.php?tid=130086)



Need help with sorting out /admins - leapfish - 25.02.2010

Hello it's me again...
I need help with sorting out /admins command, everything works but it gets spammy when there are a lot of admins online...
Here is the code I use
Код:
  if(strcmp(cmd, "/admins", true) == 0)
  {
	if(IsPlayerConnected(playerid))
	{
 		new count;
 		for(new w = 0; w < MAX_PLAYERS; w++)
		{
			if(IsPlayerConnected(w))
			{
  				if(PlayerInfo[w][pAdmin] >= 1 && PlayerInfo[w][pAdmin] <= 6)
				{
				  new string[256];
				  new admtext[64];
				  new player[MAX_PLAYER_NAME];
					format(admtext, sizeof(admtext), "Level %d Administrator",PlayerInfo[w][pAdmin]);
					GetPlayerName(w, player, 24);
					format(string, sizeof(string), "%s: %s[%d]", admtext, player, w);
					SendClientMessage(playerid, COLOR_CYAN, string);
					count++;
				}
			}
		}
		if(count == 0)
		{
			SendClientMessage(playerid, COLOR_CYAN, "No admins present");
		}
	}
	return 1;
}
when player uses command I got this out come;
Level 5 Administrator: Admin34
Level 4 Administrator: Admin174
Level 2 Administrator: Admin422
Level 5 Administrator: Admin61
Level 5 Administrator: Admin63
Level 6 Administrator: Admin35
Level 2 Administrator: Admin31

So it's little bit messed up, is there way I can sort it like;
Level 1 Administrator: Admin1, Admins2, Admin3, Admin4, Admin5 (When there are more than 5 admins of each level online it makes new row!)
Level 1 Administrator: Admin6, Admin7.....
Level 2 Administrator: Admin
................
................
................

And the rest levels arranged from 1-6


Re: Need help with sorting out /admins - Shubham - 25.02.2010

I don't this it is possible and if somehow it is possible then it will be a very long code.


Re: Need help with sorting out /admins - woot - 25.02.2010

Quote:
Originally Posted by LyQue
So it's little bit messed up, is there way I can sort it like;
Level 1 Administrator: Admin1, Admins2, Admin3, Admin4, Admin5 (When there are more than 5 admins of each level online it makes new row!)
Level 1 Administrator: Admin6, Admin7.....
Level 2 Administrator: Admin
https://sampwiki.blast.hk/wiki/Strcat


Re: Need help with sorting out /admins - leapfish - 25.02.2010

Ok to make it simplier, is it able to make

Present Admins: Admin1(id)-5, Admin2(id)-3, Admin3(id)-1, Admin4(id)-3
Present Admins: Admin5(id)-4

Something like this?

Quote:
Originally Posted by //exora
Quote:
Originally Posted by LyQue
So it's little bit messed up, is there way I can sort it like;
Level 1 Administrator: Admin1, Admins2, Admin3, Admin4, Admin5 (When there are more than 5 admins of each level online it makes new row!)
Level 1 Administrator: Admin6, Admin7.....
Level 2 Administrator: Admin
https://sampwiki.blast.hk/wiki/Strcat
Can you explain please...


Re: Need help with sorting out /admins - leapfish - 26.02.2010

Anyone, please??


Re: Need help with sorting out /admins - leapfish - 27.02.2010

Please...


Re: Need help with sorting out /admins - Christopher. - 27.02.2010

Код:
  if(strcmp(cmd, "/admins", true) == 0)
  {
	if(IsPlayerConnected(playerid))
	{
 		new count;
 		for(new w = 0; w < MAX_PLAYERS; w++)
		{
			if(IsPlayerConnected(w))
			{
                new string[256], admtext[64], player[MAX_PLAYER_NAME];
   
  				if(PlayerInfo[w][pAdmin] == 1 && PlayerInfo[w][pAdmin] <= 6)
				{
                    SendClientMessage(playerid, COLOR_CYAN, "Level One Administrators");
					format(admtext, sizeof(admtext), "Level %d Administrator",PlayerInfo[w][pAdmin]);
					GetPlayerName(w, player, 24);
					format(string, sizeof(string), "%s: %s[%d]", admtext, player, w);
					SendClientMessage(playerid, COLOR_CYAN, string);
					count++;
				}
                if(PlayerInfo[w][pAdmin] == 2 && PlayerInfo[w][pAdmin] <= 6)
				{
                    SendClientMessage(playerid, COLOR_CYAN, "Level Two Administrators");
					format(admtext, sizeof(admtext), "Level %d Administrator",PlayerInfo[w][pAdmin]);
					GetPlayerName(w, player, 24);
					format(string, sizeof(string), "%s: %s[%d]", admtext, player, w);
					SendClientMessage(playerid, COLOR_CYAN, string);
					count++;
				}
                if(PlayerInfo[w][pAdmin] == 3 && PlayerInfo[w][pAdmin] <= 6)
				{
                    SendClientMessage(playerid, COLOR_CYAN, "Level Three Administrators");
					format(admtext, sizeof(admtext), "Level %d Administrator",PlayerInfo[w][pAdmin]);
					GetPlayerName(w, player, 24);
					format(string, sizeof(string), "%s: %s[%d]", admtext, player, w);
					SendClientMessage(playerid, COLOR_CYAN, string);
					count++;
				}
                if(PlayerInfo[w][pAdmin] == 4 && PlayerInfo[w][pAdmin] <= 6)
				{
                    SendClientMessage(playerid, COLOR_CYAN, "Level Four Administrators");
				    new string[256], admtext[64], player[MAX_PLAYER_NAME];
					format(admtext, sizeof(admtext), "Level %d Administrator",PlayerInfo[w][pAdmin]);
					GetPlayerName(w, player, 24);
					format(string, sizeof(string), "%s: %s[%d]", admtext, player, w);
					SendClientMessage(playerid, COLOR_CYAN, string);
					count++;
				}
                if(PlayerInfo[w][pAdmin] == 5 && PlayerInfo[w][pAdmin] <= 6)
				{
                    SendClientMessage(playerid, COLOR_CYAN, "Level Five Administrators");
					format(admtext, sizeof(admtext), "Level %d Administrator",PlayerInfo[w][pAdmin]);
					GetPlayerName(w, player, 24);
					format(string, sizeof(string), "%s: %s[%d]", admtext, player, w);
					SendClientMessage(playerid, COLOR_CYAN, string);
					count++;
				}
			}
		}
		if(count == 0)
		{
			SendClientMessage(playerid, COLOR_CYAN, "No admins present");
		}
	}
	return 1;
}
Haven't checked it but it should work.