Advertisement
Guest User

Untitled

a guest
Apr 4th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.88 KB | None | 0 0
  1. YCMD:ban(playerid, params[], help) {
  2. if(PlayerInfo[playerid][pAdmin] < 1) return SCM(playerid, COLOR_WHITE, AdminOnly);
  3. new id,reason[128],string[200],type, str[128];
  4. if(DeelayCommand[playerid][0] != 0) return DeelayTime(playerid, 0);
  5. if(sscanf(params, "uds[128]", id,type,reason)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/ban <playerid/name> <days | 0 = permanent ip ; 1 = permanent account> <reason>");
  6. if(!IsPlayerConnected(id) || id == INVALID_PLAYER_ID) return SCM(playerid, COLOR_GREY, "Acel player nu este conectat.");
  7. if(id == playerid) return SCM(playerid, COLOR_GREY, "Nu iti poti da ban singur.");
  8. if(FaceReclama(reason)) return RemoveFunction(playerid, reason);
  9. if(PlayerInfo[id][pAdmin] == 7) return 1;
  10. if(PlayerInfo[id][pAdmin] > PlayerInfo[playerid][pAdmin]) return SCM(playerid, -1, "Acel player are adminul mai mare ca tine!");
  11. InsereazaSanctiune(id, playerid, BAN, reason);
  12.  
  13. if(type == 1) {
  14. if(strfind(reason, "silent", true) != -1) {
  15. format(string, sizeof(string), "Silent: %s has been banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
  16. SendAdminMessage(COLOR_LIGHTRED, string, 1);
  17. }
  18. else {
  19. format(string, sizeof(string), "AdmBot: %s has been banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
  20. MesajLung2(COLOR_LIGHTRED, string);
  21. }
  22. PlayerInfo[id][pBanned] = 1;
  23. format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `ID`='%d'",PlayerInfo[id][pSQLID]);
  24. mysql_query(SQL,str);
  25. new ip[25];
  26. GetPlayerIp(id, ip, sizeof(ip));
  27. Banlog(ip,GetName(id),GetName(playerid),reason,0);
  28. KickEx(id);
  29. }
  30. else if(type == 0) {
  31. if(strfind(reason, "silent", true) != -1) {
  32. format(string, sizeof(string), "Silent: %s has been permanent banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
  33. SendAdminMessage(COLOR_LIGHTRED, string, 1);
  34. }
  35. else {
  36. format(string, sizeof(string), "AdmBot: %s has been permanent banned by %s, reason: %s", GetName(id), GetName(playerid), reason);
  37. MesajLung2(COLOR_LIGHTRED, string);
  38. }
  39. PlayerInfo[id][pBanned] = 1;
  40. format(str,sizeof(str),"UPDATE users SET `Banned`='1' WHERE `ID`='%d'",PlayerInfo[id][pSQLID]);
  41. mysql_query(SQL,str);
  42. new ip[25];
  43. GetPlayerIp(id, ip, sizeof(ip));
  44. Banlog(ip,GetName(id),GetName(playerid),reason,0);
  45. BanSerial(id, playerid, reason);
  46. Ban(id);
  47. KickEx(id);
  48. }
  49. else if(type > 1) {
  50. if(strfind(reason, "silent", true) != -1) {
  51. format(string, sizeof(string), "Silent: %s a primit ban de la %s pentru %d zile, motiv: %s", GetName(id), GetName(playerid), type, reason);
  52. SendAdminMessage(COLOR_LIGHTRED, string, 1);
  53. }
  54. else {
  55. format(string, sizeof(string), "AdmBot: %s a primit ban de la %s pentru %d zile, motiv: %s", GetName(id), GetName(playerid), type, reason);
  56. MesajLung2(COLOR_LIGHTRED, string);
  57. }
  58. new year,month,day;
  59. getdate(year, month, day);
  60. day += type;
  61. if(IsMonth31(month)) {
  62. if(day > 31) {
  63. month += 1;
  64. if(month > 12) {
  65. year += 1;
  66. while(day > 31) day -= 31;
  67. }
  68. else while(day > 31) day -= 31;
  69. }
  70. }
  71. else if(!IsMonth31(month)) {
  72. if(day > 30) {
  73. month += 1;
  74. if(month > 12) {
  75. year += 1;
  76. while(day > 30) day -= 30;
  77. }
  78. else while(day > 30) day -= 30;
  79. }
  80. }
  81. else if(!IsMonth31(month) && IsMonth29(year) && month == 2) {
  82. if(day > 29) {
  83. month += 1;
  84. if(month > 12) {
  85. year += 1;
  86. while(day > 29) day -= 29;
  87. }
  88. else while(day > 29) day -= 29;
  89. }
  90. }
  91. else if(!IsMonth31(month) && !IsMonth29(year) && month == 2) {
  92. if(day > 28) {
  93. month += 1;
  94. if(month > 12) {
  95. year += 1;
  96. while(day > 28) day -= 28;
  97. }
  98. else while(day > 28) day -= 28;
  99. }
  100. }
  101. new ip[25], szQuery[256];
  102. GetPlayerIp(id, ip, sizeof(ip));
  103. Banlog(ip,GetName(id),GetName(playerid),reason,type);
  104. KickEx(id);
  105. format(szQuery, sizeof(szQuery), "UPDATE `users` SET `BTemp`='1', `BYear`='%d', `BMonth`='%d', `BDay`='%d', `BBy`='%s', `BReason`='%s' WHERE `ID`='%d'",year, month, day, GetName(playerid), reason, PlayerInfo[id][pSQLID]);
  106. mysql_query(SQL ,szQuery);
  107. }
  108. SCM(id,COLOR_WARNING,"Ai fost banat! Daca consideri ca ai luat ban degeaba, poti face o cerere pe (STAR-ZONE.ro/panel/unbans).");
  109. strmid(PlayerInfo[id][pBBy], GetName(playerid), 0, strlen(GetName(playerid)), 255);
  110. strmid(PlayerInfo[id][pBReason], reason, 0, strlen(reason), 255);
  111. Update(id,pBByx);
  112. Update(id,pBReasonx);
  113. UpdateVar2(playerid, "Bans", 1);
  114. PlayerInfo[playerid][pHelpedPlayers] += 2;
  115. PlayerInfo[playerid][pHelpedPlayersToday] += 2;
  116. DeelayCommand[playerid][0] = 10;
  117. new szQuery[256];
  118. format(szQuery, sizeof(szQuery), "UPDATE users SET `HelpedPlayers` = '%d', `HelpedPlayersToday`='%d' WHERE `ID` = '%d'", PlayerInfo[playerid][pHelpedPlayers], PlayerInfo[playerid][pHelpedPlayersToday], PlayerInfo[playerid][pSQLID]);
  119. mysql_query(SQL, szQuery);
  120. return 1;
  121. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement