How to make YINI read the vehicle info.. - 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: How to make YINI read the vehicle info.. (
/showthread.php?tid=454988)
How to make YINI read the vehicle info.. -
Magic_Time - 31.07.2013
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 i =1; i < MAX_CARS; i++)
{
new file[30];
format(file, sizeof(file), "%d", i);
INI_ParseFile(file, "loadcar_%d", .bExtra = true, .extra = i);
}
forward loadcar_veh(vehicleid, name[], value[]);
public loadcar_veh(vehicleid, name[], 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.
Re: How to make YINI read the vehicle info.. -
Glad2BeHere - 31.07.2013
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
Re: How to make YINI read the vehicle info.. -
Magic_Time - 31.07.2013
FIXED. YINI is the best.