[Help] File Functions
#2

Ok... so I made it like this
pawn Код:
public OnVehicleSpawn(vehicleid)
{
    new vpinfo[2][19];
    new vpstring[256];
    new File:file = fopen("vehplates.cfg", io_read);
    if(file)
    {
        fread(file, vpstring);
        split(vpstring, vpinfo, '|');
        vehicleid = strval(vpinfo[0]);
        format(vplate, 64, "%s", vpinfo[1]);
        SetVehicleNumberPlate(vehicleid, vplate);
    }
    return 1;
}
And that only worked for one car (the first in the file)
So I made it like this

pawn Код:
#define MAX_VPLATES 256 //top of the script

public OnVehicleSpawn(vehicleid)
{
    new vpinfo[2][19];
    new vpstring[256];
    new File:file = fopen("vehplates.cfg", io_read);
    if(file)
    {
        new vpx = 1;
        while(vpx < MAX_VPLATES)
        {
            fread(file, vpstring);
            split(vpstring, vpinfo, '|');
            vehicleid = strval(vpinfo[0]);
            format(vplate, 64, "%s", vpinfo[1]);
            SetVehicleNumberPlate(vehicleid, vplate);
        }
        vpx++;
    }
    return 1;
}
Now the server does not load. Can you tell me why?

It stays like this:


But it should be like this:
Reply


Messages In This Thread
[Help] File Functions - by Haides - 23.11.2014, 18:10
Re: [Help] File Functions - by Haides - 24.11.2014, 07:12

Forum Jump:


Users browsing this thread: 3 Guest(s)