/admins dialog
#1

How to do this cmd in dialog the cmd is /admins

PLs help fast

CMd code:
Code:
CMD:admins(playerid, params[])
{
       new count = 0, string[256], AdmRank[500];
	   SendClientMessage(playerid, COLOR_PINK,"Current Online Admins:");
	   for(new i = 0; i < MAX_PLAYERS; i ++)
	   {
		  if(IsPlayerConnected(i))
		  {
			  if(PlayerInfo[i][Level] >= 1)
			  {
				 AdmRank = " ";
                 new nameee[128];
                 GetPlayerName(i, nameee, 16);
                 if(!strcmp(nameee, "[COD]ZORN", true) || !strcmp(nameee, "Colonel", true))
                 {
                    AdmRank = "[Server Mapper]";
                 }
                 
                 if(!strcmp(nameee, "[COD]SelnaGo", true) || !strcmp(nameee, "Jimmy", true))
                 {
                    AdmRank = "[Server Owner]";
                 }
                 
                 if(!strcmp(nameee,"[COD]SNAKE",true) | !strcmp(nameee, "SourceVG", true))
                 {
					AdmRank ="[Scripter][Server Owner]";
				 }
	             format(string, sizeof(string),"ADMIN: [%d]%s Level: %d %s", i, PlayerName2(i), PlayerInfo[i][Level], AdmRank);
	             SendClientMessage(playerid, COLOR_PINK, string);
	            
	             count++;
			  }
	      }
	   }
	   if(count == 0)
	   {
			  SendClientMessage(playerid, COLOR_PINK,"No Admins Online");
    }
  return 1;
}
Reply
#2

Use foreach because it's faster and it loops through the connected players only.

pawn Code:
CMD:admins(playerid, params[])
{
    new count, string[256], AdmRank[32] = "N/A", nameee[21];
    foreach(new i : Player)
    {
        if (PlayerInfo[i][Level] < 1) continue;
        count++;
        GetPlayerName(i, nameee, sizeof (nameee));
        if (!strcmp(nameee, "[COD]ZORN", true) || !strcmp(nameee, "Colonel", true)) AdmRank = "[Server Mapper]";
        else if (!strcmp(nameee, "[COD]SelnaGo", true) || !strcmp(nameee, "Jimmy", true)) AdmRank = "[Server Owner]";
        else if (!strcmp(nameee, "[COD]SNAKE",true) | !strcmp(nameee, "SourceVG", true)) AdmRank ="[Scripter][Server Owner]";
        format(string, sizeof (string), "%sADMIN: [%d]%s Level: %d %s\n", string, i, PlayerName2(i), PlayerInfo[i][Level], AdmRank);
        // Does "PlayerName2" function return different name? If not, change to "nameee" since you got the name already.
    }
    if (!count) SendClientMessage(playerid, COLOR_PINK,"No Admins Online");
    else ShowPlayerDialog(playerid, 678, DIALOG_STYLE_MSGBOX, "Current Online Admins:", string, "Close", "");
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)