Сompiler Что-то с массивом.

Статус
В этой теме нельзя размещать новые ответы.

pr0dukt.ekb

Пользователь
Регистрация
9 Июн 2017
Сообщения
31
Симпатии
6
Пол
Мужской
Amx Mod X
AMXX 1.8.2
Ошибка
Код:
C++:
Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

/hlds/web/www/amxxpc/work/scripting/rc_basechanger.sma(3) : error 018: initialization data exceeds declared size
/hlds/web/www/amxxpc/work/scripting/rc_basechanger.sma(4) : error 018: initialization data exceeds declared size

2 Errors.
Could not locate output file /hlds/web/www/amxxpc/work/plugins/rc_basechanger.amx (compile failed).
Исходник
Код:
C++:
new g_File[32] =
new g_Path[24] =
Несовпадение массива, или увеличить массив? не помню)
Подскажите что нужно поправить, или увеличить
C++:
new g_File[32] =
new g_Path[24] =
- то на сколько? чтобы не критично.
В принципе компилит, но хотелось бы без ошибок.

Заранее благодарен.
 

Вложения

Vesuvius

НЕ СКРИПТЕР!!!
Команда форума
Администратор
Регистрация
8 Июн 2017
Сообщения
1.598
Симпатии
570
Пол
Мужской
pr0dukt.ekb, а че у вас компилятор 1.8.1?
 

pr0dukt.ekb

Пользователь
Регистрация
9 Июн 2017
Сообщения
31
Симпатии
6
Пол
Мужской
pr0dukt.ekb, а че у вас компилятор 1.8.1?
да видимо на старом пробовал!

Вот на 182 тоже самое:

C++:
Welcome to the AMX Mod X 1.8.2 Compiler.
Copyright (c) 1997-2013 ITB CompuPhase, AMX Mod X Team

rc_basechanger.sma(3) : error 018: initialization data exceeds declared size
rc_basechanger.sma(4) : error 018: initialization data exceeds declared size

2 Errors.
Could not locate output file rc_basechanger.amx (compile failed).
[DOUBLEPOST=1521632267][/DOUBLEPOST]Увеличиваю массивы с :
Код:
new g_File[32] =
new g_Path[24] =

==>>

new g_File[48] =
new g_Path[32] =
И ошибки сразу исчезают!

На сколько это критично? или можно так оставить?
 

Izmayl7

Пользователь
Регистрация
9 Июн 2017
Сообщения
530
Симпатии
105
Пол
Мужской
На попробуй. Не знаю всё нормально локально на 1.8.2 компилит. Без ошибок

#include <amxmodx>

new g_File[32] = "addons/rechecker/resources.ini";
new g_Path[24] = "addons/rechecker/bases";
new g_PrecFile[32];
new Array:g_Files;

public plugin_precache()
{
register_plugin("RC BaseChanger", "freesrv", "AMXX");

new gfile[32], gfile_path[64], prec_buff[34], gfile_buff[34];
new gdir = open_dir(g_Path, gfile, charsmax(gfile)), maxarr = 0;

#if AMXX_VERSION_NUM < 183
md5_file(g_File, prec_buff);
#else
hash_file(g_File, Hash_Md5, prec_buff, charsmax(prec_buff));
#endif

g_Files = ArrayCreate(32);

do
{
if(strlen(gfile) > 3)
{
formatex(gfile_path, charsmax(gfile_path), "%s/%s", g_Path,gfile);

#if AMXX_VERSION_NUM < 183
md5_file(gfile_path, gfile_buff);
#else
hash_file(gfile_path, Hash_Md5, gfile_buff, charsmax(gfile_buff));
#endif

if(equal(prec_buff, gfile_buff))
copy(g_PrecFile, charsmax(g_PrecFile), gfile);

ArrayPushString(g_Files, gfile); maxarr += 1;
}

}

while(next_file(gdir, gfile, charsmax(gfile)));
close_dir(gdir);

new listfile[128];
format(listfile, charsmax(listfile), "addons/rechecker/baselist.txt");

if(!file_exists(listfile))
{
write_file(listfile, g_PrecFile, 0);
write_file(listfile, "0", 1);
}

new i, chk, lstfile[36], chkfile[36], arrfile[32], maxlst, len;

for(i = 0 ; i < maxarr ; i++)
{
ArrayGetString(g_Files, i, arrfile, charsmax(arrfile));
formatex(chkfile, charsmax(chkfile), "@%s", arrfile);
chk = 0;

new j; maxlst = file_size(listfile, 1);
for(j = 2; j < maxlst - 1; j++)
{
read_file(listfile, j, lstfile, charsmax(lstfile), len);
if (strfind(lstfile, chkfile) != -1) chk += 1;
}

if(chk == 0)
{
format(chkfile, charsmax(chkfile), "0%s", chkfile);
write_file(listfile, chkfile, -1);
}
}

new nextfile[32], setfile[32], pos;
read_file(listfile, 0, nextfile, charsmax(nextfile), len);
read_file(listfile, 1, setfile, charsmax(setfile), len);

if(strlen(setfile) < 2)
{
if(maxlst > 3)
{
i = 0;
for(i = 0; i < maxarr; i++)
{
ArrayGetString(g_Files, i, chkfile, charsmax(chkfile));
if(strfind(nextfile, chkfile) != -1)
{
if (i == maxarr-1) pos = 0;
else pos = i + 1;
}
}
ArrayGetString(g_Files, pos, nextfile, charsmax(nextfile));
log_amx("^tПроверка ведется по базе ^"%s^"", nextfile);
}
else copy(nextfile, charsmax(nextfile), g_PrecFile);

formatex(gfile_path, charsmax(gfile_path), "%s/%s", g_Path,nextfile);
write_file(listfile, nextfile, 0);
}
else formatex(gfile_path, charsmax(gfile_path), "%s/%s", g_Path,setfile);

ArrayDestroy(g_Files);
file_copy(gfile_path, g_File);
//pause("ad");
}

stock bool:file_copy(SOURCE[], TARGET[])
{
new source = fopen(SOURCE, "rb");
new target = fopen(TARGET, "wb");

for(new buffer, eof = feof(source); !eof; !eof && fputc(target, buffer))
{
buffer = fgetc(source);
eof = feof(source);
}

fclose(source);
fclose(target);

return true;
}

//AMXXPC compile.exe
// by the AMX Mod X Dev Team

//// rc_basechanger.sma
// Header size: 532 bytes
// Code size: 3380 bytes
// Data size: 932 bytes
// Stack/heap size: 16384 bytes; estimated max. usage=484 cells (1936 bytes)
// Total requirements: 21228 bytes
// Done.
//
// Compilation Time: 0,61 sec
// ----------------------------------------

Press enter to exit ...
 

Вложения

georgeml

Скриптер
Постоялец
Регистрация
12 Сен 2017
Сообщения
595
Симпатии
314
pr0dukt.ekb,
разве это так сложно?

new g_File[32] = "addons/rechecker/dlls/resources.ini";
new g_Path[24] = "addons/rechecker/dlls/bases";
addons/rechecker/dlls/resources.ini - 35 символов, а массив задан на 32
addons/rechecker/dlls/bases - 27 символов, а массив задан на 24
Увеличивайте размер массивов
 
Статус
В этой теме нельзя размещать новые ответы.
Сверху Снизу