Hey benutze das Autohaus von Kaliber
aber wíe kann ich Farbe und Tuining speichern lassen?
Speichertart:
stock LoadVehicels(playerid)
{
new arrCoords[30][64];
new strFromFile2[256];
new string[256], name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(string, sizeof(string),"/Autohaus/%s.ini",name);
if(!fexist(string)) return 1;
new File: file = fopen(string, io_read);
if (file)
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[playerid][pX] = floatstr(arrCoords[0]);
CarInfo[playerid][pY] = floatstr(arrCoords[1]);
CarInfo[playerid][pZ] = floatstr(arrCoords[2]);
CarInfo[playerid][pA] = floatstr(arrCoords[3]);
CarInfo[playerid][pFarbe1] = strval(arrCoords[4]);
CarInfo[playerid][pFarbe2] = strval(arrCoords[5]);
CarInfo[playerid][pModel] = strval(arrCoords[6]);
CarInfo[playerid][pPreis] = strval(arrCoords[7]);
strmid(CarInfo[playerid][pOwner], name, 0, strlen(name), 255);
new str[128];
format(str, sizeof(str),"%s",name);
CarInfo[playerid][pKey] = CreateVehicle(CarInfo[playerid][pModel],CarInfo[playerid][pX],CarInfo[playerid][pY],CarInfo[playerid][pZ],CarInfo[playerid][pA],CarInfo[playerid][pFarbe1],CarInfo[playerid][pFarbe2],-1);
SetVehicleNumberPlate(CarInfo[playerid][pKey],str);
SetVehicleToRespawn(CarInfo[playerid][pKey]);
fclose(file);
}
return 1;
}
stock Umschreiben(old, neu)
{
CarInfo[neu][pX] = CarInfo[old][pX];
CarInfo[neu][pY] = CarInfo[old][pY];
CarInfo[neu][pZ] = CarInfo[old][pZ];
CarInfo[neu][pA] = CarInfo[old][pA];
CarInfo[neu][pModel] = CarInfo[old][pModel];
CarInfo[neu][pFarbe1] = CarInfo[old][pFarbe1];
CarInfo[neu][pFarbe2] = CarInfo[old][pFarbe2];
CarInfo[neu][pPreis] = CarInfo[old][pPreis];
new string[256];
format(string, sizeof(string),"%f, %f, %f, %f, %d, %d, 0, 0, %d, %d",CarInfo[neu][pX],CarInfo[neu][pY],CarInfo[neu][pZ],CarInfo[neu][pA],CarInfo[neu][pFarbe1],CarInfo[neu][pFarbe2],GetVehicleModel(GetPlayerVehicleID(neu)),CarInfo[neu][pPreis]);
SaveVehicles(string, neu);
CarInfo[old][pX] = 0;
CarInfo[old][pY] = 0;
CarInfo[old][pZ] = 0;
CarInfo[old][pA] = 0;
CarInfo[old][pModel] = 0;
CarInfo[old][pFarbe1] = 0;
CarInfo[old][pFarbe2] = 0;
CarInfo[old][pPreis] = 0;
DeleteVehicle(old);
}
stock SaveVehicles(string[],playerid)
{
new entry[256],str[256],name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
format(str, sizeof(str),"/Autohaus/%s.ini",name);
format(entry, sizeof(entry), "%s\n",string);
new File:hFile;
hFile = fopen(str, io_write);
fwrite(hFile, entry);
fclose(hFile);
}