20.11.2009, 15:44
Hello, I am trying to load the vehicles from the mysql db but when I use this code server crashes after running... Can anyone help please?
Код:
public GetCars() { new query[1024]; new line[1024]; format(query,sizeof(query),"SELECT * FROM vehicles_ownable"); mysql_query(query); mysql_store_result(); mysql_fetch_row(line); for(new carid = 0;carid < sizeof(CInfo);carid++) { new field[64]; mysql_fetch_row(line); mysql_get_field("Parkx", field); CInfo[carid][cParkx] = strval(field); mysql_get_field("Parky", field); CInfo[carid][cParky] = strval(field); mysql_get_field("Parkz", field); CInfo[carid][cParkz] = strval(field); mysql_get_field("Parkr", field); CInfo[carid][cParkr] = strval(field); mysql_get_field("Owner", field); strmid(CInfo[carid][cOwner], field, 0, strlen(field), 255); mysql_get_field("Col1", field); CInfo[carid][cCol1] = strval(field); mysql_get_field("Col2", field); CInfo[carid][cCol2] = strval(field); mysql_get_field("Mod", field); CInfo[carid][cMod] = strval(field); new addmess[256]; format(addmess,sizeof(addmess),"--:: Vehicle %d (%s) successfully spawned - owner: %s ::--",carid,CInfo[carid][cName],CInfo[carid][cOwner]); print(addmess); carid++; } mysql_free_result(); mysql_close(); return 1; }