Advertisement
Guest User

Untitled

a guest
Jul 13th, 2013
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.91 KB | None | 0 0
  1. #include <a_samp>
  2. #include <sscanf2>
  3. #include <regex>
  4.  
  5.  
  6. public OnFilterScriptInit(){
  7. printf("(mailed) Emial marcincotoejst@wp.pl jest %s a email lubie@i. jest %s",(mailed("marcincotoejst@wp.pl") == 1) ? ("Dobry"): ("Zył"), (mailed("lubie@i.") == 1) ? ("Dobry"): ("Zły"));
  8. printf("(IsMail) Emial marcincotoejst@wp.pl jest %s a email lubie@i. jest %s",(IsMail("marcincotoejst@wp.pl") == 1) ? ("Dobry"): ("Zył"), (IsMail("lubie@i.") == 1) ? ("Dobry"): ("Zły"));
  9. printf("(IsEmail) Emial marcincotoejst@wp.pl jest %s a email lubie@i. jest %s",(IsEmail("marcincotoejst@wp.pl") == 1) ? ("Dobry"): ("Zył"), (IsEmail("lubie@i.") == 1) ? ("Dobry"): ("Zły"));
  10.  
  11. new time;
  12.  
  13. time = GetTickCount();
  14. for( new i; i<5000; i++ ) mailed("marcincotoejst@wp.pl");
  15. printf("[mailed][dobrze] czas wykonywania %d ms", GetTickCount() - time);
  16.  
  17. time = GetTickCount();
  18. for( new i; i<5000; i++ ) mailed("lubie@i.");
  19. printf("[mailed][źle] czas wykonywania %d ms", GetTickCount() - time);
  20.  
  21. printf(" ");printf(" ");
  22. time = GetTickCount();
  23. for( new i; i<5000; i++ ) IsMail("marcincotoejst@wp.pl");
  24. printf("[IsMail][dobrze] czas wykonywania %d ms", GetTickCount() - time);
  25.  
  26. time = GetTickCount();
  27. for( new i; i<5000; i++ ) IsMail("lubie@i.");
  28. printf("[IsMail][źle] czas wykonywania %d ms", GetTickCount() - time);
  29. printf(" ");printf(" ");
  30. time = GetTickCount();
  31. for( new i; i<5000; i++ ) IsEmail("marcincotoejst@wp.pl");
  32. printf("[IsEmail][dobrze] czas wykonywania %d ms", GetTickCount() - time);
  33.  
  34. time = GetTickCount();
  35. for( new i; i<5000; i++ ) IsEmail("lubie@i.");
  36. printf("[IsEmail][źle] czas wykonywania %d ms", GetTickCount() - time);
  37.  
  38.  
  39. return 1;
  40. }
  41.  
  42. stock mailed(buffer_mail[]) //by drzymalsw
  43. {
  44. static mail[2][20];
  45. if( !sscanf( buffer_mail, "p<@>s[30]s[10]", mail[0], mail[1] ) ){
  46. if( !sscanf( mail[1], "p<.>s[30]s[10]", mail[0], mail[1] ) ){
  47. if( strlen(mail[0]) > 1 && strlen( mail[1] ) > 1 ) return 1;
  48. }
  49. else return 0;
  50. } else return 0;
  51. return 0;
  52. }
  53.  
  54. stock IsMail(const text[])
  55. {
  56. static
  57. RegEx:rMail;
  58. if(!rMail) rMail = regex_build("[a-zA-Z0-9_\\.]+@([a-zA-Z0-9\\-]+\\.)+[a-zA-Z]{2,4}");
  59. return regex_match_exid(text, rMail);
  60. }
  61.  
  62. stock IsEmail(txt[]) //by drzymalsw
  63. {
  64. new g[5];
  65. for(new c; txt[c]; c++)
  66. {
  67. if(txt[c] == '@')
  68. {
  69. if(c==0) return 0;
  70. if(g[1]) return 0;
  71. if(g[0]) return 0;
  72. g[0] = 1;
  73. continue;
  74. }
  75. if(g[0] && txt[c] != '.') g[2] ++;
  76. if(txt[c] == '.')
  77. {
  78. if(c==0) return 0;
  79. if(c==strlen(txt)) return 0;
  80. if(!g[0])
  81. {
  82. if(g[4]) return 0;
  83. else
  84. {
  85. g[4] = 1;
  86. continue;
  87. }
  88. }
  89. if(g[1]) return 0;
  90. if(!g[2]) return 0;
  91. g[1] = 1;
  92. continue;
  93. }
  94. if(g[1])
  95. {
  96. g[3] ++;
  97. if(g[3] > 3) return 0;
  98. }
  99. if(((txt[c] < 65 && (txt[c] > 57 || txt[c] < 48)) || txt[c] > 122 || (txt[c] > 90 && txt[c] < 97)) && txt[c] != '_') return 0;
  100. }
  101.  
  102. if(!g[0] || !g[1]) return 0;
  103. return 1;
  104. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement