| Inferno | Дата: Воскресенье, 09.11.2008, 13:18 | Сообщение # 1 |
|
Хостинг-провайдер
Группа:
I'm V.I.P.
Сообщений: 1320
Награды: 26
Город: /root
Репутация: 320
Замечания: 0%
Статус: 
| Помогите)) Вот кодег, что сюда нужно добавить чтоб этой ошибки небыло?))) [pwn]public LoadRace(tmp[]) { new race_name[32],templine[512]; 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); // read off RACEBUILDER // ТУТ ОШИБКО!!! 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); 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); 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; }[/pwn] Ну естественно плюсеГи обеспечены))
|
| |
|
|
| WNeZRoS | Дата: Воскресенье, 09.11.2008, 14:13 | Сообщение # 2 |
|
Местный
Группа:
Продвинутые
Сообщений: 607
Награды: 11
Город: Где-то на Северо-Западе
Репутация: 119
Замечания: 0%
Статус: 
| какой текст ошибки и в какой строчке?
|
| |
|
|
| Inferno | Дата: Воскресенье, 09.11.2008, 16:09 | Сообщение # 3 |
|
Хостинг-провайдер
Группа:
I'm V.I.P.
Сообщений: 1320
Награды: 26
Город: /root
Репутация: 320
Замечания: 0%
Статус: 
| [pwn]CBuilder=strtok(templine,i); // read off RACEBUILDER // ТУТ ОШИБКО!!! [/pwn] ошибко: array sizes do not match, or destination array is
|
| |
|
|
| Orange | Дата: Воскресенье, 09.11.2008, 20:44 | Сообщение # 4 |
|
Уважаемый человек
Группа:
Продвинутые
Сообщений: 945
Награды: 6
Город: San Fierro
Репутация: 101
Замечания: 0%
Статус: 
| Inf1203, попробуй юзани CBuilder=strval(strtok(templine,i));
|
| |
|
|
| DarkByte | Дата: Понедельник, 10.11.2008, 06:21 | Сообщение # 5 |
|
Долгожитель
Группа:
Продвинутые
Сообщений: 1577
Награды: 7
Город: Челябинск
Репутация: 182
Замечания: 0%
Статус: 
| Quote (Inf1203) CBuilder=strtok(templine,i); // read off RACEBUILDER // ТУТ ОШИБКО!!! т.к. strtok возвращает строку не определённой длинны, то и соответственно CBuilder должно быть таким же, либо можно сделать например так: format(CBuilder,sizeof(CBuilder),"%s",strtok(templine,i));
MusicSig vkontakte - расширение функционала ВКонтакте для Google Chrome
|
| |
|
|