28.04.2016, 18:04
I'm sorry for the late reply.
What jlalt said was very helpful.
This is only a testing code, so you'll have to change the HTTP index if you want multiple people to use this.
Also, the "langout=fr" at the end of the URL is the language the website will translate the string to.
I've only tried it with french, but I think it'll cause problems once it starts to show the none english characters. (For example й and shit like that)
Signs like # will fuck it up so I think you should limit the input text to A-Z only.
You can always find a fix for that, but I'm not that good with URLs, and I'm a bit lazy.
What jlalt said was very helpful.
This is only a testing code, so you'll have to change the HTTP index if you want multiple people to use this.
Also, the "langout=fr" at the end of the URL is the language the website will translate the string to.
I've only tried it with french, but I think it'll cause problems once it starts to show the none english characters. (For example й and shit like that)
Signs like # will fuck it up so I think you should limit the input text to A-Z only.
You can always find a fix for that, but I'm not that good with URLs, and I'm a bit lazy.
Код:
forward HTTP_TranslateResponse(index, response_code, data[]) public OnGameModeInit() { new str[128]; strcat(str, "Hello, my name is James. How are you?"); for (new i; i < 82; i++) { if (str[i] == ' ') { str[i] = '+'; } } format(str, sizeof (str), "udcs-tss.com/******/?msg=%s&langin=en&langout=fr", str); HTTP(0, HTTP_GET, str, "", "HTTP_TranslateResponse"); return 1; } public HTTP_TranslateResponse(index, response_code, data[]) { if(response_code == 200) { if (strfind(data, "\n") != -1) { strdel(data, 0, strfind(data, "\n")+1); strdel(data, strlen(data)-6, strlen(data)); } print(data); } else { printf("Error ID: %i", response_code); } }