18.04.2017, 21:57
I've made a command to save tuning. It used to work quite decently, but after some changes, it stopped working altogether... Apparently, this bit causes problems.
CarPath:
The "Cars" folder is where it should be. Let me know if you need any additional info.
Код:
stock SaveTuningToFile(playerid) {
new INI:CarFile = INI_Open(CarPath(playerid));
INI_SetTag(CarFile,"data");
INI_WriteInt(CarFile,"Spoiler",PrivCarInfo[playerid][cspoiler]);
INI_WriteInt(CarFile,"Fbumper",PrivCarInfo[playerid][cfbumper]);
INI_WriteInt(CarFile,"Rbumper",PrivCarInfo[playerid][crbumper]);
INI_WriteInt(CarFile,"Exhaust",PrivCarInfo[playerid][cexhaust]);
INI_WriteInt(CarFile,"Bventr",PrivCarInfo[playerid][cbventr]);
INI_WriteInt(CarFile,"Bventl",PrivCarInfo[playerid][cbventl]);
INI_WriteInt(CarFile,"Bscoop",PrivCarInfo[playerid][cbscoop]);
INI_WriteInt(CarFile,"Rscoop",PrivCarInfo[playerid][crscoop]);
INI_WriteInt(CarFile,"Lskirt",PrivCarInfo[playerid][clskirt]);
INI_WriteInt(CarFile,"Rskirt",PrivCarInfo[playerid][crskirt]);
INI_WriteInt(CarFile,"Hydraulics",PrivCarInfo[playerid][chydraulics]);
INI_WriteInt(CarFile,"Bass",PrivCarInfo[playerid][cbass]);
INI_WriteInt(CarFile,"Rbbars",PrivCarInfo[playerid][crbbars]);
INI_WriteInt(CarFile,"Fbbars",PrivCarInfo[playerid][cfbbars]);
INI_WriteInt(CarFile,"Wheels",PrivCarInfo[playerid][cwheels]);
INI_WriteInt(CarFile,"Lights",PrivCarInfo[playerid][clights]);
INI_WriteInt(CarFile,"Paintjob",PrivCarInfo[playerid][cpaintjob]);
INI_WriteInt(CarFile,"CarColor1",PrivCarInfo[playerid][cColor1]);
INI_WriteInt(CarFile,"CarColor2",PrivCarInfo[playerid][cColor2]);
INI_WriteInt(CarFile,"AirColor1",PrivCarInfo[playerid][aColor1]);
INI_WriteInt(CarFile,"AirColor2",PrivCarInfo[playerid][aColor2]);
INI_WriteInt(CarFile,"BoatColor1",PrivCarInfo[playerid][bColor1]);
INI_WriteInt(CarFile,"BoatColor2",PrivCarInfo[playerid][bColor2]);
INI_Close(CarFile);
}
Код:
#define CAR_PATH "Cars/%s.ini"
stock CarPath(playerid) {
new string[128],playername[MAX_PLAYER_NAME];
GetPlayerName(playerid,playername,sizeof(playername));
format(string,sizeof(string),CAR_PATH,playername);
return string;
}




).