PDA

View Full Version : [HELP ME] how to load this system?


qixerz
14/02/2014, 10:18 PM
stock SaveVehicles()//qixv
{
new str[256];
format(str, sizeof(str), "Vehicle.cfg", carid);
if(carid == 0)
{
return 1;
}
new File: cfile = fopen(str, io_write);
new filestr[256];
format(string, sizeof(string), "%d|&d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d| %d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\r\n",
vInfo[carid][vOwnerId],
vInfo[carid][vModelId],
vInfo[carid][vX],
vInfo[carid][vY],
vInfo[carid][vZ],
vInfo[carid][vF],
vInfo[carid][vSpawnX],
vInfo[carid][vSpawnY],
vInfo[carid][vSpawnZ],
vInfo[carid][vSpawnF],
vInfo[carid][vColor],
vInfo[carid][vColor],
vInfo[carid][Float:vHealth],//Car Hp
vInfo[carid][pVeh],
vInfo[carid][vMod1],
vInfo[carid][vMod2],
vInfo[carid][vMod3],
vInfo[carid][vMod4],
vInfo[carid][vMod5],
vInfo[carid][vMod6],
vInfo[carid][vMod7],
vInfo[carid][vMod8],
vInfo[carid][vMod9],
vInfo[carid][vMod10],
vInfo[carid][vMod11],
vInfo[carid][vMod12],
vInfo[carid][vMod13],
vInfo[carid][vMod14],
vInfo[carid][vMod15],
vInfo[carid][vMod16],
vInfo[carid][vMod17],
);
fwrite(cfile, filestr);
fclose(cfile);
return 1;
}

terrow
14/02/2014, 10:21 PM
I don't understand what you want ?
This is a stock , how to load this stock or ?

If you want to use this function about the saving vehicles put at OnGameModeInit
SaveVehicles();

Or if you want anything , please tell me .

qixerz
14/02/2014, 10:27 PM
i can't saved that
but how to load that?

AnthonyTimmers
15/02/2014, 12:09 AM
i can't saved that
but how to load that?

Eh, what?

Abreezy
15/02/2014, 12:24 AM
He's asking how does he use the code he posted to load vehicles. I'll post something in a bit if no one else does.

basicllsw
15/02/2014, 03:09 AM
format(str, sizeof(str), "Vehicle.cfg", carid);

what the carid ?

qixerz
16/02/2014, 03:04 PM
apologize in advance brother! my english is not good

I am looking for a way repeatedly, but could not find it.
I'm studying ML-RP gamemode. but did not find a way load / save system car, I am very grateful if anyone help me!

basicllsw
17/02/2014, 12:58 AM
look this to guide i take it from mtrp-final gm

public LoadCar()
{
new arrCoords[13][64];
new strFromFile2[256];
new File: file = fopen("cars.cfg", io_read);
if (file)
{
new idx = 158;
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++;
}
}
return 1;
}

public SaveCarCoords()
{
new idx;
new File: file2;
while (idx < sizeof(CarInfo))
{
new coordsstring[256];
format(coordsstring, sizeof(coordsstring), "%d|%f|%f|%f|%f|%d|%d\n",
CarInfo[idx][cModel],
CarInfo[idx][cLocationx],
CarInfo[idx][cLocationy],
CarInfo[idx][cLocationz],
CarInfo[idx][cAngle],
CarInfo[idx][cColorOne],
CarInfo[idx][cColorTwo]);
if(idx == 0)
{
file2 = fopen("cars.cfg", io_write);
}
else
{
file2 = fopen("cars.cfg", io_append);
}
fwrite(file2, coordsstring);
idx++;
fclose(file2);
}
return 1;
}