Need some help. error 047
#1

Hi guys, I've got a problem on array size. I need some help, i get these errors everytime i try to compile my script.
Код:
(33527) : error 047: array sizes do not match, or destination array is too small
(33537) : error 047: array sizes do not match, or destination array is too small
(33662) : error 047: array sizes do not match, or destination array is too small
(33682) : error 047: array sizes do not match, or destination array is too small
(33689) : error 047: array sizes do not match, or destination array is too small
(33750) : error 047: array sizes do not match, or destination array is too small
pawn Код:
TBuilder=strtok(templine,idx); //(Line 33527)
TempLapper=strtok(templine,idx); //(Line 33537)
CBuilder=strtok(templine,i); //(Line 33662)
TopRacers[j]=strtok(templine,i); //(Line 33682)
TopLappers[j]=strtok(templine,i); // (Line 33689)
rracenames[rraces]=strtok(templine,idx); //(Line 33750)
This is the whole script, where 33527 and 33537 errors are coming.
pawn Код:
public LoadTimes(playerid,timemode,tmp[])
{
    new temprace[MAX_STRING], idx;
    format(temprace,sizeof(temprace),"%s.yr",tmp);
    if(strlen(tmp))
    {
        if(!fexist(temprace))
        {
            format(ystring,sizeof(ystring),"[ERROR] Race \'%s\' doesn't exist!",tmp);
            SendClientMessage(playerid,COLOR_YELLOW,ystring);
            return 1;
        }
        else
        {
            new File:f, templine[MAX_STRING], TBuilder[MAX_PLAYER_NAME], TempLapper[MAX_PLAYER_NAME], TempLap;
            idx=0;
            f = fopen(temprace, io_read);
            fread(f,templine,sizeof(templine)); // Read header-line
            if(templine[0] == 'Y') //Checking if the racefile is v0.2+
            {
                new fileversion;
                strtok(templine,idx); // read off YRACE
                fileversion = strval(strtok(templine,idx)); // read off the file version
                if(fileversion > RACEFILE_VERSION) // Check if the race is made with a newer version of the racefile format
                {
                    format(ystring,sizeof(ystring),"Race \'%s\' is created with a newer version of YRACE, unable to load.",tmp);
                    SendClientMessage(playerid,COLOR_RED,ystring);
                    return 1;
                }
                TBuilder=strtok(templine,idx); // <--- ERROR 33527
                fread(f,templine,sizeof(templine)); // read off best race times
                if(timemode ==1) fread(f,templine,sizeof(templine)); // read off best lap times
                idx=0;
                if(timemode == 0) format(ystring,sizeof(ystring),"%s by %s - Best race times:",tmp,TBuilder);
                else if(timemode == 1) format(ystring,sizeof(ystring),"%s by %s - Best laps:",tmp,TBuilder);
                else return 1;
                SendClientMessage(playerid,COLOR_GREEN,ystring);
                for(new i=0;i<5;i++)
                {
                    TempLapper=strtok(templine,idx);
                    TempLap=strval(strtok(templine,idx));
                    if(TempLap == 0)
                    {
                        format(ystring,sizeof(ystring),"%d. None yet",i+1);
                        i=6;
                    }
                    else format(ystring,sizeof(ystring),"%d. %s - %s",i+1,BeHuman(TempLap),TempLapper);
                    SendClientMessage(playerid,COLOR_GREEN,ystring);
                }
                return 1;
            }
            else
            {
                format(ystring,sizeof(ystring),"[ERROR] Race \'%s\' doesn't contain any time data.",tmp);
                SendClientMessage(playerid,COLOR_GREEN,ystring);
                return 1;
            }
        }
    }
    return 0;
}
This the script where Line 33662, 33682 and 33689 having error

pawn Код:
public LoadRace(tmp[])
{
    new race_name[32],templine[MAX_STRING];
    format(CRaceName,sizeof(CRaceName), "%s",tmp);
    format(race_name,sizeof(race_name), "%s.yr",tmp);
    if(!fexist(race_name)) return -1; // File doesn't exist
    CFile=race_name;
    LCurrentCheckpoint=-1; RLenght=0; RLenght=0;
    new File:f, i;
    f = fopen(race_name, io_read);
    fread(f,templine,sizeof(templine));
    if(templine[0] == 'Y') //Checking if the racefile is v0.2+
    {
        new fileversion;
        strtok(templine,i); // read off YRACE
        fileversion = strval(strtok(templine,i)); // read off the file version
        if(fileversion > RACEFILE_VERSION) return -2; // Check if the race is made with a newer version of the racefile format
        CBuilder=strtok(templine,i); // Line 33662
        ORacemode = strval(strtok(templine,i)); // read off racemode
        ORacelaps = strval(strtok(templine,i)); // read off amount of laps
        if(fileversion > 1)
        {
            Airrace = strval(strtok(templine,i));   // read off airrace
            CPsize = floatstr(strtok(templine,i));    // read off CP size
        }
        else // v1 file format, set to default
        {
            Airrace = 0;
            CPsize = 8.0;
        }
        OAirrace = Airrace;
        OCPsize = CPsize;
        Racemode=ORacemode; Racelaps=ORacelaps; //Allows changing the modes, but disables highscores if they've been changed.
        fread(f,templine,sizeof(templine)); // read off best race times
        i=0;
        for(new j=0;j<5;j++)
        {
            TopRacers[j]=strtok(templine,i); // Line 33682
            TopRacerTimes[j]=strval(strtok(templine,i));
        }
        fread(f,templine,sizeof(templine)); // read off best lap times
        i=0;
        for(new j=0;j<5;j++)
        {
            TopLappers[j]=strtok(templine,i); // Line 33689
            TopLapTimes[j]=strval(strtok(templine,i));
        }
    }
    else //Otherwise add the lines as checkpoints, the file is made with v0.1 (or older) version of the script.
    {
        LCurrentCheckpoint++;
        RaceCheckpoints[LCurrentCheckpoint][0] = floatstr(strtok(templine,i));
        RaceCheckpoints[LCurrentCheckpoint][1] = floatstr(strtok(templine,i));
        RaceCheckpoints[LCurrentCheckpoint][2] = floatstr(strtok(templine,i));
        Racemode=0; ORacemode=0; Racelaps=0; ORacelaps=0;   //Enables converting old files to new versions
        CPsize = 8.0; Airrace = 0;              // v2 additions
        OCPsize = CPsize; OAirrace = Airrace;   // v2 additions
        CBuilder="UNKNOWN";
        for(new j;j<5;j++)
        {
            TopLappers[j]="A"; TopLapTimes[j]=0; TopRacers[j]="A"; TopRacerTimes[j]=0;
        }
    }
    while(fread(f,templine,sizeof(templine),false))
    {
        LCurrentCheckpoint++;
        i=0;
        RaceCheckpoints[LCurrentCheckpoint][0] = floatstr(strtok(templine,i));
        RaceCheckpoints[LCurrentCheckpoint][1] = floatstr(strtok(templine,i));
        RaceCheckpoints[LCurrentCheckpoint][2] = floatstr(strtok(templine,i));
        if(LCurrentCheckpoint >= 1)
        {
            RLenght+=Distance(RaceCheckpoints[LCurrentCheckpoint][0],RaceCheckpoints[LCurrentCheckpoint][1],
                                RaceCheckpoints[LCurrentCheckpoint][2],RaceCheckpoints[LCurrentCheckpoint-1][0],
                                RaceCheckpoints[LCurrentCheckpoint-1][1],RaceCheckpoints[LCurrentCheckpoint-1][2]);
        }
    }
    LLenght = RLenght + Distance(RaceCheckpoints[LCurrentCheckpoint][0],RaceCheckpoints[LCurrentCheckpoint][1],
                                RaceCheckpoints[LCurrentCheckpoint][2],RaceCheckpoints[0][0],RaceCheckpoints[0][1],
                                RaceCheckpoints[0][2]);
    fclose(f);
    return 1;
}
This is the script where line 33750 error is coming
pawn Код:
public RaceRotation()
{
    if(!fexist("yrace.rr"))
    {
        printf("ERROR in  YRACE's Race Rotation (yrace.rr): yrace.rr doesn't exist!");
        return -1;
    }

    if(RRotation == -1)
    {
        KillTimer(RotationTimer);
        return -1; // RRotation has been disabled
    }
    if(Participants > 0) return 1; // A race is still active.

    new File:f, templine[MAX_STRING], rotfile[]="yrace.rr", rraces=-1, rracenames[32][32], idx, fback;
    f = fopen(rotfile, io_read);
    while(fread(f,templine,sizeof(templine),false))
    {
        idx = 0;
        rraces++;
        rracenames[rraces]=strtok(templine,idx); // Line 33750
    }
    fclose(f);
    RRotation++;
    if(RRotation > rraces) RRotation = 0;
    fback = LoadRace(rracenames[RRotation]);
    if(fback == -1) printf("ERROR in YRACE's Race Rotation (yrace.rr): Race \'%s\' doesn't exist!",rracenames[RRotation]);
    else if (fback == -2) printf("ERROR in YRACE's Race Rotation (yrace.rr): Race \'%s\' is created with a newer version of YRACE",rracenames[RRotation]);
    else startrace();
    return 1;
}
Reply
#2

- Bump
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)