How to make YINI read the vehicle info..
#1

Hello,
I'm trying to make YINI read the vehicle information, the file is already created but it isn't reading the file.

PHP код:
for(new =1MAX_CARSi++)
    {
        new 
file[30];
        
format(filesizeof(file), "%d"i);
        
INI_ParseFile(file"loadcar_%d", .bExtra true, .extra i);
    }
forward loadcar_veh(vehicleidname[], value[]);
public 
loadcar_veh(vehicleidname[], value[])
{
    
INI_String("Owner"VehicleInfo[vehicleid][Owner], 24);
    
INI_Int("Model"VehicleInfo[vehicleid][Model]);
    
INI_Float("PosX",VehicleInfo[vehicleid][PosX]);
    
INI_Float("PosY",VehicleInfo[vehicleid][PosY]);
    
INI_Float("PosZ"VehicleInfo[vehicleid][PosZ]);
    return 
1;

Sorry for my bad english and ignorance.
Reply
#2

under gamemode init u need to put "LoadCars();"
pawn Код:
#define MAX_CARS 500 // Max amount of cars u want to work with with

forward LoadCars();
public LoadCars()
{
   for(new v=0; v < MAX_CARS;v++)
   {
     if(fexist(CarPath(v)))
     {
        INI_ParseFile(CarPath(v), "LoadCar_%s", .bExtra = true, .extra = v);
        CreateVehicle(VehicleInfo[v][Model], VehicleInfo[v][PosX], VehicleInfo[v][PosY], VehicleInfo[v][PosZ], 0, -1, -1,-1);
     
     }
   }
   return 1;
}

// Here is a proper path
// Create a folder called Cars
stock CarPath(vid)
{
   new string[256];
   format(string, sizeof(string), "/Cars/%d.ini", vid);
   return string;
}
https://sampwiki.blast.hk/wiki/CreateVehicle
Reply
#3

FIXED. YINI is the best.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)