CarInfo not saving the bottom line :(
#1

Hi, i have added an Insurance system to the car system, but it will not save the InsurePrice,
i hope that anyone can help me rep+

pawn Код:
enum cInfo
{
    cModel,
    Float:cLocationx,
    Float:cLocationy,
    Float:cLocationz,
    Float:cAngle,
    cColorOne,
    cColorTwo,
    cOwner[MAX_PLAYER_NAME],
    cDescription[MAX_PLAYER_NAME],
    cValue,
    cLicense,
    cRegistration,
    cOwnedCar,
    cLock,
    cMod[10],
    cDonate,
    cInsure,
    cTrunkWep[MAX_TRUNK_SLOTS],
    cTrunkAmmo[MAX_TRUNK_SLOTS],
    Float:cTrunkArmour,
    cTrunkCounter,
    cAlarm,
    cTrunkPot,
    cTrunkCrack,
    cTrunkMatsa,
    cTrunkMatsb,
    cTrunkMatsc,
    cImpounded,
    cImpoundedPrice,
    cDestroys,
    cInsurePrice,
};
pawn Код:
forward SaveCars();
public SaveCars()
{
    new idx;
    new File: file2;
    while (idx < sizeof(CarInfo))
    {
        new coordsstring[350];  // 39 40 41         1   2  3  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\n",
        CarInfo[idx][cModel],
        CarInfo[idx][cLocationx],
        CarInfo[idx][cLocationy],
        CarInfo[idx][cLocationz],
        CarInfo[idx][cAngle],
        CarInfo[idx][cColorOne],
        CarInfo[idx][cColorTwo],
        CarInfo[idx][cOwner],
        CarInfo[idx][cDescription],
        CarInfo[idx][cValue],
        CarInfo[idx][cLicense],
        CarInfo[idx][cOwnedCar],
        CarInfo[idx][cLock],
        CarInfo[idx][cMod][0],
        CarInfo[idx][cMod][1],
        CarInfo[idx][cMod][2],
        CarInfo[idx][cMod][3],
        CarInfo[idx][cMod][4],
        CarInfo[idx][cMod][5],
        CarInfo[idx][cMod][6],
        CarInfo[idx][cMod][7],
        CarInfo[idx][cMod][8],
        CarInfo[idx][cMod][9],
        CarInfo[idx][cDonate],
        CarInfo[idx][cInsure],
        CarInfo[idx][cTrunkWep][1],
        CarInfo[idx][cTrunkAmmo][1],
        CarInfo[idx][cTrunkWep][2],
        CarInfo[idx][cTrunkAmmo][2],
        CarInfo[idx][cTrunkWep][3],
        CarInfo[idx][cTrunkAmmo][3],
        CarInfo[idx][cTrunkWep][4],
        CarInfo[idx][cTrunkAmmo][4],
        CarInfo[idx][cTrunkArmour],
        CarInfo[idx][cTrunkCounter],
        CarInfo[idx][cAlarm],
        CarInfo[idx][cTrunkPot],
        CarInfo[idx][cTrunkCrack],
        CarInfo[idx][cTrunkMatsa],
        CarInfo[idx][cTrunkMatsb],
        CarInfo[idx][cTrunkMatsc],
        CarInfo[idx][cImpounded],
        CarInfo[idx][cImpoundedPrice],
        CarInfo[idx][cDestroys],
        CarInfo[idx][cInsurePrice]);
        if(idx == 0)
        {
            file2 = fopen("cars.cfg", io_write);
        }
        else
        {
            file2 = fopen("cars.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
}
pawn Код:
forward LoadCars();
public LoadCars()
{
    //new arrCoords[45][64];
    new arrCoords[45][100];
    new strFromFile2[350];
    new File: file = fopen("cars.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(CarInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, ',');
            CarInfo[idx][cModel] = strval(arrCoords[0]);
            CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
            CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
            CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
            CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
            CarInfo[idx][cColorOne] = strval(arrCoords[5]);
            CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
            strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
            strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
            CarInfo[idx][cValue] = strval(arrCoords[9]);
            CarInfo[idx][cLicense] = strval(arrCoords[10]);
            CarInfo[idx][cOwnedCar] = strval(arrCoords[11]);
            CarInfo[idx][cLock] = strval(arrCoords[12]);
            CarInfo[idx][cMod][0] = strval(arrCoords[13]);
            CarInfo[idx][cMod][1] = strval(arrCoords[14]);
            CarInfo[idx][cMod][2] = strval(arrCoords[15]);
            CarInfo[idx][cMod][3] = strval(arrCoords[16]);
            CarInfo[idx][cMod][4] = strval(arrCoords[17]);
            CarInfo[idx][cMod][5] = strval(arrCoords[18]);
            CarInfo[idx][cMod][6] = strval(arrCoords[19]);
            CarInfo[idx][cMod][7] = strval(arrCoords[20]);
            CarInfo[idx][cMod][8] = strval(arrCoords[21]);
            CarInfo[idx][cMod][9] = strval(arrCoords[22]);
            CarInfo[idx][cDonate] = strval(arrCoords[23]);
            CarInfo[idx][cInsure] = strval(arrCoords[24]);
            CarInfo[idx][cTrunkWep][1] = strval(arrCoords[25]);
            CarInfo[idx][cTrunkAmmo][1] = strval(arrCoords[26]);
            CarInfo[idx][cTrunkWep][2] = strval(arrCoords[27]);
            CarInfo[idx][cTrunkAmmo][2] = strval(arrCoords[28]);
            CarInfo[idx][cTrunkWep][3] = strval(arrCoords[29]);
            CarInfo[idx][cTrunkAmmo][3] = strval(arrCoords[30]);
            CarInfo[idx][cTrunkWep][4] = strval(arrCoords[31]);
            CarInfo[idx][cTrunkAmmo][4] = strval(arrCoords[32]);
            CarInfo[idx][cTrunkArmour] = floatstr(arrCoords[33]);
            CarInfo[idx][cTrunkCounter] = strval(arrCoords[34]);
            CarInfo[idx][cAlarm] = strval(arrCoords[35]);
            CarInfo[idx][cTrunkPot] = strval(arrCoords[36]);
            CarInfo[idx][cTrunkCrack] = strval(arrCoords[37]);
            CarInfo[idx][cTrunkMatsa] = strval(arrCoords[38]);
            CarInfo[idx][cTrunkMatsb] = strval(arrCoords[39]);
            CarInfo[idx][cTrunkMatsc] = strval(arrCoords[40]);
            CarInfo[idx][cImpounded] = strval(arrCoords[41]);
            CarInfo[idx][cImpoundedPrice] = strval(arrCoords[42]);
            CarInfo[idx][cDestroys] = strval(arrCoords[43]);
            CarInfo[idx][cInsurePrice] = strval(arrCoords[44]);
            idx++;
        }
    }
    fclose(file);
    return 1;
}
Reply
#2

I will rep+
Reply
#3

everything is in here http://www.compuphase.com/pawn/Pawn_Language_Guide.pdf
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)