Guest User

Housing

a guest
Oct 30th, 2011
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. #define THREAD_LOADHOUSES 100
  2.  
  3. public OnFilterScriptInit()
  4. {
  5. //MySQL Connection
  6. MySQLConnect(MySQL_Hostname, MySQL_Username, MySQL_Database, MySQL_Password, MySQL_Connection, true);
  7.  
  8. //Load Houses
  9. mysql_query("SELECT * FROM `houses`", THREAD_LOADHOUSES, -1);
  10. return 1;
  11. }
  12.  
  13. public OnMysqlQuery(resultid, spareid, MySQL:handle)
  14. {
  15. switch(resultid)
  16. {
  17. case THREAD_LOADHOUSES:
  18. {
  19. mysql_store_result(handle);
  20. new HouseCount = 0, MySQL_Load[150];
  21. while(mysql_fetch_row(MySQL_Load, "|", handle))
  22. {
  23. new ID, Owner[24], HName[128], HPass[128], Float:X, Float:Y, Float:Z, Float:eX, Float:eY, Float:eZ, Float:eA, Doors, InteriorModel, Cost;
  24. sscanf(MySQL_Load, "p<|>ds[24]s[128]s[128]fffffffddd",
  25. ID,
  26. Owner,
  27. HName,
  28. HPass,
  29. X,
  30. Y,
  31. Z,
  32. eX,
  33. eY,
  34. eZ,
  35. eA,
  36. Doors,
  37. InteriorModel,
  38. Cost);
  39.  
  40. CreateHouse(true, ID, Owner, HName, HPass, X, Y, Z, eX, eY, eZ, eA, Doors, InteriorModel, Cost);
  41. HouseCount ++;
  42. }
  43. printf("Number of created Houses: %d", HouseCount);
  44.  
  45. mysql_free_result(handle);
  46. }
  47. }
  48. return 1;
  49. }
  50.  
Advertisement
Add Comment
Please, Sign In to add comment