SA-MP Forums Archive
Saving Vehicles Help. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Saving Vehicles Help. (/showthread.php?tid=630162)



Never Mind Removed - astanalol - 10.03.2017

Never Mind Removed


Re: Saving Vehicles Help. - Toroi - 10.03.2017

Add this

Код:
if(!vfile) return printf("File did not open");
Over the loop, below the opening of the file, for debugging and try to save the vehicles again.

Do you get the message in the console?


Re: Saving Vehicles Help. - astanalol - 10.03.2017

Never Mind Removed


Re: Saving Vehicles Help. - Toroi - 10.03.2017

Код:
SaveVehicles() 
{ 
    new filestring[125]; 
    new File: vfile = fopen("vehicles.txt", io_write); 
    if(!vfile) return printf("File did not open");
    for(new vehicleid = 1;vehicleid<MAX_VEH;vehicleid++) 
    { 
        if(cInfo[vehicleid][Car1Model] != 0) 
        { 
            format(filestring, sizeof(filestring), "%i,%f\n",cInfo[vehicleid][Car1Model],cInfo[vehicleid][CarX1]); 
            fwrite(vfile, filestring); 
        } 
    } 
    fclose(vfile); 
    return 1; 
}
Paste that and try again, then check the server's console. Is the message 'File did not open' showing there?


Re: Saving Vehicles Help. - astanalol - 10.03.2017

Never Mind Removed


Re: Saving Vehicles Help. - Toroi - 10.03.2017

What's your native language?


Re: Saving Vehicles Help. - astanalol - 10.03.2017

Never Mind Removed