Advertisement
Guest User

Zastita.

a guest
Dec 5th, 2019
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.95 KB | None | 0 0
  1. regex_IsValidIP(const pid, const string[])
  2. {
  3.  
  4. //Caps converter!
  5. /*new len = strlen(string);
  6. new solid_str[512]; format(solid_str, sizeof(solid_str), "%s", string);
  7. new Regex:CapsC = Regex_New("[A-Z]*");
  8. if(Regex_Check(string, CapsC))
  9. {
  10. Regex_Delete(CapsC);
  11. for(new i; i < len; i++)
  12. {
  13. new ststst[8]; strmid(ststst, string, i, i+1);
  14. for(new k; k < 26; k++)
  15. {
  16. if(strcmp(ststst, AlpBig[k][0], true) == 0)
  17. {
  18. ReplaceString(solid_str, AlpBig[k][0], AlpSmall[k][0], solid_str);
  19. }
  20. }
  21. }
  22. }
  23. else
  24. {
  25. Regex_Delete(CapsC);
  26. }*/
  27.  
  28. if(isnull(string)) return 0;
  29. //IP-Checker
  30. new Regex:ipRegex = Regex_New(".*((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([A-Za-z\\s\\\\`´\\?\\*'#~\\+-_;\\.,:=}{\\[\\]\\(\\)/&%\\^\\$§³²°!\"])*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([A-Za-z\\s\\\\`´\\?\\*'#~\\+-_;\\.,:=}{\\[\\]\\(\\)/&%\\^\\$§³²°!\"])*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)([A-Za-z\\s\\\\`´\\?\\*'#~\\+-_;\\.,:=}{\\[\\]\\(\\)/&%\\^\\$§³²°!\"])*(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)).*");
  31. if(Regex_Check(string, ipRegex))
  32. {
  33. Regex_Delete(ipRegex);
  34. foreach (new k : Player)
  35. {
  36. if(playerData[k][pd_AdminRank] > 2)
  37. {
  38. if(playerData[k][pd_AdminRank] >= playerData[pid][pd_AdminRank])
  39. {
  40. new zu[128];
  41. format(zu, sizeof(zu), "[SERVER] %s(%i) probably advertises: %s", ReturnPlayerName(pid), pid, string);
  42. SendClientMessage(k, COLOR_ALERT, zu);
  43. SendClientMessage(pid, COLOR_NOTIFY, "[SERVER] Found possible Advertisment. ");
  44. }
  45. }
  46. }
  47. strdel(ColADV[pid], 0, strlen(ColADV[pid]));
  48. return 1;
  49. }
  50. //Domain-Checker
  51. new Regex:domainRegex = Regex_New("(.*([\\\\`´\\?\\*'#~\\+-_;\\.,:=}{\\[\\]\\(\\)/&%\\^\\$§³²°!\"]{1,1}\\w{1,18})).*");
  52. if(Regex_Check(string, domainRegex))
  53. {
  54. Regex_Delete(domainRegex);
  55. foreach (new u : Player)
  56. {
  57. if(playerData[u][pd_AdminRank] > 2)
  58. {
  59. if(playerData[u][pd_AdminRank] >= playerData[pid][pd_AdminRank])
  60. {
  61. new du[128];
  62. format(du, sizeof(du), "[SERVER] %s(%i) is probably advertising: %s", ReturnPlayerName(pid), pid, string);
  63. SendClientMessage(pid, COLOR_NOTIFY, "[SERVER] Found possible Advertisment.");
  64. SendClientMessage(u, COLOR_ALERT, du);
  65. return 1;
  66. }
  67. }
  68. }
  69.  
  70. for(new z = 0; z < sizeof(SearchDomain); z++)
  71. {
  72. if(strcmp(string, SearchDomain[z]) == 0)
  73. {
  74. foreach (new p : Player)
  75. {
  76. if(playerData[p][pd_AdminRank] > 2)
  77. {
  78. if(playerData[p][pd_AdminRank] >= playerData[pid][pd_AdminRank])
  79. {
  80. new mu[128];
  81. format(mu, sizeof(mu), "[SERVER] %s(%i) advertises: %s", ReturnPlayerName(pid), pid, string);
  82. SendClientMessage(pid, COLOR_NOTIFY, "[SERVER] Found possible Advertisment. ");
  83. SendClientMessage(p, COLOR_ALERT, mu);
  84. strdel(ColADV[pid], 0, strlen(ColADV[pid]));
  85. return 1;
  86. }
  87. }
  88. }
  89. }
  90. }
  91. strdel(ColADV[pid], 0, strlen(ColADV[pid]));
  92. return 1;
  93. }
  94.  
  95. return 0;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement