Cars not saving?
#2

This function works, it saves the cars, but it makes the server lagging very hard, for like 10 seconds

pawn Код:
public SaveCars()
{
    new idx;
    new File: file2;
    while (idx < sizeof(CarInfo))
    {
        new coordsstring[800];  //                   0  1  2  4  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
        format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%i,%i,%i,%i,%i,%i,%i,%i,%f,%i,%d,%i,%i,%i,%i,%i,%i,%i,%d,%d\n",
        CarInfo[idx][cModel], // 0
        CarInfo[idx][cLocationx], // 1
        CarInfo[idx][cLocationy], // 2
        CarInfo[idx][cLocationz],  // 3
        CarInfo[idx][cAngle],  //4
        CarInfo[idx][cColorOne], //5
        CarInfo[idx][cColorTwo], //6
        CarInfo[idx][cOwner], //7
        CarInfo[idx][cDescription], //8
        CarInfo[idx][cValue], //9
        CarInfo[idx][cPlate], //10
        CarInfo[idx][cOwnedCar], //11
        CarInfo[idx][cLock], //12
        CarInfo[idx][cMod][0], //13
        CarInfo[idx][cMod][1], //14
        CarInfo[idx][cMod][2], //15
        CarInfo[idx][cMod][3], //16
        CarInfo[idx][cMod][4], //17
        CarInfo[idx][cMod][5], //18
        CarInfo[idx][cMod][6], //19
        CarInfo[idx][cMod][7], //20
        CarInfo[idx][cMod][8], //21
        CarInfo[idx][cMod][9], //22
        CarInfo[idx][cDonate], //23
        CarInfo[idx][cInsure], //24
        CarInfo[idx][cTrunkWep][1], //25
        CarInfo[idx][cTrunkAmmo][1], //26
        CarInfo[idx][cTrunkWep][2], //27
        CarInfo[idx][cTrunkAmmo][2], //28
        CarInfo[idx][cTrunkWep][3], //29
        CarInfo[idx][cTrunkAmmo][3], //30
        CarInfo[idx][cTrunkWep][4], //31
        CarInfo[idx][cTrunkAmmo][4], //32
        CarInfo[idx][cTrunkArmour], //33
        CarInfo[idx][cTrunkCounter], //34
        CarInfo[idx][cAlarm], //35
        CarInfo[idx][cTrunkPot], //36
        CarInfo[idx][cTrunkCrack], //37
        CarInfo[idx][cTrunkMatsa], //38
        CarInfo[idx][cTrunkMatsb], //39
        CarInfo[idx][cTrunkMatsc], //40
        CarInfo[idx][cImpounded], //41
        CarInfo[idx][cImpoundedPrice], //42
        CarInfo[idx][cDestroys], //43
        CarInfo[idx][cInsurePrice]); //44
        if(idx == 0)
        {
            file2 = fopen("cars.cfg", io_write);
        }
        else
        {
            file2 = fopen("cars.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
}
Reply


Messages In This Thread
Cars not saving? - by MayaEU - 01.07.2016, 16:29
Re: Cars not saving? - by MayaEU - 01.07.2016, 17:28
Re: Cars not saving? - by Runn3R - 01.07.2016, 18:16
Re: Cars not saving? - by MayaEU - 01.07.2016, 19:04
Re: Cars not saving? - by Konstantinos - 01.07.2016, 19:13
Re: Cars not saving? - by MayaEU - 01.07.2016, 19:17
Re: Cars not saving? - by Konstantinos - 01.07.2016, 19:22
Re: Cars not saving? - by MayaEU - 01.07.2016, 19:31
Re: Cars not saving? - by Konstantinos - 01.07.2016, 19:39
Re: Cars not saving? - by MayaEU - 01.07.2016, 19:43

Forum Jump:


Users browsing this thread: 1 Guest(s)