Help loading and fomatting name..
#1

Well, here are the functions im using:

pawn Код:
stock LoadVehicles()
{
    new Argumento[8][100];
    new str[256];
    new ModelID, Float:X, Float:Y, Float:Z, Float:A, Color1, Color2, VehicleID;
    new File: ArquivoVeiculo = fopen(PVEH_FILE_NAME, io_read);
    if (ArquivoVeiculo)
    {
        for(new id; id<MAX_VEHICLES; id++)
        {
            fread(ArquivoVeiculo, str);
            split(str, Argumento, ',');

            ModelID     =       strval   (Argumento[0]);
            X           =       floatstr (Argumento[1]);
            Y           =       floatstr (Argumento[2]);
            Z           =       floatstr (Argumento[3]);
            A           =       floatstr (Argumento[4]);
            Color1      =       strval   (Argumento[5]);
            Color2      =       strval   (Argumento[6]);
            VehicleID   =       AddStaticVehicle(ModelID, X, Y, Z, A, Color1, Color2);
            format(VEHICLE_OWNER[VehicleID][VEHOWNER],20,Argumento[7]);
        }
        fclose(ArquivoVeiculo);
    }
    return 1;
}
^ that function works good, no problems.

Now here is the function giving problems:

pawn Код:
stock AddVehiclesFromFile(FileName[])
{
    if(!fexist(FileName)) return 0;

    new File:VehicleFile, vModel, Float:VX, Float:VY, Float:VZ, Float:VA, vTotal, Line[128], vOwner, C1, C2;

    VehicleFile = fopen(FileName, io_read);
    while(fread(VehicleFile, Line))
    {
        unformat(Line, "iffffiis[50]", vModel, VX, VY, VZ, VA, C1, C2, vOwner);
        AddStaticVehicleEx(vModel, VX, VY, VZ, VA, -1, -1, (30*60));
        format(VEHICLE_OWNER[vTotal][VEHOWNER], 30, pName(vOwner));
        vTotal++;
    }
    fclose(VehicleFile);
    return vTotal;
}
No compiling errors whatsoever, but on the first function, it will check a line from a file, and check if the name is correct as the line, but not sure how it must be on my function(bottom one).

just in case, here is the line reading from:
pawn Код:
402 -2277.204101 1007.403686 11.075104 173.957427 13 56 test
Oh, the bottom function DOES load the vehicles, but won't format the name.
Reply


Messages In This Thread
Help loading and fomatting name.. - by [L3th4l] - 15.08.2010, 01:14
Re: Help loading and fomatting name.. - by PotH3Ad - 15.08.2010, 03:41
Re: Help loading and fomatting name.. - by [L3th4l] - 15.08.2010, 21:20

Forum Jump:


Users browsing this thread: 1 Guest(s)