[y_ini / saving / vehicles] my problems with saving y_ini
#9

i made it onplayerconnect and disconect
but have much errors :/
PHP код:
public OnPlayerConnect(playerid)
{
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"// ... continue
                        
cInfo[vehicleid][Car1Model],
                        
cInfo[vehicleid][CarX1// float
                        
);
                        
fwrite(vfilefilestring);
                  }
                }
                
fclose(vfile);
                return 
1;
}
public 
OnPlayerDisconnect(playeridreason)
{
LoadVehicles()
{
        if(
fexist("vehicles.txt"))
        {
            new 
string[125];
        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);
                                
split(filestringSplitDiv',');
                                
cInfo[vehicleid][Car1Model] = strval(SplitDiv[0]);
                                
cInfo[vehicleid][CarX1] = floatstr(SplitDiv[1]);
                        }
                }
                
fclose(file);
                return 
1;

Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 5 Guest(s)