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
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.
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
}
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.
every command checks if the vehicle exist and then calls the method to save it. I just used MAX_VEHICLES