Loop trough a folder of files
#6

You just have to create a loop and check if a vehicle at that index matches the plate number.


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;
}
Reply


Messages In This Thread
Loop trough a folder of files - by Jstylezzz - 28.04.2012, 06:35
Re: Loop trough a folder of files - by James Coral - 28.04.2012, 07:10
Re: Loop trough a folder of files - by Jstylezzz - 28.04.2012, 07:22
Re: Loop trough a folder of files - by iPLEOMAX - 28.04.2012, 08:04
Re: Loop trough a folder of files - by Jstylezzz - 28.04.2012, 08:34
Re: Loop trough a folder of files - by iPLEOMAX - 28.04.2012, 09:44
Re: Loop trough a folder of files - by Jstylezzz - 28.04.2012, 10:01
Re: Loop trough a folder of files - by Jstylezzz - 29.04.2012, 08:31
Re: Loop trough a folder of files - by iggy1 - 29.04.2012, 08:42
Re: Loop trough a folder of files - by Jstylezzz - 29.04.2012, 08:46

Forum Jump:


Users browsing this thread: 3 Guest(s)