Invalid rows
#1

I got a problem with the script where when you login, with the correct password; it logs the error
Code:
[15:01:45] [WARNING] CMySQLResult::GetRowData - invalid row ('1') or field index ('3')
When there is a row with the correct values etc.

If you can, could you point out the issue, if there is one that is :L
Code:
case DIALOG_LOGIN:
		{
			if(!response) return Kick(playerid);
			else
			{
				mysql_format(sql, query, sizeof(query), "SELECT * FROM masterdata WHERE uName = '%e' AND uPass = MD5('%e')", MasterData[playerid][uName], inputtext);
				mysql_tquery(sql, query, "OnPlayerAccountLogin", "i", playerid);
			}
		}
Code:
forward OnPlayerAccountLogin(playerid);
public OnPlayerAccountLogin(playerid)
{
	cache_get_data(rows, fields);
	if(rows > 0)
	{
		/*format(query, sizeof(query), "UPDATE master_data SET LastIP = '%s' WHERE Username = '%s'", PlayerIP(playerid), MasterData[playerid][uName]);
		mysql_query(query);*/
		cache_get_row(rows, 3, query);
		if(strfind(query, "")) return query = "Create Character";
		MasterData[playerid][Char0] = query;
		cache_get_row(rows, 4, query);
		if(strfind(query, "")) return query = "Create Character";
		MasterData[playerid][Char1] = query;
		cache_get_row(rows, 5, query);
		if(strfind(query, "")) return query = "Create Character";
		MasterData[playerid][Char2] = query;
		//format(msg, sizeof(msg), "Welcome back %s.\nYour stats have been loaded succesfully.\nThe last login for this account was from IP: %s", PlayerName(playerid), Player_Data[playerid][Last_IP]);
		format(str, sizeof(str), "%s\n%s\n%s\n \nAccount Settings", MasterData[playerid][Char0], MasterData[playerid][Char1], MasterData[playerid][Char2]);
		ShowPlayerDialog(playerid, DIALOG_CHARSELECT, DIALOG_STYLE_LIST, "Duck's Roleplay - Account", str, "Select", "Quit");
	}
}
Reply
#2

cache_get_row(rows, ...

There is max 1 player with that name and password registered and rows start from 0 so change the bold text above with 0.
Reply
#3

I've changed it but it still doesn't work.

But I am confused on why it does this in the error?
Code:
[15:38:14] [DEBUG] mysql_format - connection: 1, len: 128, format: "SELECT * FROM masterdata WHERE uName = '%e' AND uPass = MD5('%e')"
[15:38:14] [DEBUG] mysql_tquery - connection: 1, query: "SELECT * FROM masterdata WHERE uName = 'Duck' AND uPass = MD5('p", callback: "OnPlayerAccountLogin", format: "i"
is it supposed to miss out the full value of the uPass on the second line like that? it seems odly strange..
Reply
#4

Check those lines with [WARNING] or [ERROR] prefix only, the rest have no issues.

As for your code, never copy strings with = sign and the if statement will always be true (strfind check) and it will stop the code right there without showing the dialog. Even if it's not empty.

Just use isnull and not return at all. In case you don't have it defined:
PHP Code:
#if !defined isnull
    #define isnull(%1) ((!(%1[0])) || (((%1[0]) == '\1') && (!(%1[1]))))
#endif 
PHP Code:
forward OnPlayerAccountLogin(playerid);
public 
OnPlayerAccountLogin(playerid)
{
    
cache_get_data(rowsfields);
    if(
rows 0)
    {
        
/*format(query, sizeof(query), "UPDATE master_data SET LastIP = '%s' WHERE Username = '%s'", PlayerIP(playerid), MasterData[playerid][uName]);
        mysql_query(query);*/
        
        
cache_get_row(rows3query);
        if(
isnull(query)) strcat((MasterData[playerid][Char0][0] = EOSMasterData[playerid][Char0]), "Create Character"17);
        
cache_get_row(rows4query);
        if(
isnull(query)) strcat((MasterData[playerid][Char1][0] = EOSMasterData[playerid][Char1]), "Create Character"17);
        
        
cache_get_row(rows5query);
        if(
isnull(query)) strcat((MasterData[playerid][Char2][0] = EOSMasterData[playerid][Char2]), "Create Character"17);
        
        
//format(msg, sizeof(msg), "Welcome back %s.\nYour stats have been loaded succesfully.\nThe last login for this account was from IP: %s", PlayerName(playerid), Player_Data[playerid][Last_IP]);
        
format(strsizeof(str), "%s\n%s\n%s\n \nAccount Settings"MasterData[playerid][Char0], MasterData[playerid][Char1], MasterData[playerid][Char2]);
        
ShowPlayerDialog(playeridDIALOG_CHARSELECTDIALOG_STYLE_LIST"Duck's Roleplay - Account"str"Select""Quit");
    }

Reply
#5

Thank you so much, it works perfectly now.
Rep++
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)