Quote:
Originally Posted by TwinkiDaBoss
Alright so the problem is quite simple, it saves factory data for 2-3 but not for 1
PHP код:
public OnFactoryLoad()
{
new rows, fields;
cache_get_data(rows, fields, mysql);
if(rows)
{
for(new i = 1; i < rows && i < MAX_FACTORIES; i++)
{
FactoryData[i][FactoryID] = cache_get_field_content_int(i,"ID");
FactoryData[i][FactoryResources] = cache_get_field_content_int(i,"Resources");
}
}
return true;
}
SaveFactories() {
new query[128];
for(new x = 1; x < MAX_FACTORIES; x++) {
mysql_format(mysql, query, sizeof(query), "UPDATE `factories` SET `Resources`=%f WHERE `ID`=%d",\
FactoryData[x][FactoryResources],FactoryData[x][FactoryID]);
}
return true;
}
CMD:test(playerid,params[]) {
FactoryData[1][FactoryResources] = 500;
FactoryData[2][FactoryResources] = 6520;
FactoryData[3][FactoryResources] = 3000;
return true;
}
|
How you demand the table to be updated when you format but doesn't send the query?
PHP код:
mysql_format(mysql, query, sizeof(query), "UPDATE `factories` SET `Resources`=%f WHERE `ID`=%d",\
FactoryData[x][FactoryResources],FactoryData[x][FactoryID]);
mysql_tquery(mysql,query);