Advertisement
Guest User

sss

a guest
Mar 6th, 2015
330
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #define MAX_VEH 100
  2. enum PlayercInfo
  3. {
  4. PlayerName[20],
  5. Car1Model,
  6. Float:CarX1,
  7. Float:CarY1,
  8. Float:CarZ1,
  9. Float:CarA1,
  10. Car2Model,
  11. Float:CarX2,
  12. Float:CarY2,
  13. Float:CarZ2,
  14. Float:CarA2,
  15. Car3Model,
  16. Float:CarX3,
  17. Float:CarY3,
  18. Float:CarZ3,
  19. Float:CarA3,
  20. }
  21. new cInfo[MAX_VEH][PlayercInfo];
  22.  
  23. SaveVehicles()
  24. {
  25. new filestring[125];
  26. new File: vfile = fopen("vehicles.txt", io_write);
  27. for(new vehicleid = 1;vehicleid<MAX_VEH;vehicleid++)
  28. {
  29. if(cInfo[vehicleid][Car1Model] != 0)
  30. {
  31. format(filestring, sizeof(filestring), "%i,%f\n", // ... continue
  32. cInfo[vehicleid][Car1Model],
  33. cInfo[vehicleid][CarX1] // float
  34. );
  35. fwrite(vfile, filestring);
  36. }
  37. }
  38. fclose(vfile);
  39. }
  40.  
  41. LoadVehicles()
  42. {
  43. if(fexist("vehicles.txt"))
  44. {
  45. new string[125];
  46. new SplitDiv[40][32];
  47. new filestring[275];
  48. new File: file = fopen(VEHICLE_FILE_, io_read);
  49. if (file)
  50. {
  51. for(new vehicleid = 1;vehicleid<MAX_VEH;vehicleid++)
  52. {
  53. fread(file, filestring);
  54. split(filestring, SplitDiv, ',');
  55. cInfo[vehicleid][Car1Model] = strval(SplitDiv[0]);
  56. cInfo[vehicleid][CarX1] = floatstr(SplitDiv[1]);
  57. }
  58. }
  59. fclose(file);
  60. }
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement