17.11.2014, 12:02
I'm scripting a sendmail system, but when the script is executed nothing happend... have a bug?
On web browser works fine!
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);
}
}