SA-MP Forums Archive
Load Text not working on my Veh System - 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: Load Text not working on my Veh System (/showthread.php?tid=630124)



Load Text not working on my Veh System - astanalol - 09.03.2017

Hello guys
i have problem with Load Vehicles
// i just cant see any things on Text not there vehicles saves i dont know why
i need some help please?!
its working good when im destroy vehicles its back to position i buying from it.
but when im off not saving idk why and when open not there the vehicles
Quote:

#define MAX_VEH 100
#define VEHICLE_FILE_ "vehicles.txt"

PHP код:
SaveVehicles()
{
    new 
filestring[125];
    new 
Filevfile fopen("vehicles.txt"io_write);
    for(new 
vehicleid 1;vehicleid<MAX_VEH;vehicleid++)
    {
        if(
cInfo[vehicleid][Car1Model] != 0)
        {
            
format(filestringsizeof(filestring), "%i,%f\n",cInfo[vehicleid][Car1Model],cInfo[vehicleid][CarX1]);
            
fwrite(vfilefilestring);
        }
    }
    
fclose(vfile);
    return 
1;
}
LoadVehicles()
{
    if(
fexist("vehicles.txt"))
    {
        new 
SplitDiv[40][32];
        new 
filestring[275];
        new 
Filefile fopen(VEHICLE_FILE_io_read);
        if (
file)
        {
            for(new 
vehicleid 1;vehicleid<MAX_VEH;vehicleid++)
            {
                
fread(filefilestring);
                
cInfo[vehicleid][Car1Model] = strval(SplitDiv[0]);
                
cInfo[vehicleid][CarX1] = floatstr(SplitDiv[1]);
            }
        }
        
fclose(file);
    }
    return 
1;

Quote:

new cInfo[MAX_VEH][PlayercInfo];
public OnPlayerConnect(playerid)
{
LoadVehicles();
return 1;
}
public OnPlayerDisconnect(playerid, reason)
{
SaveVehicles();
return 1;
}

what is wrong please help