Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #include <a_http>
- #define APP_ID "6635D742380CF583FEE16FF83E80BC8238F166E3"
- forward traduzirTexto(de[], para[], texto[]);
- forward textoTraduzidoAction(index, response_code, data[]);
- public traduzirTexto(de[], para[], texto[]) {
- new url[128];
- format(url, sizeof(url), "api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=%s&from=%s&to=%s&text=%s", APP_ID, de, para, texto);
- HTTP(-1, HTTP_GET, url, "", "textoTraduzidoAction");
- }
- public textoTraduzidoAction(index, response_code, data[])
- {
- new formataSaida[4][1024];
- explode(formataSaida, data, "\""); // Retirar aspas
- SendClientMessageToAll(0xFF000000, formataSaida[1]);
- }
- stock explode(aExplode[][], const sSource[], const sDelimiter[] = " ", iVertices = sizeof aExplode, iLength = sizeof aExplode[])
- {
- new
- iNode,
- iPointer,
- iPrevious = -1,
- iDelimiter = strlen(sDelimiter);
- while(iNode < iVertices)
- {
- iPointer = strfind(sSource, sDelimiter, false, iPointer);
- if(iPointer == -1)
- {
- strmid(aExplode[iNode], sSource, iPrevious, strlen(sSource), iLength);
- break;
- }
- else
- {
- strmid(aExplode[iNode], sSource, iPrevious, iPointer, iLength);
- }
- iPrevious = (iPointer += iDelimiter);
- ++iNode;
- }
- return iPrevious;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement