17.07.2014, 23:29
This ties in with the last thread I made (https://sampforum.blast.hk/showthread.php?tid=526506)
I can't seem to figure this out, though i'm sure it's simple..
The objects are only loading into the server from the last project created. (the highest id) I'm assuming it has something to do with my use of a loop inside of a loop, but I don't really know another way to do this, i've never attempted anything of this sort before. Anyhow, this is my loading function.
I can't seem to figure this out, though i'm sure it's simple..
The objects are only loading into the server from the last project created. (the highest id) I'm assuming it has something to do with my use of a loop inside of a loop, but I don't really know another way to do this, i've never attempted anything of this sort before. Anyhow, this is my loading function.
pawn Код:
stock LoadObjects()
{
for(new project; project<GetCreatedProjects()+1; project++)
{
for(new i; i<GetCreatedObjects(project)+1; i++)
{
LoadObject(project, i);
}
}
}
stock LoadObject(project, id)
{
new Query[800], string[50];
format(Query, sizeof(Query), "SELECT * FROM `Project_%d` WHERE `ID` = %d", project, id);
mysql_query(Query);
mysql_store_result();
while(mysql_fetch_row_format(Query,"|"))
{
mysql_fetch_field_row(string, "ID");
ObjectInfo[id][oID] = strval(string);
mysql_fetch_field_row(string, "MODEL");
ObjectInfo[id][oModel] = strval(string);
mysql_fetch_field_row(string, "X");
ObjectInfo[id][oX] = floatstr(string);
mysql_fetch_field_row(string, "Y");
ObjectInfo[id][oY] = floatstr(string);
mysql_fetch_field_row(string, "Z");
ObjectInfo[id][oZ] = floatstr(string);
mysql_fetch_field_row(string, "RX");
ObjectInfo[id][orX] = floatstr(string);
mysql_fetch_field_row(string, "RY");
ObjectInfo[id][orY] = floatstr(string);
mysql_fetch_field_row(string, "RZ");
ObjectInfo[id][orZ] = floatstr(string);
}
mysql_free_result();
ObjectInfo[id][oProject] = project;
return 1;
}