BR_Gustavo

Comando /AdminList

Nov 10th, 2018
181
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #define DIALOG_ADMIN_LIST              (2401)
  2. #define DIALOG_ADMIN_LIST_1            (2402)
  3.  
  4.  
  5. // Coloque o Admin_List, dentro da enum I_nfo ;v
  6.  
  7.  
  8. //------------------------------------------------------------------------------
  9. CMD:adminlist(playerid,params[])
  10. {
  11.     if(!IsPlayerAdmin(playerid) && PlayerInfo[playerid][Level] < 5)return SendClientMessage(playerid,red,"ERROR: You need to be administrator level 5 to use this command");
  12.     {
  13.         mysql_query(mysql,"SELECT * FROM `accounts` WHERE NOT Level = 0",true);
  14.         if(cache_num_rows() >=1)
  15.         {
  16.             LogInformacao[playerid][0] = "";
  17.             new AdminListInformacao[100],AdminListInformacaoint,MsgAdminList[150];
  18.             for(new i=0; i<cache_num_rows(); i++)
  19.             {
  20.                 cache_get_field_content(i,"Name",AdminListInformacao,mysql,100);
  21.                 AdminListInformacaoint = cache_get_field_content_int(i,"Level",mysql);
  22.                 format(MsgAdminList,sizeof(MsgAdminList),"{FFFFFF}Name: {00FF00}%s {FFFFFF}| Level: {00FF00}%d\n",AdminListInformacao,AdminListInformacaoint);
  23.                 strcat(LogInformacao[playerid][0],MsgAdminList);
  24.             }
  25.             ShowPlayerDialog(playerid,DIALOG_ADMIN_LIST,DIALOG_STYLE_LIST,"{FF0000}Admin List",LogInformacao[playerid][0],"Change","Cancel");
  26.         }
  27.     }
  28.     return 1;
  29. }
  30. //------------------------------------------------------------------------------
  31.    
  32.     if(dialogid == DIALOG_ADMIN_LIST)
  33.     {
  34.         if(response)
  35.         {
  36.             new Formatar_Sql[150],Nome_Admin_Set[50],Nivel_Admin_Set;
  37.             PlayerInfo[playerid][Admin_List] = listitem;
  38.             mysql_query(mysql,"SELECT * FROM `accounts` WHERE NOT Level = 0",true);
  39.             cache_get_field_content(listitem,"Name",Nome_Admin_Set,mysql,50);
  40.             Nivel_Admin_Set = cache_get_field_content_int(listitem,"Level",mysql);
  41.             format(Formatar_Sql,150,"\tAtualizar Nivel\n Jogador: %s Nivel Atual: %d",Nome_Admin_Set,Nivel_Admin_Set);
  42.             ShowPlayerDialog(playerid,DIALOG_ADMIN_LIST_1,DIALOG_STYLE_INPUT,"{FF0000}Admin List",Formatar_Sql,"Change","Back");
  43.         }
  44.     }
  45.     if(dialogid == DIALOG_ADMIN_LIST_1)
  46.     {
  47.         if(!response)
  48.         {
  49.             cmd_adminlist(playerid,"\1");
  50.         }
  51.         if(response)
  52.         {
  53.             if(strval(inputtext) < 0 || strval(inputtext) > 8)
  54.             {
  55.                 new Formatar_Sql[150],Nome_Admin_Set[50],Nivel_Admin_Set;
  56.                 mysql_query(mysql,"SELECT * FROM `accounts` WHERE NOT Level = 0",true);
  57.                 cache_get_field_content(PlayerInfo[playerid][Admin_List],"Name",Nome_Admin_Set,mysql,50);
  58.                 Nivel_Admin_Set = cache_get_field_content_int(PlayerInfo[playerid][Admin_List],"Level",mysql);
  59.                 format(Formatar_Sql,150,"\tAtualizar Nivel\n Jogador: %s Nivel Atual: %d",Nome_Admin_Set,Nivel_Admin_Set);
  60.                 ShowPlayerDialog(playerid,DIALOG_ADMIN_LIST_1,DIALOG_STYLE_INPUT,"{FF0000}Admin List",Formatar_Sql,"Change","Back");
  61.                 return 1;
  62.             }else
  63.             {
  64.                 new Consultar_Sql[250];
  65.                 mysql_format(mysql,Consultar_Sql,250,"SELECT * FROM `permicoes` WHERE `Nome` = '%s' AND `Permicao` = '/setlevel'",pName(playerid));
  66.                 mysql_query(mysql,Consultar_Sql,true);
  67.                 if(cache_num_rows() >=1)
  68.                 {
  69.                     SendClientMessage(playerid,red,"ERRO: Você não está autorizado a executar esse comando");
  70.                 }else
  71.                 if(cache_num_rows() == 0)
  72.                 {
  73.                     new Nome_Admin_Set[50],Level_Admin_Set,Atualizar_Sql[150];
  74.                     mysql_query(mysql,"SELECT * FROM `accounts` WHERE NOT Level = 0",true);
  75.                     cache_get_field_content(PlayerInfo[playerid][Admin_List],"Name",Nome_Admin_Set,mysql,50);
  76.                     Level_Admin_Set = cache_get_field_content_int(PlayerInfo[playerid][Admin_List],"Level",mysql);
  77.                     format(Atualizar_Sql,150,"UPDATE `accounts` SET `Level` = '%d' WHERE `Name` = '%s'",strval(inputtext),Nome_Admin_Set);
  78.                     mysql_query(mysql,Atualizar_Sql,false);
  79.                     format(Consultar_Sql,250,"[INFO] - Você setou o nivel da conta \"%s\" de %d para %d",Nome_Admin_Set,Level_Admin_Set,strval(inputtext));
  80.                     SendClientMessage(playerid,blue,Consultar_Sql);
  81.                 }
  82.             }
  83.         }
  84.     }
RAW Paste Data