Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Auto Tradutor GameMode/Filterscript
- Criado por Bruno da Silva (DraKiNs)
- (c) Copyright [iPs]TeaM 2011
- */
- //-------------------------
- #include a_samp
- //==== [ Configurações ] =====
- #if !defined MAX_LINES
- #define MAX_LINES 2000
- #endif
- #if !defined MAX_LINES
- #define MAX_STRING 0512
- #endif
- //===== [ Sistema ] ========
- new
- File:sFile,
- sStringFile[MAX_STRING];
- public OnFilterScriptInit()
- {
- SetTimer("Traduzir", 30000, false);
- sFile = fopen("/Mensagens.txt", io_write);
- new File:iArquivo = fopen("/gamemode.ini", io_read);
- while(fread(iArquivo, sStringFile)) getQuoteText(sStringFile);
- fclose(iArquivo);
- fclose(sFile);
- print("Strings do GameMode Retirada, favor traduza as mensagens do Mensagens.txt e aguarda alguns 30 segundos");
- return true;
- }
- getQuoteText(sString[])
- {
- new
- iFind = strfind(sString, "\x22", true),
- sStringTemp[MAX_STRING] = {EOS, ...};
- format(sStringTemp, MAX_STRING, sString);
- if(iFind != 0xFFFFFFFF) {
- format(sString, MAX_STRING, "%s",sString[iFind+1]);
- iFind = strfind(sString, "\x22", true);
- sString[iFind+0] = '\r', sString[iFind+1] = '\n',sString[iFind+2] = '\0';
- fwrite(sFile, sString);
- }
- return sStringTemp;
- }
- //==================================
- new
- iFileCurrent = 0xFFFFFFFF,
- iVal = 0xFFFFFFFF,
- sTempFile[MAX_LINES][MAX_STRING],
- sDataFile[MAX_STRING],
- sDataChive[MAX_STRING];
- forward Traduzir();
- public Traduzir()
- {
- print("Traduzindo Aguarde");
- new File:arquivo = fopen("/Mensagens.txt", io_read);
- while(fread(arquivo,sStringFile)) {
- iFileCurrent++;
- format(sTempFile[iFileCurrent], MAX_STRING, sStringFile);
- sTempFile[iFileCurrent][strlen(sTempFile[iFileCurrent]) - 2] = EOS;
- }
- fclose(arquivo);
- iFileCurrent = 0xFFFFFFFF,iVal = 0xFFFFFFFF;
- new File:iArquivo = fopen("/gamemode.ini", io_read);
- arquivo = fopen("/Mensagens.txt", io_write);
- while(fread(iArquivo, sStringFile)) {
- format(sDataFile, MAX_STRING, sStringFile);
- sDataFile[strlen(sDataFile) - 2] = EOS;
- iVal = strfind(sDataFile, "\x22", true);
- if(iVal != 0xFFFFFFFF) {
- ++iFileCurrent;
- format(sDataChive, MAX_STRING, sStringFile[iVal + 2]);
- strdel(sDataFile, iVal + 1, strfind(sDataChive, "\x22", true) + iVal + 2);
- strins(sDataFile, sTempFile[iFileCurrent], iVal , MAX_STRING);
- strcat(sDataFile,"\n");
- }
- fwrite(arquivo,sDataFile);
- }
- fclose(iArquivo);
- fclose(arquivo);
- print("Traduzido Olhe novamente o Mensagens.txt");
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement