Advertisement
DraKiNs

[COD] Tradutor de GameMode Automático (versão 0.1)

Jul 2nd, 2011
545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.71 KB | None | 0 0
  1. /*
  2.   Auto Tradutor GameMode/Filterscript
  3.  Criado por Bruno da Silva (DraKiNs)
  4.   (c) Copyright [iPs]TeaM  2011
  5. */
  6.  
  7. //-------------------------
  8.  
  9. #include a_samp
  10.  
  11. //==== [ Configurações ] =====
  12.  
  13. #if !defined MAX_LINES
  14.     #define MAX_LINES   2000
  15. #endif
  16.  
  17. #if !defined MAX_LINES
  18.     #define MAX_STRING  0512
  19. #endif
  20.  
  21. //===== [ Sistema ] ========
  22. new
  23.     File:sFile,
  24.     sStringFile[MAX_STRING];
  25.  
  26. public OnFilterScriptInit()
  27. {
  28.  
  29.     SetTimer("Traduzir", 30000, false);
  30.  
  31.     sFile = fopen("/Mensagens.txt", io_write);
  32.     new     File:iArquivo = fopen("/gamemode.ini", io_read);
  33.     while(fread(iArquivo, sStringFile)) getQuoteText(sStringFile);
  34.     fclose(iArquivo);
  35.     fclose(sFile);
  36.     print("Strings do GameMode Retirada, favor traduza as mensagens do Mensagens.txt e aguarda alguns 30 segundos");
  37.     return true;
  38. }
  39.  
  40.  
  41. getQuoteText(sString[])
  42. {
  43.     new
  44.         iFind = strfind(sString, "\x22", true),
  45.         sStringTemp[MAX_STRING] = {EOS, ...};
  46.  
  47.     format(sStringTemp, MAX_STRING, sString);
  48.  
  49.     if(iFind != 0xFFFFFFFF) {
  50.         format(sString, MAX_STRING, "%s",sString[iFind+1]);
  51.         iFind = strfind(sString, "\x22", true);
  52.         sString[iFind+0] = '\r', sString[iFind+1] = '\n',sString[iFind+2] = '\0';
  53.         fwrite(sFile, sString);
  54.     }
  55.     return sStringTemp;
  56. }
  57.  
  58.  
  59. //==================================
  60.  
  61. new
  62.     iFileCurrent = 0xFFFFFFFF,
  63.     iVal = 0xFFFFFFFF,
  64.     sTempFile[MAX_LINES][MAX_STRING],
  65.     sDataFile[MAX_STRING],
  66.     sDataChive[MAX_STRING];
  67.  
  68. forward Traduzir();
  69. public Traduzir()
  70. {
  71.     print("Traduzindo Aguarde");
  72.  
  73.     new File:arquivo = fopen("/Mensagens.txt", io_read);
  74.     while(fread(arquivo,sStringFile)) {
  75.         iFileCurrent++;
  76.         format(sTempFile[iFileCurrent], MAX_STRING, sStringFile);
  77.         sTempFile[iFileCurrent][strlen(sTempFile[iFileCurrent]) - 2] = EOS;
  78.     }
  79.     fclose(arquivo);
  80.  
  81.     iFileCurrent = 0xFFFFFFFF,iVal = 0xFFFFFFFF;
  82.     new File:iArquivo = fopen("/gamemode.ini", io_read);
  83.     arquivo = fopen("/Mensagens.txt", io_write);
  84.     while(fread(iArquivo, sStringFile)) {
  85.         format(sDataFile, MAX_STRING, sStringFile);
  86.         sDataFile[strlen(sDataFile) - 2] = EOS;
  87.         iVal = strfind(sDataFile, "\x22", true);
  88.         if(iVal != 0xFFFFFFFF) {
  89.             ++iFileCurrent;
  90.             format(sDataChive, MAX_STRING, sStringFile[iVal + 2]);
  91.             strdel(sDataFile, iVal + 1, strfind(sDataChive, "\x22", true) + iVal + 2);
  92.             strins(sDataFile, sTempFile[iFileCurrent], iVal , MAX_STRING);
  93.             strcat(sDataFile,"\n");
  94.         }
  95.         fwrite(arquivo,sDataFile);
  96.     }
  97.     fclose(iArquivo);
  98.     fclose(arquivo);
  99.     print("Traduzido Olhe novamente o Mensagens.txt");
  100.     return false;
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement