[Help] Array error
#1

Код:
dcmd_login(playerid, params[])
{
    new tmpname[128], tmppass[32], query[256];
    GetPlayerName(playerid, tmpname, sizeof(tmpname));
    if(sscanf(params,"s",tmppass))
	{
		format(query,sizeof(query), "SELECT * FROM `samp` WHERE name='%s'", tmpname);
		mysql_query(query);
		mysql_store_result();
		if(mysql_num_rows() != 0)
		{
		    new line[256], data[2][32], id;
		    if(mysql_fetch_row(line))
		    {
		        sscanf(line,"p|dss",id,data[0],data[1]);
		        mysql_free_result();
		        if(data[1] == tmppass)
		        {
		            SendClientMessage(playerid, COLOR_MAIN, "Logged in");
		            return 1;
		        }
		        else
		        {
		            SendClientMessage(playerid, COLOR_ALERT, "Incorrect password");
		            return 1;
		        }
		    }
		}
	}
}
I'm getting this error on the bolded/coloured line:

error 033: array must be indexed (variable "data")

I've tried switching them around, and various other things, but I haven't got a clue what's wrong! Help!
Reply
#2

strval data[1]

Ex:
TestVar = strval(data[1]);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)