New vehicules save
#1

I got some probleme with my save cars

There is my code for my save cars but it didnt save Why?
PHP код:
public SaveVeh()
{
        new 
File:VehFile fopen(FVEHICULEio_write);
        new 
stringv[256];
        for(new 
v=1;v<Sveh;v++)
        {
            if(
VInfo[v][vId] != INVALID_VEH_ID)
            {
                
format(stringvsizeof(stringv),"%d|%d|%d|%f|%f|%f|%f|%d|%d|%f|%f\r\n",
                
VInfo[v][vId],VInfo[v][vModel],VInfo[v][vMoteur],VInfo[v][vX],VInfo[v][vY],VInfo[v][vZ],VInfo[v][vA],
                
VInfo[v][vCol1],VInfo[v][vCol2],VInfo[v][vMessence],VInfo[v][vEssence]
                );
                
fwrite(VehFilestringv);
                
printf("-------Vehicule %s Sauvegarder-------"v);
            }
        }
        
fclose(VehFile);
        return 
1;

Sorry for my English.
Reply
#2

I rather use dini or y_ini.
Reply
#3

I found something to help me but the Id for count the vehicles is the Same = 1

PHP код:
stock SaveVeh()
{
    new 
idx 1File:file;
    new 
stringv[256];
    while(
idx MAX_VEHICULES)
    {
        
format(stringvsizeof(stringv),"%d|%d|%d|%f|%f|%f|%f|%d|%d|%f|%f\r\n",
        
VInfo[idx][vId],
        
VInfo[idx][vModel],
        
VInfo[idx][vMoteur],
        
VInfo[idx][vX],
        
VInfo[idx][vY],
        
VInfo[idx][vZ],
        
VInfo[idx][vA],
        
VInfo[idx][vCol1],
        
VInfo[idx][vCol2],
        
VInfo[idx][vMessence],
        
VInfo[idx][vEssence]);
        if(
idx == 1)
        {
            
file fopen("vehicules.cfg"io_write);
        }
        else
        {
            
file fopen("vehicules.cfg"io_append);
        }
        
fwrite(filestringv);
        
fclose(file);
        
idx++;
    }
    print(
"Vehicules sauvegarder correctement.");
    return 
1;

In my vehicules.cfg
1|568|0|159.164733|1191.708618|14.953808|163.54959 1|-1|-1|100.000000|13.259981
1|568|0|-161.715179|1083.066772|19.548107|312.414306|-1|-1|100.000000|14.919998
1|0|0|0.000000|0.000000|0.000000|0.000000|-1|-1|100.000000|14.919998

EDIT : I check up for this part "|-1|-1|100.000000|14.919998" and i solve them don't woory about it
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)