05.11.2011, 18:40
pawn Код:
public LoadCar()
{
new arrCoords[13][64];
new strFromFile2[256];
new File: file = fopen("SRPC/cars.cfg", io_read);
if (file)
{
new idx = 0;
while (idx < sizeof(CarInfo))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
CarInfo[idx][cModel] = strval(arrCoords[0]);
CarInfo[idx][cLocationx] = floatstr(arrCoords[1]);
CarInfo[idx][cLocationy] = floatstr(arrCoords[2]);
CarInfo[idx][cLocationz] = floatstr(arrCoords[3]);
CarInfo[idx][cAngle] = floatstr(arrCoords[4]);
CarInfo[idx][cColorOne] = strval(arrCoords[5]);
CarInfo[idx][cColorTwo] = strval(arrCoords[6]);
strmid(CarInfo[idx][cOwner], arrCoords[7], 0, strlen(arrCoords[7]), 255);
strmid(CarInfo[idx][cDescription], arrCoords[8], 0, strlen(arrCoords[8]), 255);
CarInfo[idx][cValue] = strval(arrCoords[9]);
CarInfo[idx][cLicense] = strval(arrCoords[10]);
CarInfo[idx][cOwned] = strval(arrCoords[11]);
CarInfo[idx][cLock] = strval(arrCoords[12]);
printf("CarInfo: %d Owner:%s LicensePlate %s",idx,CarInfo[idx][cOwner],CarInfo[idx][cLicense]);
idx++;
if(CarInfo[idx][cOwned] == 0)
{
new vehicle_id, Text3D:vehicle3Dtext, labol;
//Creating TextLabel
format(labol, 300, "Car Name: %s\nCar Price: %d\nColor 1: %d Color 2: %d\nTo buy, go in the car and type /buycar", CarInfo[idx][cDescription], CarInfo[idx][cValue], CarInfo[idx][cColorOne], CarInfo[idx][cColorTwo]);
vehicle3Dtext = Create3DTextLabel(labol, COLOR_RED, 0.0, 0.0, 0.0, 50.0, 0, 1 );
//Attaching Text Label To Vehicle
Attach3DTextLabelToVehicle(vehicle3Dtext, idx, 0.0, 0.0, 2.0);
}
}
}
return 1;
}
pawn Код:
format(labol, 300, "Car Name: %s\nCar Price: %d\nColor 1: %d Color 2: %d\nTo buy, go in the car and type /buycar", CarInfo[idx][cDescription], CarInfo[idx][cValue], CarInfo[idx][cColorOne], CarInfo[idx][cColorTwo]);
vehicle3Dtext = Create3DTextLabel(labol, COLOR_RED, 0.0, 0.0, 0.0, 50.0, 0, 1 );