error 033: array must be indexed (variable "tmp")
#1

pawn Код:
//475   if(dialogid == DIALOG_LOGIN)
//476   {
//477       if(!response)
//478       {
//479            SendClientMessage(playerid, COLOR_RED,"You have been kicked as you have selected 'Quit'.");
//480            Kick(playerid);
//481       }
//482       else if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"This Account Is Registered","Please Login","Submit","Quit");
//483       new tmp[50];
//484           format(Query, sizeof(Query), "SELECT * FROM SAMPplayers WHERE name='%s'", name);
//485       mysql_query(Query);
//486       mysql_store_result();
//487       tmp = mysql_fetch_field_row(tmp,"Password");
//488       if(udb_hash(inputtext) != tmp) {
//489            SendClientMessage(playerid, COLOR_RED," Invalid Password");
//490            ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT,"This Account Is Registered","Please Login","Submit","Quit");
//491       }
//492       else
//493       {
//494            format(string,sizeof(string),"Welcome back %s! Spawning where you last quit...",name);
//495            SendClientMessage(playerid,COLOR_JOIN,string);
//496            SetPlayerInterior(playerid,0);
//497            SetTimerEx("SpawnLastSaved",1000,false,"i",playerid);
//498       }
//499   }
//500   mysql_free_result();
//501   return 1;
//502 }
Errors:
pawn Код:
TEST.pwn(487) : error 033: array must be indexed (variable "tmp")
TEST.pwn(488) : error 033: array must be indexed (variable "tmp")
Reply
#2

pawn Код:
mysql_fetch_field_row(tmp,"Password");
if(strcmp(udb_hash(inputtext) ,true, tmp));
you can't use strings like that, they are just arrays of chars
the first line is passing the var into it so no need for tmp=

and the second youll need to use strcmp like i showed,
you cant do
if(string==otherstring)

EDIT:

ops!
Vince is correct, I dont use this hash as its to weak

new code

pawn Код:
mysql_fetch_field_row(tmp,"Password");
if (udb_hash(inputtext) != strval(tmp))
this should work..
not sure if its better to convert to integer or to format the pass into a string.
Reply
#3

udb_hash generates an integer, actually. But then again, you would be comparing an integer with a string which obviously isn't going to work out either.
Reply
#4

Thanks Jonny it worked.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)