30.03.2014, 14:05
I've made a debug following my previous issues and the debug showed that it runs the same row all the time (shows the same row i times)
How can I fix it..? Not so strong at MySQL myself.
pawn Код:
stock LoadObjects()
{
new query[256],var[20][20], row[256], numrows;
format(query,sizeof(query),"SELECT * FROM `objects`");
mysql_query(query);
mysql_store_result();
if(mysql_num_rows() > 0)
{
mysql_fetch_row_format(row);
split(row,var,'|');
numrows = mysql_num_rows();
mysql_free_result();
for(new i=0;i<numrows;i++)
{
ObjectInfo[i][oID] = strval(var[13]);
ObjectInfo[i][oModel] = strval(var[1]);
ObjectInfo[i][oXP] = floatstr(var[2]);
ObjectInfo[i][oYP] = floatstr(var[3]);
ObjectInfo[i][oZP] = floatstr(var[4]);
ObjectInfo[i][rXP] = floatstr(var[5]);
ObjectInfo[i][rYP] = floatstr(var[6]);
ObjectInfo[i][rZP] = floatstr(var[7]);
ObjectInfo[i][worldid] = strval(var[8]);
ObjectInfo[i][interiorid] = strval(var[9]);
Obj[i] = CreateDynamicObject(ObjectInfo[i][oModel], ObjectInfo[i][oXP], ObjectInfo[i][oYP], ObjectInfo[i][oZP], ObjectInfo[i][rXP], ObjectInfo[i][rYP], ObjectInfo[i][rZP], ObjectInfo[i][worldid], ObjectInfo[i][interiorid], -1, 300.0);
printf("%i %i %f %f %f %f %f %f",ObjectInfo[i][oID],ObjectInfo[i][oModel],ObjectInfo[i][oXP],ObjectInfo[i][oYP],ObjectInfo[i][oZP],ObjectInfo[i][rXP],ObjectInfo[i][rYP],ObjectInfo[i][rZP]);
}
printf("%i objects loaded.",numrows);
}
}