Problem with saving
#1

Hello I have an issue with saving I have this Method here for quick saving This basically calls my saving method quickly instead of having to type in all that code.

Ok the main point here is the code below sometimes work and sometimes does not work as you can see I also added print statement to see where the code stops and it stops at layer1 pass3 and give me a "Sever Unknow command error"

It passes all the way threw the savecardata method since I have print statement there to so there is not really any point in showing it to you but if you want to see it I can show it to you
pawn Код:
SaveQuickCarData(carid)
{
    print("layer1 pass1");//remove
    new INI:datasave = INI_Open(carfilename);
    print("layer1 pass2");//remove
    SaveCarData(datasave,carid);
    print("layer1 pass3");//remove
    INI_Close(datasave);//Here
    print("layer1 pass4");//remove
}
Reply
#2

Most likely there's an error when running through the SaveCarData, most likely an index out of bounds or something similar, so yep, show the code.
Reply
#3

I have done this a bit different then conventionally
pawn Код:
SaveCarData(INI:datasave,carid)
{
    new str[128];
    print("layer2 pass1");//remove
    format(str,sizeof(str),"carstate[%i]",carid);
    print("layer2 pass2");//remove
    INI_WriteInt(datasave,str,carstate[carid]);
    print("layer2 pass3");//remove
    format(str,sizeof(str),"carfuel[%i]",carid);
    print("layer2 pass4");//remove
    INI_WriteFloat(datasave,str,carfuel[carid],6);
    print("layer2 pass5");//remove
    format(str,sizeof(str),"carx[%i]",carid);
    print("layer2 pass6");//remove
    INI_WriteFloat(datasave,str,carx[carid],6);
    print("layer2 pass7");//remove
    format(str,sizeof(str),"cary[%i]",carid);
    print("layer2 pass8");//remove
    INI_WriteFloat(datasave,str,cary[carid],6);
    print("layer2 pass9");//remove
    format(str,sizeof(str),"carz[%i]",carid);
    print("layer2 pass10");//remove
    INI_WriteFloat(datasave,str,carz[carid],6);
    print("layer2 pass11");//remove
    format(str,sizeof(str),"carrot[%i]",carid);
    print("layer2 pass12");//remove
    INI_WriteFloat(datasave,str,carrot[carid],6);
    print("layer2 pass13");//remove
    format(str,sizeof(str),"carcolor1[%i]",carid);
    print("layer2 pass14");//remove
    INI_WriteInt(datasave,str,carcolor1[carid]);
    print("layer2 pass15");//remove
    format(str,sizeof(str),"carcolor2[%i]",carid);
    print("layer2 pass16");//remove
    INI_WriteInt(datasave,str,carcolor2[carid]);
    print("layer2 pass17");//remove
    format(str,sizeof(str),"carcost[%i]",carid);
    print("layer2 pass18");//remove
    INI_WriteInt(datasave,str,carcost[carid]);
    print("layer2 pass19");//remove
    format(str,sizeof(str),"carmodelid[%i]",carid);
    print("layer2 pass20");//remove
    INI_WriteInt(datasave,str,carmodelid[carid]);
    print("layer2 pass21");//remove
    format(str,sizeof(str),"cardealershipid[%i]",carid);
    print("layer2 pass22");//remove
    INI_WriteInt(datasave,str,cardealershipid[carid]);
    print("layer2 pass23");//remove
    format(str,sizeof(str),"cartype[%i]",carid);
    print("layer2 pass24");//remove
    INI_WriteInt(datasave,str,cartype[carid]);
    print("layer2 pass25");//remove
    format(str,sizeof(str),"carownername[%i]",carid);
    print("layer2 pass26");//remove
    INI_WriteString(datasave,str,carownername[carid]);
    print("layer2 pass27");//remove
    format(str,sizeof(str),"carstock[%i]",carid);
    print("layer2 pass28");//remove
    INI_WriteInt(datasave,str,carstock[carid]);
    print("layer2 pass29");//remove
    format(str,sizeof(str),"carlocktype[%i]",carid);
    print("layer2 pass30");//remove
    INI_WriteInt(datasave,str,carlocktype[carid]);
    print("layer2 pass31");//remove
    format(str,sizeof(str),"carlock[%i]",carid);
    print("layer2 pass32");//remove
    INI_WriteInt(datasave,str,carlock[carid]);
    print("layer2 pass33");//remove
    for(new count;count < 14;count++)
    {
        printf("layer2 count34 = %i pass",count);//remove
        format(str,sizeof(str),"carmodslot[%i][%i]",count,carid);
        printf("layer2 count35 = %i pass",count);//remove
        INI_WriteInt(datasave,str,carmodslot[count][carid]);
        printf("layer2 count36 = %i pass",count);//remove
    }
    print("layer2 pass37");//remove
}
Log
Код:
[20:30:47] layer1 pass1
[20:30:47] layer1 pass2
[20:30:47] layer2 pass1
[20:30:47] layer2 pass2
[20:30:47] layer2 pass3
[20:30:47] layer2 pass4
[20:30:47] layer2 pass5
[20:30:47] layer2 pass6
[20:30:47] layer2 pass7
[20:30:47] layer2 pass8
[20:30:47] layer2 pass9
[20:30:47] layer2 pass10
[20:30:47] layer2 pass11
[20:30:47] layer2 pass12
[20:30:47] layer2 pass13
[20:30:47] layer2 pass14
[20:30:47] layer2 pass15
[20:30:47] layer2 pass16
[20:30:47] layer2 pass17
[20:30:47] layer2 pass18
[20:30:47] layer2 pass19
[20:30:47] layer2 pass20
[20:30:47] layer2 pass21
[20:30:47] layer2 pass22
[20:30:47] layer2 pass23
[20:30:47] layer2 pass24
[20:30:47] layer2 pass25
[20:30:47] layer2 pass26
[20:30:47] layer2 pass27
[20:30:47] layer2 pass28
[20:30:47] layer2 pass29
[20:30:47] layer2 pass30
[20:30:47] layer2 pass31
[20:30:47] layer2 pass32
[20:30:47] layer2 pass33
[20:30:47] layer2 count34 = 0 pass
[20:30:47] layer2 count35 = 0 pass
[20:30:47] layer2 count36 = 0 pass
[20:30:47] layer2 count34 = 1 pass
[20:30:47] layer2 count35 = 1 pass
[20:30:47] layer2 count36 = 1 pass
[20:30:47] layer2 count34 = 2 pass
[20:30:47] layer2 count35 = 2 pass
[20:30:47] layer2 count36 = 2 pass
[20:30:47] layer2 count34 = 3 pass
[20:30:47] layer2 count35 = 3 pass
[20:30:47] layer2 count36 = 3 pass
[20:30:47] layer2 count34 = 4 pass
[20:30:47] layer2 count35 = 4 pass
[20:30:47] layer2 count36 = 4 pass
[20:30:47] layer2 count34 = 5 pass
[20:30:47] layer2 count35 = 5 pass
[20:30:47] layer2 count36 = 5 pass
[20:30:47] layer2 count34 = 6 pass
[20:30:47] layer2 count35 = 6 pass
[20:30:47] layer2 count36 = 6 pass
[20:30:47] layer2 count34 = 7 pass
[20:30:47] layer2 count35 = 7 pass
[20:30:47] layer2 count36 = 7 pass
[20:30:47] layer2 count34 = 8 pass
[20:30:47] layer2 count35 = 8 pass
[20:30:47] layer2 count36 = 8 pass
[20:30:47] layer2 count34 = 9 pass
[20:30:47] layer2 count35 = 9 pass
[20:30:47] layer2 count36 = 9 pass
[20:30:47] layer2 count34 = 10 pass
[20:30:47] layer2 count35 = 10 pass
[20:30:47] layer2 count36 = 10 pass
[20:30:47] layer2 count34 = 11 pass
[20:30:47] layer2 count35 = 11 pass
[20:30:47] layer2 count36 = 11 pass
[20:30:47] layer2 count34 = 12 pass
[20:30:47] layer2 count35 = 12 pass
[20:30:47] layer2 count36 = 12 pass
[20:30:47] layer2 count34 = 13 pass
[20:30:47] layer2 count35 = 13 pass
[20:30:47] layer2 count36 = 13 pass
[20:30:47] layer2 pass37
[20:30:47] layer1 pass3
Reply
#4

If it sometimes works as you mentioned, the only way such function could fail is with an index out of bounds, how big are all the vehicle arrays? Maybe you're saving data of a vehicle which doesn't exist.
Reply
#5

every command checks if the vehicle exist and then calls the method to save it. I just used MAX_VEHICLES
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)