Kimossab

SAVE/LOAD Plantations

Dec 22nd, 2014
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 1.01 KB | None | 0 0
  1. //save plantation data
  2. new buffer[plantareaInfo], i=1;
  3. LIST::foreach<node>(paList)
  4. {
  5.     MEM::get_arr(LIST_IT::data_ptr(node), _, buffer);
  6.     mysql_format(connection, query, sizeof(query), "UPDATE Plantations SET pX = '%f', pY = '%f', pZ = '%f', pR = '%f', pTotalPlants = '%d' WHERE pID = '%d'", buffer[CoordX], buffer[CoordY], buffer[CoordZ], buffer[radius], buffer[totalplants], i++);
  7. }
  8.  
  9. //load plantation data
  10. for(new i=0;i<cache_num_rows();i++)
  11. {
  12.     new buffer[plantareaInfo]; //not sure, but I think it is needed to start a new variable for every single one plantation, that's why this is inside the loop.
  13.     buffer[CoordX]=cache_get_field_content_float(i,"pX");
  14.     buffer[CoordY]=cache_get_field_content_float(i,"pY");
  15.     buffer[CoordZ]=cache_get_field_content_float(i,"pZ");
  16.     buffer[radius]=cache_get_field_content_float(i,"radius");
  17.     buffer[totalplants]=cache_get_field_content_int(i,"totalplants");
  18.     buffer[currentplants]=0;
  19.  
  20.     LIST::push_back_arr(paList,buffer); //puts into the list of Business this new Business
  21. }
Advertisement
Add Comment
Please, Sign In to add comment