09.08.2011, 10:09
So I have the LoadCar() function that loads and gets linked with CarInfo, Which is this:
So looking at the LoadCar() function, I need to practically make a buycar command, I have a SaveCars() function also, which uses the vInfo enums', which get set when you buy a car...
SaveCars:
pawn Код:
enum vInfo
{
vModel,
Float:vLocationx,
Float:vLocationy,
Float:vLocationz,
Float:vAngle,
vColorOne,
vColorTwo,
vOwner[MAX_PLAYER_NAME],
vDescription[MAX_PLAYER_NAME],
vValue,
vLicense,
vRegistration,
vOwned,
vLock,
ownedvehicle,
};
new CarInfo[456][vInfo];
SaveCars:
pawn Код:
public SaveCars()
{
new idx;
new File: file2;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d,%f,%f,%f,%f,%d,%d,%s,%s,%d,%s,%d,%d\n",
CarInfo[idx][vModel],
CarInfo[idx][vLocationx],
CarInfo[idx][vLocationy],
CarInfo[idx][vLocationz],
CarInfo[idx][vAngle],
CarInfo[idx][vColorOne],
CarInfo[idx][vColorTwo],
CarInfo[idx][vOwner],
CarInfo[idx][vDescription],
CarInfo[idx][vValue],
CarInfo[idx][vLicense],
CarInfo[idx][vOwned],
CarInfo[idx][vLock]);
if(idx == 0)
{
file2 = fopen("CarOwnership.cfg", io_write);
}
else
{
file2 = fopen("CarOwnership.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}

