24.01.2017, 16:52
That's the code in general
PHP код:
//Somewhere on your code put this, more likely at the top
#define VEH_PATH "%d.ini" //The path of the file
#define MAXPVEHS 100 //The maximum private vehicles
//This Function will help set a proper name for your data storing file, it will be named according to the vehicle ID the stored data belong
VehPth(vid){
new str[3];
format(str, sizeof(str), VEH_PATH, vid);
return str;
}
//A loop that will go thought all the files and create vehicles, this should be on OnGamemodeInIt/OnFilterScriptInIt
for(i=0;i<MAX_PVEHS;i++){
INI_ParseFile(VehPth(i), "VehicleLoad", .bExtra = true, .extra = i); //This will call the loading function to extract data
CreateVehicle(vehicletype, Float:x, Float:y, Float:z, Float:rotation, color1, color2, respawn_delay, addsiren=0);
SetVehicleNumberPlate(i, VehicleInfo[i][vPlate])
//The rest is up to you
}
//Data loading function
LoadVehicles(vehid,name[],value[])
{
INI_String("Owner", VehicleInfo[vehid][vOwner], MAX_PLAYER_NAME);
INI_Int("ID",VehicleInfo[veid][vID]);
INI_String("Plate", VehicleInfo[vehid][vPlate], 10);
return 1;
}