01.08.2018, 11:29
Hi guys.
Here's translator filterscript.
It can translate Chinese to English.
But a problem.When I try to translate and string is error.
Like this:
"你好" --- and translate to English --- "How are you doing" (Use Chrome to open web,normal translate)
"你好" --- and translate to English --- "脛茫潞脙" (Use a_http.inc,ERROR)
What the fuck is "脛茫潞脙" ? It even not a any language.
Here's translator filterscript.
It can translate Chinese to English.
But a problem.When I try to translate and string is error.
Like this:
"你好" --- and translate to English --- "How are you doing" (Use Chrome to open web,normal translate)
"你好" --- and translate to English --- "脛茫潞脙" (Use a_http.inc,ERROR)
What the fuck is "脛茫潞脙" ? It even not a any language.
Код:
#define FILTERSCRIPT #include <a_samp> #include <a_http> public OnPlayerText(playerid, text[]) { if(GetPVarInt(playerid,"translate0") == 1) { Translate(playerid,text); return 0; } return 1; } public OnPlayerCommandText(playerid, cmdtext[]) { if(strcmp(cmdtext, "/translator", true) == 0) { if(!GetPVarInt(playerid,"translate0")) { SetPVarInt(playerid,"translate0",1); } else { SendClientMessage(playerid,-1,"BYE"); DeletePVar(playerid,"translate0"); } return 1; } return 0; } stock Translate(playerid,text[]) { new Link[1200]; new cn[100]; format(cn,sizeof(cn),"%s",text); format(Link,sizeof(Link),"api.microsofttranslator.com/V2/Ajax.svc/Translate?appId=6635D742380CF583FEE16FF83E80BC8238F166E3&to=EN&text=%s",cn); for(new c; c < strlen(Link)+1; c++) { if(Link[c] == ' ') Link[c] = '+'; } HTTP(playerid, HTTP_GET, Link, "", "UpdateResponse"); return 1; } forward UpdateResponse(playerid, response_code, data[]); public UpdateResponse(playerid, response_code, data[]) { new string[1028]; if(response_code == 200) { if(strfind(data, "锘", true) != -1) strdel(data,0,3); format(string, sizeof(string), "%s", data); SendClientMessage(playerid,-1,string); } else { format(string, sizeof(string), "请求错误!错误代码:%d", response_code); SendClientMessage(playerid, 0xFFFFFFFF, string); } }