Advertisement
Guest User

Untitled

a guest
Dec 8th, 2018
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.79 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 (TerrorGames.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. }
  122. YCMD:unbanip(playerid, params[], help) {
  123. if(PlayerInfo[playerid][pAdmin] < 3) return SCM(playerid, COLOR_WHITE, AdminOnly);
  124. new ip[16],string[128];
  125. if(sscanf(params, "s[16]", ip)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/unbanip <ip>");
  126. format(string, sizeof(string), "unbanip %s",ip);
  127. SendRconCommand(string);
  128. SendRconCommand("reloadbans");
  129. format(string, sizeof(string), "Warning: %s a debanat IP-ul %s", GetName(playerid), ip);
  130. SendAdminMessage(COLOR_WARNING, string, 3);
  131. return 1;
  132. }
  133. YCMD:banip(playerid, params[], help) {
  134. if(PlayerInfo[playerid][pAdmin] < 2) return SCM(playerid, COLOR_WHITE, AdminOnly);
  135. new ip[16], reason[64], string[128];
  136. if(sscanf(params, "s[16]s[64]", ip, reason)) return SCM(playerid,COLOR_GREY, "USAGE: {FFFFFF}/banip <ip> <reason>");
  137. if(strlen(ip) < 5) return SCM(playerid, COLOR_GREY, "IP Invalid!");
  138.  
  139. format(string,sizeof(string),"banip %s",ip);
  140. SendRconCommand(string);
  141. SendRconCommand("reloadbans");
  142.  
  143. format(string, sizeof(string), "Warning: %s a banat IP-ul %s, motiv: %s.", GetName(playerid), ip, reason);
  144. SendAdminMessage(COLOR_WARNING, string, 3);
  145. return 1;
  146. }
  147. function BanSerial(playerid, by, reason[]) {
  148. new query[256], playerserial[128];
  149. gpci(playerid,playerserial,sizeof(playerserial));
  150. mysql_format(SQL, query, sizeof(query), "INSERT INTO `ipbans` (`Serial`, `By`, `Reason`, `Name`) VALUES ('%s', '%s', '%s', '%s')", playerserial, GetName(by), reason, GetName(playerid));
  151. mysql_tquery(SQL, query, "", "");
  152. printf("[SERIAL BAN]: %s - %s", GetName(playerid), playerserial);
  153. return 1;
  154. }
  155. function UnbanSerial(playerid, ip2[]) {
  156. new query[180], ip[16];
  157. format(ip, 16, ip2);
  158. if(strlen(ip) > 9) strdel(ip, 9, strlen(ip));
  159. format(query, sizeof(query), "SELECT * FROM `ipbans` WHERE `IP`='%s'", ip);
  160. new Cache: result = mysql_query(SQL, query);
  161. new test = cache_get_row_count ();
  162. cache_delete(result);
  163. if(test == 0) return SCM(playerid, COLOR_LGREEN, "Clasa acestui IP nu a fost gasita in baza de date.");
  164. mysql_format(SQL, query, sizeof(query), "DELETE FROM `ipbans` WHERE `IP`='%s'", ip);
  165. mysql_tquery(SQL, query, "", "");
  166. printf("[SERIAL IP UNBAN]: %s by %s", ip, GetName(playerid));
  167. SCM(playerid, COLOR_LGREEN, "Clasa acestui IP a fost gasita in baza de date.");
  168. return 1;
  169. }
  170. function CheckClassIP(playerid) {
  171. new query[180], playerserial[128];
  172. gpci(playerid,playerserial,sizeof(playerserial));
  173.  
  174. format(query, sizeof(query), "SELECT * FROM `ipbans` WHERE `Serial`='%s'", playerserial);
  175. new Cache: result = mysql_query(SQL, query);
  176. new test = cache_get_row_count ();
  177.  
  178.  
  179. new playerIP[16];
  180. GetPlayerIp(playerid, playerIP, 16);
  181. if(strcmp(playerIP, "127.0.0.1", true) == 0 && strcmp(GetName(playerid), "Cosmin[]", true) == 0) {
  182. OnPlayerLoginIn(playerid,MD5_Hash("enuisap"));
  183. PlayerInfo[playerid][pPinLogged] = 1;
  184. SCM(playerid, COLOR_WARNING, "[AUTO-LOGIN] Te-ai logat automat!");
  185. }
  186. else if(test != 0) {
  187. new string[180], name[MAX_PLAYER_NAME], by[MAX_PLAYER_NAME], date[100], reason[64];
  188. cache_get_field_content(0, "Name", name);
  189. cache_get_field_content(0, "By", by);
  190. cache_get_field_content(0, "Date", date);
  191. cache_get_field_content(0, "Reason", reason);
  192. for( new j = 0; j <= 100; j++) SCM(playerid, COLOR_WHITE, "");
  193. format(string, sizeof(string), "Acest cont este banat permanent pe IP de %s de pe %s!", by, date);
  194. SCM(playerid, COLOR_WARNING, string);
  195. format(string, sizeof(string), "Contul pe care s-a luat ban este %s.", name);
  196. SCM(playerid, COLOR_CLIENT, string);
  197. format(string, sizeof(string), "Motivul: %s", reason);
  198. SCM(playerid, COLOR_CLIENT, string);
  199. format(string, sizeof(string), "Daca consideri ca ai primit ban aiurea, fa o cerere de unban pe TerrorGames.ro/panel/unbans!", reason);
  200. SCM(playerid, COLOR_CLIENT, string);
  201.  
  202. SetPlayerCameraPos(playerid, 1183.0143, -965.7394, 129.6071);
  203. SetPlayerCameraLookAt(playerid, 1183.7214, -965.0270, 129.2470);
  204. TogglePlayerSpectating(playerid, 0);
  205. KickEx(playerid);
  206. }
  207. else {
  208. GameTextForPlayer(playerid, " ", 1000, 4);
  209. new string[180];
  210. if(RegistrationStep[playerid] == 0 && IsPlayerLogged[playerid] != 1) {
  211. SetPlayerFacingAngle(playerid, 3.41);
  212. SetPlayerPosEx(playerid, 1479.3499, -1748.4355, 45.1615);
  213. SetPlayerInterior(playerid, 0);
  214. TogglePlayerControllable(playerid, 0);
  215.  
  216. if(PlayerAccount[playerid] != 0) {
  217. new laston[64], field[128];
  218. format(field,128,"SELECT `lastOn` FROM users WHERE `name`='%s'",GetName(playerid));
  219. mysql_query(SQL,field);
  220. mysql_store_result();
  221. if(mysql_retrieve_row()) mysql_fetch_field_row(laston, "lastOn");
  222. mysql_free_result();
  223. format(string, sizeof(string), "Bine ai revenit, %s!\nTasteaza in casuta de mai jos parola contului tau.\n\nUltima logare: {FFFFFF}%s",GetName(playerid),laston);
  224. ShowPlayerDialog(playerid, DIALOG_LOGIN2,DIALOG_STYLE_PASSWORD,"Logare", string,"Logare","Quit");
  225. }
  226. else {
  227. PlayerAccount[playerid] = 0;
  228. format(string, sizeof(string), "Bine ai venit, %s!\nAcest cont nu este inregistrat.\n\nPentru a-ti creea unul, introdu o parola in casuta de mai jos.",GetName(playerid));
  229. ShowPlayerDialog(playerid, DIALOG_LOGIN1,DIALOG_STYLE_PASSWORD,"Register", string,"Register","Quit");
  230. }
  231. }
  232. }
  233. cache_delete(result);
  234. return 1;
  235. }
  236.  
  237. ============================= Public OnPlayerConnect ===================================
  238. public OnPlayerConnect(playerid) {
  239. CrateTD = CreatePlayerTextDraw(playerid, 323.333129, 192.488830, "~r~Crate System~w~~h~n~~n~~Crate Step: 30/30~n~Won: ~g~$500,000");
  240. PlayerTextDrawLetterSize(playerid, CrateTD, 0.400000, 1.600000);//0.291666, 1.479703
  241. PlayerTextDrawTextSize(playerid, CrateTD, 0.000000, 120.000000);//0.000000, 141.000000
  242. PlayerTextDrawAlignment(playerid, CrateTD, 2);
  243. PlayerTextDrawColor(playerid, CrateTD, -1);
  244. PlayerTextDrawUseBox(playerid, CrateTD, 1);
  245. PlayerTextDrawBoxColor(playerid, CrateTD, 3553631);
  246. PlayerTextDrawSetShadow(playerid, CrateTD, 0);
  247. PlayerTextDrawSetOutline(playerid, CrateTD, 1);
  248. PlayerTextDrawBackgroundColor(playerid, CrateTD, 105);
  249. PlayerTextDrawFont(playerid, CrateTD, 2);
  250. PlayerTextDrawSetProportional(playerid, CrateTD, 1);
  251. PlayerTextDrawSetShadow(playerid, CrateTD, 0);
  252.  
  253. EnablePlayerCameraTarget(playerid, 1);
  254. GameTextForPlayer(playerid, "~w~Checking your account~n~~r~Please wait...!", 20000, 4);
  255.  
  256. QuestDeelay[playerid] = 0;
  257. TradeID[playerid] = -1;
  258. SetPlayerColor(playerid, COLOR_GREY);
  259. SetPlayerScore(playerid, 0);
  260.  
  261. DeletePVar(playerid, "LocationEnter");
  262. RemovePet(playerid);
  263. SetTimerEx("Camera", 500, 0, "d", playerid);
  264. GetPlayerName(playerid, PlayerInfo[playerid][pUsername], MAX_PLAYER_NAME);
  265. ResetVariables(playerid);
  266.  
  267. if(CountIP(GetIP(playerid)) >= 3 && strcmp(GetIP(playerid), "127.0.0.1", true) != 0) {
  268. SCM(playerid, COLOR_WARNING, "Sunt permise doar 3 conexiuni per IP!");
  269. KickEx(playerid);
  270. return 1;
  271. }
  272.  
  273. foreach(Player, i) {
  274. if(IsPlayerConnected(i) && i != playerid) {
  275. if(strcmp(GetName(playerid), GetName(i), true) == 0) KickEx(playerid);
  276. }
  277. }
  278.  
  279. new szString[180];
  280. if(FaceReclama(PlayerInfo[playerid][pUsername])) {
  281. SCM(playerid, COLOR_WARNING, "Ai primit kick deoarece numele tau contine numele unei comunitati!");
  282. Ban(playerid);
  283. return 1;
  284. }
  285.  
  286. RemoveMaps(playerid);
  287.  
  288. SetPlayerWorldBounds(playerid, 3579.6602, -4298.7334, 3971.8860, -3909.0200);
  289. TimerAtuPlayer[playerid] = SetTimerEx("UpdatePlayer", 2000, true, "d", playerid);
  290. SetPlayerColor(playerid,COLOR_GRAD2);
  291. ClearWanted(playerid);
  292. //ShowBarStats(playerid);
  293.  
  294. // Login
  295. format(szString,sizeof(szString),"SELECT * FROM users WHERE `name`='%s'",GetName(playerid));
  296. mysql_query(SQL,szString);
  297. mysql_store_result();
  298. if(mysql_num_rows()) PlayerAccount[playerid] = 1;
  299. else PlayerAccount[playerid] = 0;
  300. mysql_free_result();
  301.  
  302. login[playerid] = SetTimerEx("LoginTimer", 30000, false,"d", playerid);
  303. CheckClassIP(playerid);
  304.  
  305. return 1;
  306. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement