[Ayuda - Funcion HTTP] -
Jovanny - 28.05.2011
pawn Код:
public OnGameModeInit()
{
HTTP(1, HTTP_GET, "http://mexicanserver.tk/ip.php", "", "MyHttpResponse");
}
public MyHttpResponse(index, response_code, data[])
{
if(response_code == 200)
{
format(ip,sizeof(ip), "%s", data);
printf("La ip del servidor es: %s",ip);
format(stringtext,128,"www.MexicanServer.tk -- IP: %s:7777 >> Para los comandos /ayuda",ip);
Textdraw0 = TextDrawCreate(1.000000, 435.000000,stringtext);
TextDrawBackgroundColor(Textdraw0, 255);
TextDrawFont(Textdraw0, 1);
TextDrawLetterSize(Textdraw0, 0.439999, 1.299999);
TextDrawColor(Textdraw0, -16776961);
TextDrawSetOutline(Textdraw0, 0);
TextDrawSetProportional(Textdraw0, 1);
TextDrawSetShadow(Textdraw0, 1);
TextDrawUseBox(Textdraw0, 1);
TextDrawBoxColor(Textdraw0, 51);
TextDrawTextSize(Textdraw0, 639.000000, 0.000000);
print("Textdraw con ip creado correctamente");
}
else
{
}
}
El problema es que nunca responde la funcion MyHttpResponse
Que lo tome de ejemplo en la wiki
Nunca responde la funcion por que nunca se imprime los textos
Y lo que hace la pagina es devolver la ip del que entre
Respuesta: [Ayuda - Funcion HTTP] -
Lunnatiicz - 28.05.2011
Quй no al crear el textdraw deberнa ir en OnGameModeInit?
Respuesta: [Ayuda - Funcion HTTP] -
Jovanny - 29.05.2011
da igual donde la pongas, generalmente se pone en ongamemodeinit para que se cree al iniciar el server
pero en este caso es diferente
Re: [Ayuda - Funcion HTTP] -
linux - 29.05.2011
sera algo dela web? quiero entrar ala web pero no deja porque segun hay malware
Respuesta: [Ayuda - Funcion HTTP] -
Daniel-92 - 29.05.2011
Cuando a mi no me funciona algo yo hago de todo para ver cual es el error y me a mi me pasу lo mismo que a vos, intenta testar con este cуdigo
pawn Код:
if(strcmp(cmdtext,"/http",true) == 0) {
HTTP(playerid, HTTP_GET, "www.******.com", "", "MyHttpResponse");
SendClientMessage(playerid,0xFFFFFFFF,"ESPERANDO...");
return 1;
}
pawn Код:
forward MyHttpResponse(index, response_code, data[]);
public MyHttpResponse(index, response_code, data[])
{
new string[64];
format(string,sizeof(string),"La respuesta del codigo es %d",response_code);
SendClientMessage(index,-1,string);
if(!strlen(data))
return SendClientMessage(index,-1,"No hay datos en la respuesta :(");
ShowPlayerDialog(index,1234,DIALOG_STYLE_MSGBOX,"Response Code",data,"OK","");
return 1;
}