04.05.2017, 15:48
Hi,
I'm trying to use an "if" statement with "data" in this code: ( From HTTP in wiki )
and it returns:
example of usage:
thanks.
I'm trying to use an "if" statement with "data" in this code: ( From HTTP in wiki )
PHP код:
forward MyHttpResponse(index, response_code, data[]);
public OnPlayerCommandText(playerid, cmdtext[])
{
if(!strcmp("/hello",cmdtext,true))
{
HTTP(playerid, HTTP_GET, "kc.gd/hello.txt", "", "MyHttpResponse");
return 1;
}
return 0;
}
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);
}
}
Код:
error 033: array must be indexed (variable "databody")
PHP код:
if(databody == -1){

