[Help] Not fully working trunk system
#1

Hi all, i have made a working trunk system with different slots in different cars, and i'm sure to be near to make it able to be saved so all stays also after the reset, but i got problem with the savefunction:

i have made this:
pawn Code:
public SaveTrunk()
{
    for(new idx = 0;idx<MAX_VEHICLES;idx++)
    {
    new j=GetVehicleModel(idx);
        //----TRUNK X SLOTS----//
        if(j==592||j==537||j==538)
        {
            new savera[50];
            new slot21[MAX_VEHICLES];
            format(slot21, sizeof slot21, "Trunk/21/%d.ini", idx);
            fremove(slot21);
            dini_Create(slot21);
          format(savera,sizeof(savera),"wslot1");
        dini_IntSet(slot21,savera, vehTrunk21[idx][1]);
        format(savera,sizeof(savera),"aslot1");
        dini_IntSet(slot21,savera, vehTrunkAmmo21[idx][1]);
        format(savera,sizeof(savera),"wslot2");
        dini_IntSet(slot21,savera, vehTrunk21[idx][2]);
        format(savera,sizeof(savera),"aslot2");
        dini_IntSet(slot21,savera, vehTrunkAmmo21[idx][2]);
        format(savera,sizeof(savera),"wslot3");
        dini_IntSet(slot21,savera, vehTrunk21[idx][3]);
        format(savera,sizeof(savera),"aslot3");
        dini_IntSet(slot21,savera, vehTrunkAmmo21[idx][3]);
        format(savera,sizeof(savera),"wslot4");
        dini_IntSet(slot21,savera, vehTrunk21[idx][4]);
        format(savera,sizeof(savera),"aslot4");
        dini_IntSet(slot21,savera, vehTrunkAmmo21[idx][4]);
        format(savera,sizeof(savera),"wslot5");
        dini_IntSet(slot21,savera, vehTrunk21[idx][5]);
        format(savera,sizeof(savera),"aslot5");
        dini_IntSet(slot21,savera, vehTrunkAmmo21[idx][5]);
        format(savera,sizeof(savera),"wslot6");
        dini_IntSet(slot21,savera, vehTrunk21[idx][6]);
             etc...
        }
        //----TRUNK 15 SLOTS----//
    if(j==511||j==577||j==553||j==548||j==417||j==563)
        {
      new saver[50];
          new slot15[MAX_VEHICLES];
            format(slot15, sizeof slot15, "Trunk/15/%d.ini", idx);
            fremove(slot15);
            dini_Create(slot15);
          format(saver,sizeof(saver),"wslot1");
        dini_IntSet(slot15,saver, vehTrunk15[idx][1]);
        format(saver,sizeof(saver),"aslot1");
        dini_IntSet(slot15,saver, vehTrunkAmmo15[idx][1]);
        format(saver,sizeof(saver),"wslot2");
        dini_IntSet(slot15,saver, vehTrunk15[idx][2]);
        format(saver,sizeof(saver),"aslot2");
        dini_IntSet(slot15,saver, vehTrunkAmmo15[idx][2]);
        format(saver,sizeof(saver),"wslot3");
        dini_IntSet(slot15,saver, vehTrunk15[idx][3]);
        format(saver,sizeof(saver),"aslot3");
        dini_IntSet(slot15,saver, vehTrunkAmmo15[idx][3]);
        format(saver,sizeof(saver),"wslot4");
        dini_IntSet(slot15,saver, vehTrunk15[idx][4]);
        format(saver,sizeof(saver),"aslot4");
        dini_IntSet(slot15,saver, vehTrunkAmmo15[idx][4]);
        etc....
        }
        //----TRUNK 10 SLOTS----//
        if(j==520||j==425||j==499||j==482||j==498||j==609||j==455||j==414||j==582||j==413||j==440||j==459||j==508||j==406||j==423||j==428||j==519||j==456||j==573||j==416||j==433||j==431||j==437||j==427||j==477||j==544||j==484||j==453||j==454)
    {
      new saverb[50];
      new slot10[MAX_VEHICLES];
            format(slot10, sizeof slot10, "Trunk/10/%d.ini", idx);
            fremove(slot10);
            dini_Create(slot10);
          format(saverb,sizeof(saverb),"wslot1");
        dini_IntSet(slot10,saverb, vehTrunk10[idx][1]);
        format(saverb,sizeof(saverb),"aslot1");
        dini_IntSet(slot10,saverb, vehTrunkAmmo10[idx][1]);
        format(saverb,sizeof(saverb),"wslot2");
        dini_IntSet(slot10,saverb, vehTrunk10[idx][2]);
        format(saverb,sizeof(saverb),"aslot2");
        dini_IntSet(slot10,saverb, vehTrunkAmmo10[idx][2]);
        format(saverb,sizeof(saverb),"wslot3");
        dini_IntSet(slot10,saverb, vehTrunk10[idx][3]);
           etc....
        }
       
        //----TRUNK 3 SLOTS----//
      if(j==480 ||j==439 ||j==533 ||j==555 ||j==566 ||j==575 ||j==500 ||j==401 ||j==527 ||j==542 ||j==529 ||j==496 ||j==541 ||j==415 ||j==589 ||j==565 ||j==411 ||j==603 ||j==506 ||j==451 ||j==545 ||j==472 ||j==493 ||j==430 ||j==452 ||j==446 ||j==512 ||j==476 ||j==513)
        {
          new saverd[50];
          new slot3[MAX_VEHICLES];
            format(slot3, sizeof slot3, "Trunk/3/%d.ini", idx);
            fremove(slot3);
            dini_Create(slot3);
          format(saverd,sizeof(saverd),"wslot1");
        dini_IntSet(slot3,saverd, vehTrunk3[idx][1]);
        format(saverd,sizeof(saverd),"aslot1");
        same....        }
        //----TRUNK 6 SLOTS----//
        else
      {
        new saverf[50];
        new slot6[MAX_VEHICLES];
            format(slot6, sizeof slot6, "Trunk/6/%d.ini", idx);
            fremove(slot6);
            dini_Create(slot6);
          format(saverf,sizeof(saverf),"wslot1");
        dini_IntSet(slot6,saverf, vehTrunk6[idx][1]);
        format(saverf,sizeof(saverf),"aslot1");
        dini_IntSet(slot6,saverf, vehTrunkAmmo6[idx][1]);
        format(saverf,sizeof(saverf),"wslot2");
        dini_IntSet(slot6,saverf, vehTrunk6[idx][2]);
        format(saverf,sizeof(saverf),"aslot2");
        dini_IntSet(slot6,saverf, vehTrunkAmmo6[idx][2]);
        format(saverf,sizeof(saverf),"wslot3");
        dini_IntSet(slot6,saverf, vehTrunk6[idx][3]);
        format(saverf,sizeof(saverf),"aslot3");
        dini_IntSet(slot6,saverf, vehTrunkAmmo6[idx][3]);
        format(saverf,sizeof(saverf),"wslot4");
still the same.....
        }
    }
    return 1;
}
with this i got it only work if i let onlhy the 21SLOTS or only 1GROUP i think there is something wrong with the IF" i dunno if use if or else if it's some time i dont work in pawn. Thanks for who will help me
Reply
#2

i got it to work for now, but i still got one bug it only serch in the first grup, if i search in first grup then the trunk are saved but if i search in other grup then trunk don't save i hope to get it work soon
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)