stock SavePrivVeh(iVehicleID) { new iStr[15]; format(iStr, sizeof(iStr), "Avta/%d.ini", iVehicleID); if(INI_Open(iStr)) { INI_WriteInt("Model", vInfo[iVehicleID][vModel]); INI_WriteInt("Color1", vInfo[iVehicleID][vColor1]); INI_WriteInt("Color2", vInfo[iVehicleID][vColor2]); INI_WriteInt("Price", vInfo[iVehicleID][vPrice]); INI_WriteString("Owner", vInfo[iVehicleID][vOwner]); INI_WriteFloat("vPosX", vInfo[iVehicleID][vPosX]); INI_WriteFloat("vPosY", vInfo[iVehicleID][vPosY]); INI_WriteFloat("vPosZ", vInfo[iVehicleID][vPosZ]); INI_WriteFloat("vPosA", vInfo[iVehicleID][vPosA]); INI_WriteString("Plate", vInfo[iVehicleID][vPlate]); INI_WriteInt("PaintJ", vInfo[iVehicleID][vPaintJ]); // Mod loading INI_WriteInt("vMod1", vMods[iVehicleID][0]); INI_WriteInt("vMod2", vMods[iVehicleID][1]); INI_WriteInt("vMod3", vMods[iVehicleID][2]); INI_WriteInt("vMod4", vMods[iVehicleID][3]); INI_WriteInt("vMod5", vMods[iVehicleID][4]); INI_WriteInt("vMod6", vMods[iVehicleID][5]); INI_WriteInt("vMod7", vMods[iVehicleID][6]); INI_WriteInt("vMod8", vMods[iVehicleID][7]); INI_WriteInt("vMod9", vMods[iVehicleID][8]); INI_WriteInt("vMod10", vMods[iVehicleID][9]); INI_WriteInt("vMod11", vMods[iVehicleID][10]); INI_WriteInt("vMod12", vMods[iVehicleID][11]); INI_WriteInt("Locked", vInfo[iVehicleID][vLocked]); INI_Save(); INI_Close(); } return 1; } stock LoadPVehicles() { for(new i = 0; i < MAX_BUYABLE_VEH; ++i) { new vFile[15]; format(vFile, sizeof(vFile), "Avta/%d.ini", i); if(INI_Exist(vFile)) { INI_Open(vFile); print("\n========================================= ====================\n"); vInfo[i][vModel] = INI_ReadInt("Model"); printf("Model:\t\t%i", vInfo[i][vModel]); vInfo[i][vColor1] = INI_ReadInt("Color1"); printf("Color 1:\t%i", vInfo[i][vColor1]); vInfo[i][vColor2] = INI_ReadInt("Color2"); printf("Color 2:\t%i", vInfo[i][vColor2]); vInfo[i][vPrice] = INI_ReadInt("Price"); printf("Price:\t\t$%i", vInfo[i][vPrice]); INI_ReadString(vInfo[i][vOwner], "Owner", 24); printf("Owner:\t\t%s", vInfo[i][vOwner]); vInfo[i][vPosX] = INI_ReadFloat("vPosX"); printf("Spawn X:\t%f", vInfo[i][vPosX]); vInfo[i][vPosY] = INI_ReadFloat("vPosY"); printf("Spawn Y:\t%f", vInfo[i][vPosY]); vInfo[i][vPosZ] = INI_ReadFloat("vPosZ"); printf("Spawn Z:\t%f", vInfo[i][vPosZ]); vInfo[i][vPosA] = INI_ReadFloat("vPosA"); printf("Spawn A:\t%f", vInfo[i][vPosA]); INI_ReadString(vInfo[i][vPlate], "Plate", 32); printf("Plate:\t\t%s", vInfo[i][vPlate]); vInfo[i][vPaintJ] = INI_ReadInt("PaintJ"); printf("PaintJ:\t\t%i", vInfo[i][vPaintJ]); vInfo[i][vLocked] = INI_ReadInt("Locked"); printf("Locked:\t\t%i", vInfo[i][vLocked]); vMods[i][0] = INI_ReadInt("vMod1"); printf("Mod 1:\t\t%i", vMods[i][0]); vMods[i][1] = INI_ReadInt("vMod2"); printf("Mod 2:\t\t%i", vMods[i][1]); vMods[i][2] = INI_ReadInt("vMod3"); printf("Mod 3:\t\t%i", vMods[i][2]); vMods[i][3] = INI_ReadInt("vMod4"); printf("Mod 4:\t\t%i", vMods[i][3]); vMods[i][4] = INI_ReadInt("vMod5"); printf("Mod 5:\t\t%i", vMods[i][4]); vMods[i][5] = INI_ReadInt("vMod6"); printf("Mod 6:\t\t%i", vMods[i][5]); vMods[i][6] = INI_ReadInt("vMod7"); printf("Mod 7:\t\t%i", vMods[i][6]); vMods[i][7] = INI_ReadInt("vMod8"); printf("Mod 8:\t\t%i", vMods[i][7]); vMods[i][8] = INI_ReadInt("vMod9"); printf("Mod 9:\t\t%i", vMods[i][8]); vMods[i][9] = INI_ReadInt("vMod10"); printf("Mod 10:\t\t%i", vMods[i][9]); vMods[i][10] = INI_ReadInt("vMod11"); printf("Mod 11:\t\t%i", vMods[i][10]); vMods[i][11] = INI_ReadInt("vMod12"); printf("Mod 12:\t\t%i", vMods[i][11]); print("\n========================================= ====================\n"); new vCarID = CreateVehicle(vInfo[i][vModel], vInfo[i][vPosX], vInfo[i][vPosY], vInfo[i][vPosZ], vInfo[i][vPosA], vInfo[i][vColor1], vInfo[i][vColor2], 500000); SetVehicleNumberPlate(vCarID, vInfo[i][vPlate]); ChangeVehiclePaintjob(vCarID, vInfo[i][vPaintJ]); for(new iMod = 0; iMod < MAX_VEH_MODS; ++iMod) { if(vMods[vCarID][iMod] > 0) { AddVehicleComponent(vCarID, vMods[vCarID][iMod]); } } OwnedVeh(vCarID) = i; ++ Total_Veh_Created; INI_Close(); } } printf("** A total of: \"%i\" vehicle(s) were loaded!", Total_Veh_Created); print("\n========================================= ===================="); print("Dynamic Vehicle Ownership By: [U]214 - .INI Version Loaded..."); print("=========================================== ==================\n"); return 1; } |