12.03.2015, 16:24
[QUOTE=Misiur;3400729]Well, if you want to manage atm's from let's say website, sql is a good choice (though it's not impossible with files, but a little inconvinient).
I've made it , it compilied with 0 warns and everything looks fine but when i restart the server i didn't see any atm and i did /gotoatm and it said
and i refreashed the mysql and the pos.. changed when i /createatm that means that its saving fine but the loading is destroyed.
Loading ..
AND onloadatms
pawn Code:
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++;
PHP Code:
if(ATM[id][atmPosX] == 0.0) {
return SendClientMessageEx(playerid, COLOR_GRAD2, "No atms found with that ID.");
Loading ..
PHP Code:
stock LoadATMS()
{
printf("[LoadAtms] Loading data from database...");
mysql_function_query(MainPipeline, "SELECT * FROM `atms`", true, "OnLoadAtms", "");
}
PHP Code:
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 houses rehashed/loaded.", i);
else printf("[LoadATMS] Failed to load any houses.");
}