12.02.2015, 15:03
I have found a good atm system but i don't know how to change the saving/loading from MYSQL to DINI
the script is here http://pastebin.com/f9qSc9SZ
\
Thanks,
PHP код:
public SaveDynamicATMS()
{
new
szQuery[256],
iFixID,
time = GetTickCount(),
ATMcount;
db_query(ATMS, "DELETE FROM `ATMS`");
for(new i=0; i<MAX_ATMS; i++) {
if(AtmInfo[i][atmTaken] == 1) {
ATMcount++;
format(szQuery, sizeof(szQuery), "INSERT INTO `ATMS` (`ID`, `Taken`) VALUES (%d, 1)", iFixID);
db_query(ATMS, szQuery);
format(szQuery, sizeof(szQuery), "UPDATE `ATMS` SET \
X = %f, \
Y = %f, \
Z = %f, \
Angle = %f, \
Interior = %d, \
VirtualWorld = %d \
WHERE ID = %d",
AtmInfo[i][atmX],
AtmInfo[i][atmY],
AtmInfo[i][atmZ],
AtmInfo[i][atmAngle],
AtmInfo[i][atmInterior],
AtmInfo[i][atmVirtualWorld],
iFixID);
//printf("[debug] %s", szQuery);
db_query(ATMS, szQuery);
iFixID++;
}
}
printf("%d Dynamic ATMS saved in %dms.", ATMcount, GetTickCount()-time);
return 1;
}
public LoadDynamicATMS()
{
new
DBResult:dbresult = db_query(ATMS, "SELECT * FROM `ATMS`"),
rows = db_num_rows(dbresult),
field[20],
time = GetTickCount();
//printf("[debug] %s", szQuery);
if(!rows) {
return print("No rows were found in the ATMs table.");
}
for(new i=0; i<rows; i++) {
AtmInfo[i][atmTaken] = 1;
db_get_field_assoc(dbresult, "X", field, sizeof(field)); AtmInfo[i][atmX] = floatstr(field);
db_get_field_assoc(dbresult, "Y", field, sizeof(field)); AtmInfo[i][atmY] = floatstr(field);
db_get_field_assoc(dbresult, "Z", field, sizeof(field)); AtmInfo[i][atmZ] = floatstr(field);
db_get_field_assoc(dbresult, "Angle", field, sizeof(field)); AtmInfo[i][atmAngle] = floatstr(field);
db_get_field_assoc(dbresult, "Interior", field, sizeof(field)); AtmInfo[i][atmInterior] = strval(field);
db_get_field_assoc(dbresult, "VirtualWorld", field, sizeof(field)); AtmInfo[i][atmVirtualWorld] = strval(field);
CreateDynamicATM(i);
db_next_row(dbresult);
}
db_free_result(dbresult);
printf("%d Dynamic ATMS loaded in %dms.", rows, GetTickCount()-time);
return 1;
}
\
Thanks,