Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define MAX_VEH 100
- enum PlayercInfo
- {
- PlayerName[20],
- Car1Model,
- Float:CarX1,
- Float:CarY1,
- Float:CarZ1,
- Float:CarA1,
- Car2Model,
- Float:CarX2,
- Float:CarY2,
- Float:CarZ2,
- Float:CarA2,
- Car3Model,
- Float:CarX3,
- Float:CarY3,
- Float:CarZ3,
- Float:CarA3,
- }
- new cInfo[MAX_VEH][PlayercInfo];
- SaveVehicles()
- {
- new filestring[125];
- new File: vfile = fopen("vehicles.txt", io_write);
- for(new vehicleid = 1;vehicleid<MAX_VEH;vehicleid++)
- {
- if(cInfo[vehicleid][Car1Model] != 0)
- {
- format(filestring, sizeof(filestring), "%i,%f\n", // ... continue
- cInfo[vehicleid][Car1Model],
- cInfo[vehicleid][CarX1] // float
- );
- fwrite(vfile, filestring);
- }
- }
- fclose(vfile);
- }
- LoadVehicles()
- {
- if(fexist("vehicles.txt"))
- {
- new string[125];
- new SplitDiv[40][32];
- new filestring[275];
- new File: file = fopen(VEHICLE_FILE_, io_read);
- if (file)
- {
- for(new vehicleid = 1;vehicleid<MAX_VEH;vehicleid++)
- {
- fread(file, filestring);
- split(filestring, SplitDiv, ',');
- cInfo[vehicleid][Car1Model] = strval(SplitDiv[0]);
- cInfo[vehicleid][CarX1] = floatstr(SplitDiv[1]);
- }
- }
- fclose(file);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement