28.04.2012, 23:24
It depends, if you save your vehicles as IDs (Vehicle_1.ini, and so on; that's what I recommend) and not by owner (it will limit you to owning only 1 vehicle), this code should be easy for you to understand.
You really do not require any loops but this:
It is practical. It is more organized than one file with the owner name, and all the data for all the vehicles inside it.
Otherwise, if you save all the cars in one single file, check this:
Modify it as you require.
You really do not require any loops but this:
pawn Код:
stock DeleteOwnedVehicle( key )
{
new file_path[32];
format( file_path, 32, "Vehicle_%d.ini", key ); // this is an example
fremove( file_path );
vehicleinfo[key][owned] = 0; // if your vehicle enum had the element 'owned' and your array 'vehicleinfo'
}
Quote:
I could do what you said above, but it wouldn't really be practical to have a file per car. I'll figure it out. I'm using sscanf, and the default file functions.
|
Otherwise, if you save all the cars in one single file, check this:
Quote:
Originally Posted by SAMP Wiki
Reading Line-by-Line
pawn Код:
|