SA-MP Forums Archive
dcmd_admins is bugged a little bit - 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: dcmd_admins is bugged a little bit (/showthread.php?tid=136998)



dcmd_admins is bugged a little bit - Andy_McKinley - 27.03.2010

This is my command /admins (DCMD). It works fine! The bug if when 2 or more admins are on line and shown in /admins. When they log off, the last admins will be shown twice or more in their place.

Example:

Online Admins:
[UF]DarkPhoenix [Level: 5] [ID: 11]
CyberMan [Level: 3] [ID: 6]

CyberMan has left the server. (Leaving)


Online Admins:
[UF]DarkPhoenix [Level: 5] [ID: 11]
[UF]DarkPhoenix [Level: 5] [ID: 6]

pawn Код:
dcmd_admins(playerid, params[])
{
  #pragma unused params
  print("Admins command 1");
  new adminscount = 0,string[128],adminName[MAX_PLAYER_NAME];

  for(new i=0;i<MAX_PLAYERS;i++)
    if(pInfo[i][pAdmin] > 0 || IsPlayerAdmin(i)) adminscount ++;

  if(adminscount == 0) return SendClientMessage(playerid, COLOR_BLUE, "There are currently no Admins online.");

  SendClientMessage(playerid, COLOR_BLUE, "------------------------------------");
  SendClientMessage(playerid, COLOR_RED, "Admins Online:");
  print("Admins command 2");
  for(new j=0;j<MAX_PLAYERS;j++)
  {
    if(pInfo[j][pAdmin] > 0 || IsPlayerAdmin(j))
   {
     print("Admins command 3");
     GetPlayerName(j,adminName,sizeof(adminName));
     format(string,sizeof(string),"%s [Level: %d] [ID: %d]",adminName,pInfo[j][pAdmin],j);
     SendClientMessage(playerid, COLOR_GREEN, string);
   }
  }
  return 1;
}



Re: dcmd_admins is bugged a little bit - Razvann - 27.03.2010

pawn Код:
dcmd_admins(playerid, params[])
{
  #pragma unused params
  print("Admins command 1");
  new adminscount = 0,string[128],adminName[MAX_PLAYER_NAME];

  for(new i=0;i<MAX_PLAYERS;i++)
    if(pInfo[i][pAdmin] > 0 || IsPlayerAdmin(i)) adminscount ++;

  if(adminscount == 0) return SendClientMessage(playerid, COLOR_BLUE, "There are currently no Admins online.");

  SendClientMessage(playerid, COLOR_BLUE, "------------------------------------");
  SendClientMessage(playerid, COLOR_RED, "Admins Online:");
  print("Admins command 2");
  for(new j=0;j<MAX_PLAYERS;j++)
  {
    if(pInfo[j][pAdmin] > 0 || IsPlayerAdmin(j))
   {
     if(IsPlayerConnected(j))
     {
       print("Admins command 3");
       GetPlayerName(j,adminName,sizeof(adminName));
       format(string,sizeof(string),"%s [Level: %d] [ID: %d]",adminName,pInfo[j][pAdmin],j);
       SendClientMessage(playerid, COLOR_GREEN, string);
     }
   }
  }
  return 1;
}