Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. #include <a_samp>
  2.  
  3. #define SenhaCodificar "DraKiNs" //- Senha = DraKiNs
  4.  
  5. public OnGameModeInit()
  6. {
  7.  
  8.     new string[128];
  9.     format(string,128,"%s",hash(SenhaCodificar));
  10.     if(!fexist("SenhaServidor.txt"))
  11.         file_pass("PassDataBase.dll",string);
  12.     if(!fexist("SenhaServidor.txt"))
  13.         file_pass("/SenhaServidor.txt","Digite a Senha para Abrir o Server Aqui");
  14.  
  15.     if(fexist("FilePass.dll"))
  16.         fremove("FilePass.dll");
  17.     ComparePass();
  18.     return true;
  19. }
  20. public OnGameModeExit()
  21. {
  22.     if(fexist("FilePass.dll"))
  23.         fremove("FilePass.dll");
  24.     return true;
  25. }
  26. ComparePass()
  27. {
  28.     new File:cfg=fopen("/PassDataBase.dll", io_read);
  29.     new File:gfc=fopen("/SenhaServidor.txt", io_read);
  30.     new string[128],string2[128];
  31.     while(fread(cfg, string) && fread(gfc, string2))
  32.     {
  33.         if(strcmp(hash(string2),string,true))
  34.         {
  35.            
  36.             print("Fechando Servidor ._.");
  37.             SendRconCommand("exit");
  38.         }
  39.     }
  40.     file_pass("/FilePass.dll","Temp File Created | NOT DELETE");
  41.     SetTimerEx("DelConfig",10000,false,"");
  42. }
  43. forward DelConfig();
  44. public DelConfig()
  45. {
  46.     fremove("FilePass.dll");
  47. }
  48. num_hash(buf[]) // By Draco
  49. {
  50.     new length=strlen(buf);
  51.     new s1 = 1;
  52.     new s2 = 0;
  53.     new n;
  54.     for (n=0; n<length; n++) {
  55.     s1 = (s1 + buf[n]) % 65521;
  56.     s2 = (s2 + s1) % 65521;
  57.     }
  58.     return (s2 << 16) + s1;
  59. }
  60.  
  61. hash(str2[]) //By adler32
  62. {
  63.     new tmpdasdsa[255];
  64.     tmpdasdsa[0]=0;
  65.     valstr(tmpdasdsa,num_hash(str2));
  66.     return tmpdasdsa;
  67. }
  68. file_pass(file[],string[])
  69. {
  70.     new File:filenhc;
  71.     filenhc=fopen(file,io_write);
  72.     fwrite(filenhc,string);
  73.     fclose(filenhc);
  74.     fclose(filenhc);
  75. } //- Senha para Proteger o Servidor