HTTP(... Works?
#1

I'm scripting a sendmail system, but when the script is executed nothing happend... have a bug?
On web browser works fine!

pawn Код:
#include <a_samp>
#include <a_http>
new coordsstring2[300], DialogStatus2[3000];

public OnPlayerCommandText(playerid, cmdtext[])
{
    new cmd[256];
    new tmp[256];
    new idx;
    cmd = strtok(cmdtext, idx);
    new NomePlayer[MAX_PLAYER_NAME];
    GetPlayerName(playerid, NomePlayer, sizeof(NomePlayer));
    if(strcmp(cmd, "/test", true) == 0)
    {
       
        strdel(DialogStatus2, 0, 3000);
        format(coordsstring2, sizeof(coordsstring2), "Olб, %s! Seu registro em nosso servidor Dark Street    Deathmatch foi realizado com sucesso!\n",NomePlayer);
        strcat(DialogStatus2,coordsstring2);
        format(coordsstring2, sizeof(coordsstring2), "Segue abaixo os dados de login de sua conta:\n");
        strcat(DialogStatus2,coordsstring2);
        format(coordsstring2, sizeof(coordsstring2), "Nome: %s\nSenha: 12345\n\n",NomePlayer);
        strcat(DialogStatus2,coordsstring2);
        format(coordsstring2, sizeof(coordsstring2), "ATENЗГO: Este e-mail й automбtico, nгo responda!");
        strcat(DialogStatus2,coordsstring2);
        SendMail("my-email-here@gmail.com","Account","my-email-here@gmail.com",DialogStatus2);
        return 1;
    }
}

stock SendMail(Email[],Assunto[],Remetente[],Mensagem[])
{
    new Link[1200];
    format(Link,sizeof(Link),"emailserver.esy.es/Sendmail.php?Email=%s&Assunto=%s&From=%s&Mensagem=%s",Email,Assunto,Remetente,Mensagem);
    for(new c; c < strlen(Link)+1; c++)
    {
         if(Link[c] == ' ') Link[c] = '+';
    }
    HTTP(0, HTTP_POST, Link, "", "MyHttpResponse");
    return 1;
}

forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
    // In this callback "index" would normally be called "playerid" ( if you didn't get it already :) )
    new
        buffer[ 128 ];
    if(response_code == 200) //Did the request succeed?
    {
        //Yes!
        format(buffer, sizeof(buffer), "The URL replied: %s", data);
        SendClientMessage(index, 0xFFFFFFFF, buffer);
    }
    else
    {
        //No!
        format(buffer, sizeof(buffer), "The request failed! The response code was: %d", response_code);
        SendClientMessage(index, 0xFFFFFFFF, buffer);
    }
}
Reply
#2

Sorry, but somebody can help me?
Reply
#3

Wtf
Код:
DialogStatus2[3000]
Reply
#4

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
Wtf
Код:
DialogStatus2[3000]
Is not a local string... so, have no problem!
I have tried without strings, just the text on SendMail(... but don't works too!
Reply
#5

You need really of 3000 characters ?
Reply
#6

Quote:
Originally Posted by Dutheil
Посмотреть сообщение
You need really of 3000 characters ?
Man, please, the string is not the problem here, understand?
I have tried: SendMail("my-email-here@gmail.com","Conta","my-email-here@gmail.com","Testing text");
The problem is the HTTP(... function that not works or not give a return!
Reply
#7

Fixed by me...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)