28.04.2012, 09:44
You just have to create a loop and check if a vehicle at that index matches the plate number.
Something like this, UNTESTED.
Something like this, UNTESTED.
pawn Код:
stock GetVehicleIDFromPlate(Plate[])
{
new vehiclefile[64], readstring[24];
for(new i = 0; i < MAX_VEHICLES; i++)
{
format(vehiclefile, sizeof vehiclefile, "/vehicles/%i.ini", i);
if(fexist(vehiclefile))
{
INI_GetString(vehiclefile, "platenumber", readstring, sizeof readstring);
//INI_GetString is just an example, use your file system library to get the string.
//vehiclefile: Path of the file, "platenumber" is the ini key, readstring is a buffer string to read
if(!strcmp(readstring, Plate, false)) return i;
}
}
return 0;
}