Alright, ill try to explain as understandable as i can.
I have created 3dtextdraws which are showing values from sql database.
Код:
format(string, 60, "Kausetava\nMetals: {FFFF00}%i{ffffff} KG", FactoryInfo[1][mMineral]);
tPickup[19] = Create3DTextLabel(string,0xFFFFFFFF,-2146.3044,-261.8197,37.5156,50.0,0,0);
This is one of the few fuctions on my server that is using sql. Other values are being loaded from text files.
The problem is that the 3dTextLabel cant find FactoryInfo[1][mMineral] when the server starts and i must manually call it with a command.
Код:
SetFactoryInt(1, "mineral", FactoryInfo[1][mMineral]);
format(string, 50, "Kausetava\nMetals: {FFFF00}%i{ffffff} KG", FactoryInfo[1][mMineral]);
Update3DTextLabelText(tPickup[19], 0xffffffff, string);
Heres SetFactoryInt:
Код:
stock SetFactoryInt(idx, stolb[], znach)
{
new Query[128];
format(Query, sizeof(Query), "UPDATE "TABLE_FACTORY" SET %s = '%d' WHERE mmid = '%d' LIMIT 1", stolb, znach, idx);
return mysql_query(Query);
}
Heres what i load when the server starts
Код:
stock LoadFactory()
{
new query[2048];
new time = GetTickCount();
mysql_query("SELECT * FROM `"TABLE_FACTORY"`");
mysql_store_result();
if(mysql_num_rows() > 0)
{
for(new idx = 1; idx <= mysql_num_rows(); idx++)
{
mysql_fetch_row(query);
sscanf(query, "p<|>iiffffiiis[128]iiis[128]",
FactoryInfo[idx][mMineral],
}
sscanf(FactoryInfo[1][mMetals], "p<,>iiiii", FactoryInfo[1], FactoryInfo[2], FactoryInfo[3], FactoryInfo[4], FactoryInfo[5]);
}
mysql_free_result();
printf(" Tika ieladeta rupnica san fierro - %d pings %d (ms)", TOTALFACTORY,GetTickCount() - time);
}
There are other values loaded besides mMineral ofcourse.
:S