12.03.2015, 23:02
Okay , i have tried too many things but there is a proplem with the loading the data saves in the mysql but it doesnt load here is the codes am using
and
If somone can please fix me both by changing them to Yini or atleast help me to fix this bug it doesnt load.
Here the save codes.
PHP код:
stock LoadATMS()
{
printf("[LoadAtms] Loading data from database...");
mysql_function_query(MainPipeline, "SELECT * FROM `atms`", true, "OnLoadAtms", "");
}
PHP код:
forward OnLoadATMS();
public OnLoadATMS()
{
new i, rows, fields, tmp[128];
cache_get_data(rows, fields, MainPipeline);
while(i < rows)
{
cache_get_field_content(i, "VW", tmp, MainPipeline); ATM[i][atmVW] = strval(tmp);
cache_get_field_content(i, "Int", tmp, MainPipeline); ATM[i][atmInt] = strval(tmp);
cache_get_field_content(i, "Modelz", tmp, MainPipeline); ATM[i][atmModelz] = strval(tmp);
cache_get_field_content(i, "PosX", tmp, MainPipeline); ATM[i][atmPosX] = floatstr(tmp);
cache_get_field_content(i, "PosY", tmp, MainPipeline); ATM[i][atmPosY] = floatstr(tmp);
cache_get_field_content(i, "PosZ", tmp, MainPipeline); ATM[i][atmPosZ] = floatstr(tmp);
cache_get_field_content(i, "Angle", tmp, MainPipeline); ATM[i][atmAngle] = floatstr(tmp);
RenderATM(i);
i++;
}
if(i > 0) printf("[LoadATMS] %d atms rehashed/loaded.", i);
else printf("[LoadATMS] Failed to load any atms.");
}
Here the save codes.
PHP код:
stock SaveATM(id)
{
new string[512];
format(string, sizeof(string), "UPDATE `atms` SET \
`VW`=%d, \
`Int`=%d, \
`Modelz`=%d, \
`PosX`=%f, \
`PosY`=%f, \
`PosZ`=%f, \
`Angle`=%f WHERE `id`=%d",
ATM[id][atmVW],
ATM[id][atmInt],
ATM[id][atmModelz],
ATM[id][atmPosX],
ATM[id][atmPosY],
ATM[id][atmPosZ],
ATM[id][atmAngle],
id+1
); // Array starts from zero, MySQL starts at 1 (this is why we are adding one).
mysql_function_query(MainPipeline, string, false, "OnQueryFinish", "i", SENDDATA_THREAD);
}