SA-MP Forums Archive
I need help with HTTP_GET - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: I need help with HTTP_GET (/showthread.php?tid=351358)



I need help with HTTP_GET - mineralo - 15.06.2012

ok, I'm trying make a cmd which will translate his text to other language, I just testing on 2 languages and I getting error when I use the cmd

pawn Код:
if(!strcmp(cmdtext, "/nme", true, 4)) if(Logged[playerid] == 1)
    {
        new string[256];
        if(cmdtext[4] == 0)return SendClientMessage(playerid, COLOR_YELLOW, "( ! ) /nme <message>");
        Translated(playerid,cmdtext[4]);
        format(string,256,"( T ) Original message: %s",cmdtext[5]);
        SendClientMessageToAll(COLOR_WHITE,string);
        return 1;
    }
stock Translated(playerid,string[])
{
    new text[256];
    format(text,256,"http://translate.******.ru/#%s|%s|%s","ro","en",string);
    HTTP(playerid, HTTP_GET,text, "", "MyHttpResponse");
    return 1;
}
public MyHttpResponse(index, response_code, data[])
{
    new buffer[256];
    if(response_code == 200)
    {
        format(buffer,256,"( T ) %s: %s",PlayerName(index),data);
        SendClientMessageToAll(GetPlayerColor(index),buffer);
    }
    else
    {
        format(buffer, sizeof(buffer),"( T ) The text couldn't translate, error code: %d", response_code);
        SendClientMessageToAll(c_r,buffer);
    }
}
error code: 1
http://i50.tinypic.com/kd0n12.png


Re: I need help with HTTP_GET - mineralo - 15.06.2012

I tried
pawn Код:
stock Translated(playerid,string[])
{
    new text[256];
    format(text,256,"translate.******.ru/#%s|%s|%s","ro","en",string);
    HTTP(playerid, HTTP_GET,text, "", "MyHttpResponse");
    return 1;
}
and I got error code:400
I checked it in internet and its mean bad request :/


Re: I need help with HTTP_GET - Vince - 15.06.2012

Like I said in another topic just today, ******'s Translate API is now a paid only service.


Re: I need help with HTTP_GET - mineralo - 16.06.2012

Quote:
Originally Posted by Vince
Посмотреть сообщение
Like I said in another topic just today, ******'s Translate API is now a paid only service.
damn