23.11.2014, 09:16
Hey guys,
I'm running a query that pulls all the objects from a specific table. This can range from 335 to 1000 rows that get pulled.
I'm running a for loop for each row and thus creating the object. When I do it, though, it seems to freeze my server (everything becomes unresponsive...) until such time that all the objects are loaded in.
Is there maybe a way to avoid this?
I'm running a query that pulls all the objects from a specific table. This can range from 335 to 1000 rows that get pulled.
I'm running a for loop for each row and thus creating the object. When I do it, though, it seems to freeze my server (everything becomes unresponsive...) until such time that all the objects are loaded in.
Is there maybe a way to avoid this?
pawn Код:
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows) {
for(new i = 0; i < rows; i++) {
new modelStr[5], posXStr[20], posYStr[20], posZStr[20], rotXStr[20], rotYStr[20], rotZStr[20];
new model, Float:posX, Float:posY, Float:posZ, Float:rotX, Float:rotY, Float:rotZ;
cache_get_field_content(i, "model", modelStr);
cache_get_field_content(i, "posX", posXStr);
cache_get_field_content(i, "posY", posYStr);
cache_get_field_content(i, "posZ", posZStr);
cache_get_field_content(i, "rotX", rotXStr);
cache_get_field_content(i, "rotY", rotYStr);
cache_get_field_content(i, "rotZ", rotZStr);
model = strval(modelStr);
posX = floatstr(posXStr);
posY = floatstr(posYStr);
posZ = floatstr(posZStr);
rotX = floatstr(rotXStr);
rotY = floatstr(rotYStr);
rotZ = floatstr(rotZStr);
Objects[i] = CreateDynamicObject(model, posX, posY, posZ, rotX, rotY, rotZ, worldID, 0, -1);
objectsLoaded++;
}
printf("[DD] LOAD: Successfully Loaded all Pickups!\n");
loadStep++;
onMapLoadMetaRequest(mapID);
}