Dynamic Vehicle
#1

Hi guys

i have this dynamic vehicle with the system

pawn Code:
public LoadCar()
{
    new arrCoords[55][64];
    new strFromFile2[256];
    new File: file = fopen("Ownership/Veh.ini", io_read);
    if(file)
    {
        new idx;
        while (idx < sizeof(CarInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            CarInfo[idx][tModel] = strvalEx(arrCoords[0]);
            CarInfo[idx][tLocationx] = floatstr(arrCoords[1]);
            CarInfo[idx][tLocationy] = floatstr(arrCoords[2]);
            CarInfo[idx][tLocationz] = floatstr(arrCoords[3]);
            CarInfo[idx][tAngle] = floatstr(arrCoords[4]);
            CarInfo[idx][tColorOne] = strvalEx(arrCoords[5]);
            CarInfo[idx][tColorTwo] = strvalEx(arrCoords[6]);
            strmid(CarInfo[idx][tOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
            CarInfo[idx][tOwned] = strvalEx(arrCoords[8]);
            CarInfo[idx][tLock] = strvalEx(arrCoords[9]);
            CarInfo[idx][tEngine] = strvalEx(arrCoords[10]);
            CarInfo[idx][tPaintjob] = strvalEx(arrCoords[11]);
            CarInfo[idx][tOwnable] = strvalEx(arrCoords[12]);
            CarInfo[idx][tFaction] = strvalEx(arrCoords[13]);
            CarInfo[idx][tVIP] = strvalEx(arrCoords[14]);
            CarInfo[idx][tAlarm] = strvalEx(arrCoords[15]);
            CarInfo[idx][tAlarmStarted] = strvalEx(arrCoords[16]);
            CarInfo[idx][tTrunkOpened] = strvalEx(arrCoords[17]);
            CarInfo[idx][tInsured] = strvalEx(arrCoords[18]);
            CarInfo[idx][tGun1] = strvalEx(arrCoords[19]);
            CarInfo[idx][tGun2] = strvalEx(arrCoords[20]);
            CarInfo[idx][tArmor] = floatstr(arrCoords[21]);
            CarInfo[idx][tCrack] = strvalEx(arrCoords[22]);
            CarInfo[idx][tPot] = strvalEx(arrCoords[23]);
            CarInfo[idx][tNOS] = strvalEx(arrCoords[24]);
            CarInfo[idx][tHoodOpened] = strvalEx(arrCoords[25]);
            CarInfo[idx][tPrice] = strvalEx(arrCoords[26]);
            strmid(CarInfo[idx][tLicensePlate], arrCoords[27], 0, strlen(arrCoords[27]), 255);
            CarInfo[idx][tDisabled] = strvalEx(arrCoords[28]);
            CarInfo[idx][tGang] = strvalEx(arrCoords[29]);
            CarInfo[idx][tJob] = strvalEx(arrCoords[29]);
            CarInfo[idx][tVehRemote] = strvalEx(arrCoords[30]);
            CarInfo[idx][tGPS] = strvalEx(arrCoords[31]);
            CarInfo[idx][tNeon] = strvalEx(arrCoords[32]);
            CarInfo[idx][tNeonON] = strvalEx(arrCoords[33]);
            CarInfo[idx][tComponent0] = strvalEx(arrCoords[34]);
            CarInfo[idx][tComponent1] = strvalEx(arrCoords[35]);
            CarInfo[idx][tComponent2] = strvalEx(arrCoords[36]);
            CarInfo[idx][tComponent3] = strvalEx(arrCoords[37]);
            CarInfo[idx][tComponent4] = strvalEx(arrCoords[38]);
            CarInfo[idx][tComponent5] = strvalEx(arrCoords[39]);
            CarInfo[idx][tComponent6] = strvalEx(arrCoords[40]);
            CarInfo[idx][tComponent7] = strvalEx(arrCoords[41]);
            CarInfo[idx][tComponent8] = strvalEx(arrCoords[42]);
            CarInfo[idx][tComponent9] = strvalEx(arrCoords[43]);
            CarInfo[idx][tComponent10] = strvalEx(arrCoords[44]);
            CarInfo[idx][tComponent11] = strvalEx(arrCoords[45]);
            CarInfo[idx][tComponent12] = strvalEx(arrCoords[46]);
            CarInfo[idx][tComponent13] = strvalEx(arrCoords[47]);
            CarInfo[idx][tDuplicateKeys] = strvalEx(arrCoords[48]);
            CarInfo[idx][tTowServices] = strvalEx(arrCoords[49]);
            CarInfo[idx][tImp] = strvalEx(arrCoords[50]);
            CarInfo[idx][tImpPrice] = strvalEx(arrCoords[51]);
            CarInfo[idx][tRentable] = strvalEx(arrCoords[52]);
            CarInfo[idx][Neon] = strvalEx(arrCoords[53]);
            CarInfo[idx][NeonObject] = strvalEx(arrCoords[54]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}

public SaveCar()
{

    new File: file2;
    new idx;
    while (idx < sizeof(CarInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%f|%d|%d|%d|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
        CarInfo[idx][tModel],
        CarInfo[idx][tLocationx],
        CarInfo[idx][tLocationy],
        CarInfo[idx][tLocationz],
        CarInfo[idx][tAngle],
        CarInfo[idx][tColorOne],
        CarInfo[idx][tColorTwo],
        CarInfo[idx][tOwner],
        CarInfo[idx][tOwned],
        CarInfo[idx][tLock],
        CarInfo[idx][tEngine],
        CarInfo[idx][tPaintjob],
        CarInfo[idx][tOwnable],
        CarInfo[idx][tFaction],
        CarInfo[idx][tVIP],
        CarInfo[idx][tAlarm],
        CarInfo[idx][tAlarmStarted],
        CarInfo[idx][tTrunkOpened],
        CarInfo[idx][tInsured],
        CarInfo[idx][tGun1],
        CarInfo[idx][tGun2],
        CarInfo[idx][tArmor],
        CarInfo[idx][tCrack],
        CarInfo[idx][tPot],
        CarInfo[idx][tNOS],
        CarInfo[idx][tHoodOpened],
        CarInfo[idx][tPrice],
        CarInfo[idx][tLicensePlate],
        CarInfo[idx][tDisabled],
        CarInfo[idx][tGang],
        CarInfo[idx][tJob],
        CarInfo[idx][tVehRemote],
        CarInfo[idx][tGPS],
        CarInfo[idx][tNeon],
        CarInfo[idx][tNeonON],
        CarInfo[idx][tComponent0],
        CarInfo[idx][tComponent1],
        CarInfo[idx][tComponent2],
        CarInfo[idx][tComponent3],
        CarInfo[idx][tComponent4],
        CarInfo[idx][tComponent5],
        CarInfo[idx][tComponent6],
        CarInfo[idx][tComponent7],
        CarInfo[idx][tComponent8],
        CarInfo[idx][tComponent9],
        CarInfo[idx][tComponent10],
        CarInfo[idx][tComponent11],
        CarInfo[idx][tComponent12],
        CarInfo[idx][tComponent13],
        CarInfo[idx][tDuplicateKeys],
        CarInfo[idx][tTowServices],
        CarInfo[idx][tImp],
        CarInfo[idx][tImpPrice],
        CarInfo[idx][tRentable],
        CarInfo[idx][Neon],
        CarInfo[idx][NeonObject]);
        if(idx == 0)
        {
            file2 = fopen("Ownership/Veh.ini", io_write);
        }
        else
        {
            file2 = fopen("Ownership/Veh.ini", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}

but i want change it to every car is save alone

Like Ownership/car_%d.ini ID
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)