Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.83 KB | None | 0 0
  1. CMD:addmoderation(playerid, params[])
  2. {
  3.     if(PTEMP[playerid][pLogin] == 0) return true;
  4.     if(PTEMP[playerid][pAdmin] < 7 || dostup[playerid] == 0) return true;
  5.     new name[32], params, nickname_adm[32];
  6.     if(sscanf(params, "s[32]is[32]", name, params, nickname_adm)) return SendClientMessage(playerid, COLOR_WHITE, "Введите: /addmoderation [NickName] [Admin Level] [Admin-Name]");
  7.     if((params[1] > 6 || params[1] < 0) && PTEMP[playerid][pAdmin] < 10) return SendClientMessage(playerid, COLOR_GREY, "Au aiionoeee ieoaeo");
  8.     if(strlen(nickname_adm) == 0 || strlen(nickname_adm) > 30) return SendClientMessage(playerid, COLOR_GREY, "Длина админ ника до 30 символов");
  9.     mysql_format(DATABASE,QUERY, 128, "SELECT * FROM "TABLE_ADMIN" WHERE `name` = '%s'", name);
  10.     mysql_function_query(DATABASE,QUERY,true,"GiveAdmPlayerMySQL","iss", params, name, nickname_adm);
  11.     return true;
  12. }
  13.  
  14. publics:GiveAdmPlayerMySQL(lvl, name, nickname)
  15. {
  16.     new r, f, x;
  17.     cache_get_data(r, f);
  18.     if(r)
  19.     {
  20.         if(lvl == 0)
  21.         {
  22.             mysql_format(DATABASE,QUERY, 128, "DELETE FROM "TABLE_ADMIN" WHERE `Name`= '%s'", name);
  23.             mysql_function_query(DATABASE,QUERY,false,"","");
  24.             if(IsPlayerConnected(GetPlayerID(str))) PTEMP[GetPlayerID(str)][pAdmin] = 0;
  25.         }
  26.         else
  27.         {
  28.             mysql_format(DATABASE,QUERY,256, "UPDATE "TABLE_ADMIN" SET  level = '%i' WHERE Name = '%s' LIMIT 1",lvl,name);
  29.             mysql_function_query(DATABASE,QUERY,false,"","");
  30.         }
  31.     }
  32.     else
  33.     {
  34.         new year, month,day;
  35.         getdate(year, month, day);
  36.         mysql_format(DATABASE,QUERY, 512, "\
  37.         INSERT INTO "TABLE_ADMIN" (Name, level, LastCon, AdmName) VALUES ('%s', %i, '%02i.%02i.%04i', '%s')",
  38.         name, lvl, day, month, year, nickname);
  39.         mysql_function_query(DATABASE,QUERY,false,"","");
  40.     }
  41.     return true;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement