29.07.2017, 15:42
(
Последний раз редактировалось Adam_Hardy; 29.07.2017 в 17:28.
)
Hello I've been wasting so much time trying to fix this issue but I just couldn't come with a solution.
Alright I've kinda made a dealership system the same as one I found on a samp topic and everything was fine the system is dynamic so I can make dealership cars using /createdscar anywhere I want to but the issue is that the stock doesn't load the file it created, when I use the SaveDealershipCars() the file gets created and it saves the cars but in the 31th line for some reason and when I try to reopen the server, it doesn't load..no errors are actually on the script.
Server log:
Alright I've kinda made a dealership system the same as one I found on a samp topic and everything was fine the system is dynamic so I can make dealership cars using /createdscar anywhere I want to but the issue is that the stock doesn't load the file it created, when I use the SaveDealershipCars() the file gets created and it saves the cars but in the 31th line for some reason and when I try to reopen the server, it doesn't load..no errors are actually on the script.
Код:
stock LoadDealershipCars() { new dcar[7][32]; new string[256], vehicle; new File:file = fopen("dealershipcars.cfg", io_read); if(file) { new i = 1; while(i < MAX_DVEHICLES) { fread(file, string); split(string, dcar, '|'); VehicleStatistics[i][vehicle_model] = strval(dcar[0]); VehicleStatistics[i][vehicle_price] = strval(dcar[1]); VehicleStatistics[i][vehicle_position][1] = floatstr(dcar[2]); VehicleStatistics[i][vehicle_position][2] = floatstr(dcar[3]); VehicleStatistics[i][vehicle_position][3] = floatstr(dcar[4]); VehicleStatistics[i][vehicle_position][4] = floatstr(dcar[5]); VehicleStatistics[i][vehicle_onsale] = strval(dcar[6]); vehicle = CreateVehicle(VehicleStatistics[i][vehicle_model], VehicleStatistics[i][vehicle_position][1], VehicleStatistics[i][vehicle_position][2], VehicleStatistics[i][vehicle_position][3], VehicleStatistics[i][vehicle_position][4], 0, 0, -1); format(string, sizeof(string), "{91D593}This Vehicle is for sale\nModel:%s\nPrice:$%d\n{FFBE63}Enter the vehicle to buy it", GetVehicleName(vehicle), VehicleStatistics[i][vehicle_price]); VehicleStatistics[i][vehicle_label] = Create3DTextLabel(string, COLOR_BDO, VehicleStatistics[i][vehicle_position][1], VehicleStatistics[i][vehicle_position][2], VehicleStatistics[i][vehicle_position][3], 10.0, 0); i++; } } print("Dealership Cars loaded successfully."); return 1; }
Код:
stock SaveDealershipCars() { new i = 1, File:file; new string[256]; while(i < MAX_DVEHICLES) { format(string, sizeof(string), "%d|%d|%f|%f|%f|%f|%d\r\n", VehicleStatistics[i][vehicle_model], VehicleStatistics[i][vehicle_price], VehicleStatistics[i][vehicle_position][1], VehicleStatistics[i][vehicle_position][2], VehicleStatistics[i][vehicle_position][3], VehicleStatistics[i][vehicle_position][4], VehicleStatistics[i][vehicle_onsale]); if(i == 1) { file = fopen("dealershipcars.cfg", io_write); } else { file = fopen("dealershipcars.cfg", io_append); } fwrite(file, string); fclose(file); i++; } print("Dealership Cars saved successfully."); }
Код:
[14:31:47] Houses loaded successfully. // Dealership Cars loaded successfully. "should appear here but it doesn't" [14:31:47] ---------------------------------- [14:31:47] | My Roleplay Server | [14:31:47] ---------------------------------- [14:31:47] | Created by Adam Hardy - Penguin | [14:31:47] ---------------------------------- [14:31:47] Number of vehicle models: 6