26.07.2016, 19:24
It gets more tricky right now since crashdetect did not report anything. I've seen similar thing once but was a bug with NULL from the plugin - not sure in which version it was and what version you are using.
Let's begin by debugging it manually to see where it stops:
and so on, continue the rest (print every line).
---
Something I forgot to mention the previous times is what happens when there are more rows that the size of the hInfo array. In this case, you don't have any run time error as crashdetect did not report anything but we gotta prevent it in case it happens in the future.
---
The player's name can be selected in the same query you select all the data but let's leave it out for now to fix the issue first. At least use this version:
Let's begin by debugging it manually to see where it stops:
pawn Код:
new rows, fields;
cache_get_data(rows, fields, mysql);
printf("rows: %i", rows);
pawn Код:
hInfo[i][hID] = cache_get_row_int(i, 0);
printf("hInfo[%i][hID] = %i", i, hInfo[i][hID]);
cache_get_row(i, 2, housetitle);
printf("housetitle: %s", housetitle);
cache_get_row(i, 3, housepw);
printf("housepw: %s", housepw);
hInfo[i][hOwner] = cache_get_row_int(i, 1);
printf("hInfo[i][Owner] = %i", hInfo[i][hOwner]);
hInfo[i][hInterior] = cache_get_row_int(i, 10);
printf("hInfo[i][hInterior] = %i", hInfo[i][hInterior]);
---
Something I forgot to mention the previous times is what happens when there are more rows that the size of the hInfo array. In this case, you don't have any run time error as crashdetect did not report anything but we gotta prevent it in case it happens in the future.
pawn Код:
for(new i = 0; i < rows; i++)
{
if (i == sizeof hInfo)
{
printf("House limit (%i) was reached. %i rows returned.", sizeof hInfo, rows);
break; // stop the loop
}
hInfo[i][hID] = cache_get_row_int(i, 0);
...
The player's name can be selected in the same query you select all the data but let's leave it out for now to fix the issue first. At least use this version:
PHP код:
GetNameFromMySQLID(sqlid)
{
// Don't select all the data, just the column for the name. Modify to match your table's structure
new query[50];
mysql_format(mysql, query, sizeof(query), "SELECT Name FROM accounts WHERE ID = %d LIMIT 1", sqlid);
new Cache: result = mysql_query(mysql, query);
if (cache_get_row_count()) cache_get_row(0, 0, query);
else query = "0";
cache_delete(result);
return query;
}