03.02.2011, 17:39
Buenas, tengo un problema que no se como soluccionarlo...
Hace unos meses, compre un sistema de coches, y ahora perdi el cars.cfg y no se como poner una linea, ya que cambiaba la manera de ponerla, aqui les dejo el codigo a ver si me podrian ayudar.
Hace unos meses, compre un sistema de coches, y ahora perdi el cars.cfg y no se como poner una linea, ya que cambiaba la manera de ponerla, aqui les dejo el codigo a ver si me podrian ayudar.
pawn Код:
public LoadCars()
{
new arrCoords[30][64];
new strFromFile[MAX_STRING];
new File:file = fopen("cars.cfg", io_read);
if(file)
{
new count = 0;
while(fread(file, strFromFile))
{
split(strFromFile, arrCoords, '|');
new vehicleid;
if(floatstr(arrCoords[7]) != 0.0 && floatstr(arrCoords[8]) != 0.0 && floatstr(arrCoords[9]) != 0.0)
{
vehicleid = CreateVehicle(strval(arrCoords[2]), floatstr(arrCoords[7]), floatstr(arrCoords[8]), floatstr(arrCoords[9]), floatstr(arrCoords[10]), strval(arrCoords[11]), strval(arrCoords[12]), 999999);
}else{
vehicleid = CreateVehicle(strval(arrCoords[2]), floatstr(arrCoords[3]), floatstr(arrCoords[4]), floatstr(arrCoords[5]), floatstr(arrCoords[6]), strval(arrCoords[11]), strval(arrCoords[12]), 999999);
}
CarInfo[vehicleid][cOwned] = strval(arrCoords[0]);
strmid(CarInfo[vehicleid][cOwner], arrCoords[1], 0, strlen(arrCoords[1]), 255);
CarInfo[vehicleid][cModel] = strval(arrCoords[2]);
CarInfo[vehicleid][cSpawnX] = floatstr(arrCoords[3]);
CarInfo[vehicleid][cSpawnY] = floatstr(arrCoords[4]);
CarInfo[vehicleid][cSpawnZ] = floatstr(arrCoords[5]);
CarInfo[vehicleid][cSpawnA] = floatstr(arrCoords[6]);
if(floatstr(arrCoords[7]) != 0.0 && floatstr(arrCoords[8]) != 0.0 && floatstr(arrCoords[9]) != 0.0)
{
CarInfo[vehicleid][cParkX] = floatstr(arrCoords[3]);
CarInfo[vehicleid][cParkY] = floatstr(arrCoords[4]);
CarInfo[vehicleid][cParkZ] = floatstr(arrCoords[5]);
CarInfo[vehicleid][cParkA] = floatstr(arrCoords[6]);
}else{
CarInfo[vehicleid][cParkX] = floatstr(arrCoords[7]);
CarInfo[vehicleid][cParkY] = floatstr(arrCoords[8]);
CarInfo[vehicleid][cParkZ] = floatstr(arrCoords[9]);
CarInfo[vehicleid][cParkA] = floatstr(arrCoords[10]);
}
CarInfo[vehicleid][cColor][0] = strval(arrCoords[11]);
CarInfo[vehicleid][cColor][1] = strval(arrCoords[12]);
CarInfo[vehicleid][cLock] = strval(arrCoords[13]);
CarInfo[vehicleid][cComponent][0] = strval(arrCoords[14]);
CarInfo[vehicleid][cComponent][1] = strval(arrCoords[15]);
CarInfo[vehicleid][cComponent][2] = strval(arrCoords[16]);
CarInfo[vehicleid][cComponent][3] = strval(arrCoords[17]);
CarInfo[vehicleid][cComponent][4] = strval(arrCoords[18]);
CarInfo[vehicleid][cComponent][5] = strval(arrCoords[19]);
CarInfo[vehicleid][cComponent][6] = strval(arrCoords[20]);
CarInfo[vehicleid][cComponent][7] = strval(arrCoords[21]);
CarInfo[vehicleid][cComponent][8] = strval(arrCoords[22]);
CarInfo[vehicleid][cComponent][9] = strval(arrCoords[23]);
CarInfo[vehicleid][cComponent][10] = strval(arrCoords[24]);
CarInfo[vehicleid][cComponent][11] = strval(arrCoords[25]);
CarInfo[vehicleid][cComponent][12] = strval(arrCoords[26]);
CarInfo[vehicleid][cComponent][13] = strval(arrCoords[27]);
CarInfo[vehicleid][cMatricula] = strval(arrCoords[28]);
CarInfo[vehicleid][cTime] = strval(arrCoords[29]);
CarInfo[vehicleid][cValid] = 1;
CarInfo[vehicleid][cParked] = 0;
if(CarInfo[vehicleid][cLock] && CarInfo[vehicleid][cOwned])
{
LockCar(vehicleid);
}else{
UnLockCar(vehicleid);
}
if(CarInfo[vehicleid][cMatricula] == 0)
{
CarInfo[vehicleid][cMatricula] = GenerarMatricula();
}
if(!CarInfo[vehicleid][cOwned])
{
CarInfo[vehicleid][cColor][0] = random(126);
CarInfo[vehicleid][cColor][1] = random(126);
}
SetVehicleToRespawn(vehicleid);
count++;
}
printf("%d vehнculos cargados desde cars.cfg", count);
}
}