Id ошибок amxx

error 001 expected token: «%s», but found «%s» ожидался символ: «%s», но был найден «%s» error 002 only a single statement (or expression) can follow each «case» только одно заявление (или выражение) могут следовать за «case» error 003 declaration of a local variable must appear in a compound block объявленная локальная переменная должна использоваться в этом же блоке error 004 function «%s» is not implemented функция %s не реализована error 005 function may not have arguments функция не имеет аргументов error 006 must be assigned to an array должен быть присвоен массив error 007 operator cannot be redefined оператор не может быть установлен еще раз error 008 must be a constant expression; assumed zero должно быть постоянным выражением; равным нулю error 009 invalid array size (negative or zero) неверный размер массива (отрицательный или 0) error 010 invalid function or declaration неизвестная функция или декларация error 011 invalid outside functions неверно вне функции error 012 invalid function call, not a valid address неверный вызов функции, неверный адрес error 013 no entry point (no public functions) нет точки входа (не public функция) error 014 invalid statement; not in switch неверный оператор; не в switch error 015 default case must be the last case in switch statement default должен быть последним условием в switch error 016 multiple defaults in «switch» несколько «default» в switch error 017 undefined symbol «%s» неизвестный символ «%s» error 018 initialization data exceeds declared size данные массива превышают его размер error 019 not a label: «%s» не метка «%s» error 020 invalid symbol name «%s» неверное имя символа «%s» error 021 symbol already defined: «%s» символ уже объявлен: «%s» error 022 must be lvalue (non-constant) должно быть левосторонним (нет постоянной) error 023 array assignment must be simple assignment назначение массива должно быть простым error 024 break or «continue» is out of context break или «continue» вне контекста error 025 function heading differs from prototype функция заголовка отличается от прототипа error 026 no matching «#if…» не найдено «#if…» error 027 invalid character constant недопустимый символ в постоянной error 028 invalid subscript (not an array or too many subscripts): «%s» неверный индекс (это не массив или слишком много индексов): «%s» error 029 invalid expression, assumed zero неверное выражение, нет результата error 030 compound statement not closed at the end of file составной оператор не закрыт в конце файла error 031 unknown directive неизвестная директива error 032 array index out of bounds (variable «%s») индекс массива превышен error 033 array must be indexed (variable «%s») массив должен быть проиндексирован error 034 argument does not have a default value (argument %d) аргумент не имеет начального значения (аргумент %d) error 035 argument type mismatch (argument %d) несоответствие типа аргумента (аргумент %d) error 036 empty statement пустой оператор error 037 invalid string (possibly non-terminated string) неправильная строка error 038 extra characters on line лишние символы в строке error 039 constant symbol has no size символьная константа не имеет размера error 040 duplicate «case» label (value %d) несколько раз объявлен «case» с одним тем же параметром error 041 invalid ellipsis, array size is not known размер массива неизвестен error 042 invalid combination of class specifiers недопустимое сочетание класса error 043 character constant exceeds range for packed string символьная константа превышает размер строки error 044 positional parameters must precede all named parameters позиционные параметры должны предшествовать всем именованным параметрам error 045 too many function arguments слишком много аргументов у функции error 046 unknown array size (variable «%s») неизвестный размер массива error 047 array sizes do not match, or destination array is too small размеры массива конфликтуют, либо целевой массив слишком маленький error 048 array dimensions do not match размеры массива не совпадают error 049 invalid line continuation неправильное продолжение строки error 050 invalid range неверный диапазон error 051 invalid subscript, use «[ ]» operators on major dimensions неправильный индекс, используйте «[]» error 052 multi-dimensional arrays must be fully initialized много-размерные массивы должны быть полностью определены error 053 exceeding maximum number of dimensions превышение максимального числа измерений error 054 unmatched closing brace не найдена закрывающаяся скобка error 055 start of function body without function header начало функции без заголовка error 056 arrays, local variables and function arguments cannot be public (variable «%s») массивы, локальные переменные и аргументы функции не могут быть общедоступными (переменная «% s») error 057 unfinished expression before compiler directive который недействителен. error 058 duplicate argument; same argument is passed twice дублирование аргумента; аргумент передается несколько раз error 059 function argument may not have a default value (variable «%s») аргумент не может иметь значение по-умолчанию error 060 multiple «#else» directives between «#if … #endif» несколько «#else» между «#if и #endif» error 061 #elseif directive follows an «#else» directive #else перед «#elseif» error 062 number of operands does not fit the operator Количество операторов не соотвествует оператору error 063 function result tag of operator «%s» must be «%s» Результат функции %s должен быть %s error 064 cannot change predefined operators невозможно изменить уже определенные операторы error 065 function argument may only have a single tag (argument %d) в этой функции может быть только один аргумент error 066 function argument may not be a reference argument or an array (argument «%s») аргумент функции не может быть ссылкой или массивом error 067 variable cannot be both a reference and an array (variable «%s») Переменная не может быть как массив или ссылка error 068 invalid rational number precision in #pragma неверное число в #pragma error 069 rational number format already defined формат рационального числа уже определен error 070 rational number support was not enabled рациональное число не поддерживается error 071 user-defined operator must be declared before use (function «%s») объявленный оператор должен быть перед использованием error 072 sizeof operator is invalid on «function» symbols оператор «sizeof» не может быть использован для символов функции error 073 function argument must be an array (argument «%s») аргумент %s должен быть массивом error 074 #define pattern must start with an alphabetic character #define должен начинаться с буквы error 075 input line too long (after substitutions) введенная строка слишком длинная error 076 syntax error in the expression, or invalid function call неправильный синтаксис или неправильный вызов функции error 077 malformed UTF-8 encoding, or corrupted file: %s плохая кодировка UTF-8 или плохой файл: %s error 078 \»»}»>function uses both «return» and «return <value>» \»»}»>функция использует «return» и «return <значение>» error 079 inconsistent return types (array & non-array) несовместимость типов возвращенных результатов error 080 unknown symbol, or not a constant symbol (symbol «%s») неизвестный или непостоянный символ: %s error 081 cannot take a tag as a default value for an indexed array parameter (symbol «%s») Нельзя взять значение в массив %s error 082 user-defined operators and native functions may not have states созданные функции или операторы не имеют состояния error 083 a function may only belong to a single automaton (symbol «%s») функция может принадлежать только к одной автоматизации error 084 state conflict: one of the states is already assigned to another implementation (symbol «%s») для функции %s уже определенна данная state error 085 no states are defined for function «%s» нет состояний, определенных для функции «%s» error 086 unknown automaton «%s» неизвестная автоматизация «%s» error 087 unknown state «%s» for automaton «%s» неизвестное состояние «%s» в автоматизации «%s» error 088 number of arguments does not match definitionn количество аргументов не совпадает с объявленными в функции

Автор: minimiller
Перевод и редактирование: DJ_WEST

Список ошибок:

Код: Выделить всё

/*001*/  "expected token: \"%s\", but found \"%s\"\n",
/*002*/  "only a single statement (or expression) can follow each \"case\"\n",
/*003*/  "declaration of a local variable must appear in a compound block\n",
/*004*/  "function \"%s\" is not implemented\n",
/*005*/  "function may not have arguments\n",
/*006*/  "must be assigned to an array\n",
/*007*/  "operator cannot be redefined\n",
/*008*/  "must be a constant expression; assumed zero\n",
/*009*/  "invalid array size (negative or zero)\n",
/*010*/  "invalid function or declaration\n",
/*011*/  "invalid outside functions\n",
/*012*/  "invalid function call, not a valid address\n",
/*013*/  "no entry point (no public functions)\n",
/*014*/  "invalid statement; not in switch\n",
/*015*/  "\"default\" case must be the last case in switch statement\n",
/*016*/  "multiple defaults in \"switch\"\n",
/*017*/  "undefined symbol \"%s\"\n",
/*018*/  "initialization data exceeds declared size\n",
/*019*/  "not a label: \"%s\"\n",
/*020*/  "invalid symbol name \"%s\"\n",
/*021*/  "symbol already defined: \"%s\"\n",
/*022*/  "must be lvalue (non-constant)\n",
/*023*/  "array assignment must be simple assignment\n",
/*024*/  "\"break\" or \"continue\" is out of context\n",
/*025*/  "function heading differs from prototype\n",
/*026*/  "no matching \"#if...\"\n",
/*027*/  "invalid character constant\n",
/*028*/  "invalid subscript (not an array or too many subscripts): \"%s\"\n",
/*029*/  "invalid expression, assumed zero\n",
/*030*/  "compound statement not closed at the end of file\n",
/*031*/  "unknown directive\n",
/*032*/  "array index out of bounds (variable \"%s\")\n",
/*033*/  "array must be indexed (variable \"%s\")\n",
/*034*/  "argument does not have a default value (argument %d)\n",
/*035*/  "argument type mismatch (argument %d)\n",
/*036*/  "empty statement\n",
/*037*/  "invalid string (possibly non-terminated string)\n",
/*038*/  "extra characters on line\n",
/*039*/  "constant symbol has no size\n",
/*040*/  "duplicate \"case\" label (value %d)\n",
/*041*/  "invalid ellipsis, array size is not known\n",
/*042*/  "invalid combination of class specifiers\n",
/*043*/  "character constant exceeds range for packed string\n",
/*044*/  "positional parameters must precede all named parameters\n",
/*045*/  "too many function arguments\n",
/*046*/  "unknown array size (variable \"%s\")\n",
/*047*/  "array sizes do not match, or destination array is too small\n",
/*048*/  "array dimensions do not match\n",
/*049*/  "invalid line continuation\n",
/*050*/  "invalid range\n",
/*051*/  "invalid subscript, use \"[ ]\" operators on major dimensions\n",
/*052*/  "multi-dimensional arrays must be fully initialized\n",
/*053*/  "exceeding maximum number of dimensions\n",
/*054*/  "unmatched closing brace\n",
/*055*/  "start of function body without function header\n",
/*056*/  "arrays, local variables and function arguments cannot be public (variable \"%s\")\n",
/*057*/  "unfinished expression before compiler directive\n",
/*058*/  "duplicate argument; same argument is passed twice\n",
/*059*/  "function argument may not have a default value (variable \"%s\")\n",
/*060*/  "multiple \"#else\" directives between \"#if ... #endif\"\n",
/*061*/  "\"#elseif\" directive follows an \"#else\" directive\n",
/*062*/  "number of operands does not fit the operator\n",
/*063*/  "function result tag of operator \"%s\" must be \"%s\"\n",
/*064*/  "cannot change predefined operators\n",
/*065*/  "function argument may only have a single tag (argument %d)\n",
/*066*/  "function argument may not be a reference argument or an array (argument \"%s\")\n",
/*067*/  "variable cannot be both a reference and an array (variable \"%s\")\n",
/*068*/  "invalid rational number precision in #pragma\n",
/*069*/  "rational number format already defined\n",
/*070*/  "rational number support was not enabled\n",
/*071*/  "user-defined operator must be declared before use (function \"%s\")\n",
/*072*/  "\"sizeof\" operator is invalid on \"function\" symbols\n",
/*073*/  "function argument must be an array (argument \"%s\")\n",
/*074*/  "#define pattern must start with an alphabetic character\n",
/*075*/  "input line too long (after substitutions)\n",
/*076*/  "syntax error in the expression, or invalid function call\n",
/*077*/  "malformed UTF-8 encoding, or corrupted file: %s\n",
/*078*/  "function uses both \"return\" and \"return <value>\"\n",
/*079*/  "inconsistent return types (array & non-array)\n",
/*080*/  "unknown symbol, or not a constant symbol (symbol \"%s\")\n",
/*081*/  "cannot take a tag as a default value for an indexed array parameter (symbol \"%s\")\n",
/*082*/  "user-defined operators and native functions may not have states\n",
/*083*/  "a function may only belong to a single automaton (symbol \"%s\")\n",
/*084*/  "state conflict: one of the states is already assigned to another implementation (symbol \"%s\")\n",
/*085*/  "no states are defined for function \"%s\"\n",
/*086*/  "unknown automaton \"%s\"\n",
/*087*/  "unknown state \"%s\" for automaton \"%s\"\n",
/*088*/  "number of arguments does not match definition\n"

Разбор ошибок
Рассмотрим пример нахождения и самостоятельного решения ошибок при компиляции.
Допустим у нас есть ошибка:

C:\AMXX\example.sma(107) : error 035: argument type mismatch (argument 2)

Теперь давайте попытаемся разобрать эту ошибку по частям:
1) C:\AMXX\example.sma — это директория, где находится исходник (.sma) нашего плагина.
2) (107) — это номер строки, в которой есть ошибка. Большинство современных редакторов текста имеют панель с пронумерованными строками (Notepad++, AMXX-Studio и другие).
3) error 035 — это код ошибки (список ошибок указан выше).
4) argument type mismatch — это описание ошибки с кодом, указанным до этого. В данном случае нам говорится, что «аргумент имеет неверный тип».
5) (argument 2) — это более подробное описание ошибки. В данном случае нам указывается, что ошибка во 2 аргументе.

Итого, получаем: в файле example.sma, который находится в директории C:\AMXX, в строке под номером 107 есть ошибка с кодом 035, которая означает, что аргумент 2 имеет неверный тип данных.

Решение ошибок
Теперь попытаемся исправить нашу ошибку. Идем в строку под номером 107 и видим следующий код:

Код: Выделить всё

client_print
(0, "Welcome to the server!")
 

Идем на Вы должны зарегистрироваться, чтобы видеть ссылки.

и читаем описание функции:

client_print — Sends a message to a player.

Syntax:
client_print ( index, type, const message[], … )

id is a player index from 1 to 32. If 0, the message will be sent to all players.

The type is one of three types:
print_chat — chat text
print_console — console message
print_notify — console in dev mode
print_center — center say

Смотрим синтаксис команды client_print и видим, что первый аргумент index — это номер игрока (id), который может быть от 1 до 32, если же он 0, то сообщение будет отсылаться всем игрокам на сервере. Второй аргумент type — это тип сообщения, который может быть:

print_chat — текст в чат
print_console — текст в консоль
print_notify — текст в консоль в режиме разработчика
print_center — текст по центру

Третий аргумент message — это и есть текст нашего сообщения. Теперь вернемся, к нашему, коду. Мы видим, что у нас нет второго аргумента (тип сообщения), а сразу идет текст сообщения, исправляем на:

client_print(0, print_center, «Welcome to the server!»)

Теперь компиляция прошла успешно.

Описание ошибок:
error 001: expected token: «X», but found «Y»
Ошибка означает, что не найден X, когда найден Y. Наиболее часто возникает, когда забывают поставить недостающие знаки ; { } ( ).
Пример ошибки:

Код: Выделить всё

public Function
(id)
{
    if (is_user_bot(id)
    return PLUGIN_HANDLED// код
    
    return PLUGIN_CONTINUE
}
 

error 017: undefined symbol «X»
Ошибка означает, что X — неизвестный сивол/команда/переменная/функция. Поэтому такую функцию или переменную нужно объявить перед использованием. Например, функция is_user_hacker не существует.
Пример ошибки:

Код: Выделить всё

public Function
(id)
{
    if (is_user_hacker(id))
    return PLUGIN_HANDLED// код
    
    return PLUGIN_CONTINUE
}
 

error 032: array index out of bounds (variable X)
Ошибка означает, что в мы вышли за предел размера массива X.
Пример ошибки:

Код: Выделить всё

new s_Name
[32]
s_Name[33] = "*"
 

error 033: array must be indexed (variable X)
Ошибка означает, что массив должен быть проиндексирован. Например, мы не указали размер массива при его объявлении.
Пример ошибки:

Код: Выделить всё

new s_String 
= "My string"
 

error 035: argument type mismatch (argument X)
Ошибка означает, что аргумент X имеет неверный тип данных. Например, когда вместо целочисленного аргумента передаем строку.
Пример ошибки:

Код: Выделить всё

public Function1
(id)
{
    Function2(id, "10")
}
public Function2(id, count)
{
    // код
}
 

error 040: duplicate «case» label (value X)
Ошибка означает, что имеется дубль оператора case со значением X.
Пример ошибки:

Код: Выделить всё

public Function
(id)
{
    switch(count)
    {
        case 1: count += 1
    case 2
: count += 2
    case 2
: count += 3
    
}
}
 

error 075: input line too long (after substitutions)
Ошибка означает, что указанная строка слишком длинная. Например, около 500 символов.
Пример ошибки:

Код: Выделить всё

public Function
(id)
{
    server_print("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
}
 

error 078: function uses both «return» and «return <value>»
Ошибка означает, что функция использует, как return, так и return <значение>.
Пример ошибки:

Код: Выделить всё

public Function
(id)
{
    if (is_user_alive(id))    
        return

        return PLUGIN_HANDLED

}
 

error 088: number of arguments does not match definition
Ошибка означает, что количество переданных аргументов не соответсвует количеству объявленных аргументов.
Пример ошибки:

Код: Выделить всё

public Function1
(id)
{
    Function2(id)
}
public Function2(id, count)
{
    // код
}
 

Не пишите мне в ЛС: если вам нужна помощь на бесплатной основе. Любые вопросы на форум.

Цитата

error 001: expected token: «%s», but found «%s» — пропущен символ «%s», но найден «%s»;
error 002: only a single statement (or expression) can follow each «case» — Только один оператор или выражение может
следовать после «case»;
error 003: declaration of a local variable must appear in a compound block — Локальные переменные должны быть в блоке;
error 004: function «%s» is not implemented — функция «%s» не определена;
error 005: function may not have arguments — Функция может не иметь аргументов;
error 006: must be assigned to an array — Это должно быть в массиве;
error 007: operator cannot be redefined — Оператор не может использоваться;
error 008: must be a constant expression; assumed zero — Это должно быть константой равной нулю;
error 009: invalid array size (negative or zero) — Неправильный размер массива. Отрицательное
значение или ноль;
error 010: invalid function or declaration — Неправильная функция;
error 011: invalid outside functions — Неправильный вывод функции;
error 012: invalid function call, not a valid address — Неправильный вызов функции;
error 013: no entry point (no public functions) — Не точка входа;
error 014: invalid statement; not in switch — Неверная команда;
error 015: «default» case must be the last case in switch statement — Оператор «default» должен быть последним;
error 016: multiple defaults in «switch» — Несколько операторов «default» в «switch»;
error 017: undefined symbol «%s» — неизвестный символ (неопределённая переменная) «%s»;
error 018: initialization data exceeds declared size — несовпадение данных в массиве с указанными рамками (увеличить размер массива);
error 019: not a label: %s» — %s — не строка;
error 020: invalid symbol name «%s» — ошибочное название символа (начинается с цифры, например);
error 021: symbol already defined: %s» — символ уже определён (дважды встречается new одного и того же символа);
error 022: must be lvalue (non-constant) — Должна быть левой частью;
error 023: array assignment must be simple assignment — начения массива должны быть простыми;
error 024: «break» or «continue» is out of context — Операторы «break» или «continue» вне границ
блока;
error 025: function heading differs from prototype — Функция заголовка отличается от прототипа;
error 026: no matching «#if…» — «#if…» — не найдено;
error 027: invalid character constant — Неправильные символы константы;
error 028: invalid subscript (not an array or too many subscripts): %s» — неверное выражение, нет результата
%s является недействительным массивом;
error 029: invalid expression, assumed zero — неверное выражение, нет результата;
error 030: compound statement not closed at the end of file — составной оператор не закрыт в конце файла, поставить return 1;} в конец мода;
error 031: unknown directive — неверная директива (подключение плагина в дефайнах, неверное установка пути инклюда и тому подобное);
error 032: array index out of bounds (variable «%s») — Индекс массива превышен;
error 033: array must be indexed (variable «%s») — Массив неизвестен;
error 034: argument does not have a default value (argument %d) — Аргумент не имеет начального значения;
error 035: argument type mismatch (argument %d) — Несоответствие типов аргумента;
error 036: empty statement — Пустой оператор;
error 037: invalid string (possibly non-terminated string) — незавершённая строка (обычно бывает, если забывам ставить закрывающие ковычки);
error 038: extra characters on line — Лишние символы в строке;
error 039: constant symbol has no size — Символьная константа не имеет размера;
error 040: duplicate «case» label (value %d) — несколько раз объявлен «case» с одним и тем же параметром;
error 041: invalid ellipsis, array size is not known — Размер массива неизвестно;
error 042: invalid combination of class specifiers — Недопустимое сочетание класса;
error 043: character constant exceeds range for packed string — Символьная константа превышает размер строки;
error 044: positional parameters must precede all named parameters — ;
error 045: too many function arguments — Слишком много аргументов для функции;
error 046: unknown array size (variable «%s») — Неизвестный размер массива %s;
error 047: array sizes do not match, or destination array is too small — размеры массивов конфликтуют, либо целевой массив слишком маленький (нужно увеличить число в квадратных скобках);
error 048: array dimensions do not match — Размеры массива не совпадают;
error 049: invalid line continuation — Неправильное продолжении линии;
error 050: invalid range — Неправильный диапазон;
error 051: invalid subscript, use «[ ]» operators on major dimensions — Неправильный индекс. Используйте «[ ]»;
error 052: multi-dimensional arrays must be fully initialized — Много размерные массивы должны быть
полностью установлены;
error 053: exceeding maximum number of dimensions — Превышение максимального числа измерений;
error 054: unmatched closing brace — Непревзойденная закрывающаяся скобка;
error 055: start of function body without function header — описание функции без заголовка (пропущен public(…));
error 056: arrays, local variables and function arguments cannot be public (variable «%s») — ;
error 057: unfinished expression before compiler directive — Незавершенное выражение для компилятора;
error 058: duplicate argument; same argument is passed twice — Дублирование аргумента. Аргумент передается
несколько раз;
error 059: function argument may not have a default value (variable «%s») — Аргумент не может иметь значение по-умолчанию;
error 060: multiple «#else» directives between «#if … #endif» — Несколько «#else» между «#if … #endif»;
error 061: «#elseif» directive follows an «#else» directive — «#elseif» перед «#else»;
error 062: number of operands does not fit the operator — Количество операторов не соотвествует
оператору;
error 063: function result tag of operator «%s» must be «%s» — Результат функции %s должен быть %s;
error 064: cannot change predefined operators — Невозможно изменить уже определенные
операторы;
error 065: function argument may only have a single tag (argument %d) — В этой функции может быть только один аргумент
%d;
error 066: function argument may not be a reference argument or an array (argument «%s») — Аргумент функции не может быть ссылкой или
массивом;
error 067: variable cannot be both a reference and an array (variable «%s») — Переменная %s не может быть как массив или
ссылка;
error 068: invalid rational number precision in #pragma — Неправильное число в #pragma;
error 069: rational number format already defined — Формат рационального числа уже определен;
error 070: rational number support was not enabled — Рациональное число не поддерживается;
error 071: user-defined operator must be declared before use (function «%s») — Объявленный оператор должен быть перед
использованием;
error 072: «sizeof» operator is invalid on «function» symbols — Оператор «sizeof» не может быть использован для
символов;
error 073: function argument must be an array (argument «%s») — Аргумент %s должен быть массивом;
error 074: #define %s must start with an alphabetic character — макрос %s должен начинаться с буквы;
error 075: input line too long (after substitutions) — слишком длинная строка после интеграции параметров (возможно, много лишних пробелов, или результативные данные слишком велики для строки (по длине));
error 076: syntax error in the expression, or invalid function call — Неправильный синтаксис или неправильный вызов
функции;
error 077: malformed UTF-8 encoding, or corrupted file: %s — Плохая кодировка UTF-8 или плохой файл %s;
error 078: function uses both «return» and «return

» — Функция использует два «return»;
error 079: inconsistent return types (array & non-array) — несовместимость типов возвращённых результатов (массив и немассив) (сопоставить данные в функции и изменить типы переменных);
error 080: unknown symbol, or not a constant symbol (symbol «%s») — Неизвестный или непостоянный символ %s;
error 081: cannot take a tag as a default value for an indexed array parameter (symbol «%s») — Нельзя взять значение в массив %s;
error 082: user-defined operators and native functions may not have states — найтивы и пользоваельские операторы не могут иметь переключателей;
error 083: a function may only belong to a single automaton (symbol «%s») — Функция может принадлежать только к одной
автоматизации;
error 084: state conflict: one of the states is already assigned to another implementation (symbol «%s») — для функции %s уже определенна данная state;
error 085: no states are defined for function «%s» — не определенна ни одна state для функции %s;
error 086: unknown automaton «%s» — Неизвестная автоматизация %s;
error 087: unknown state «%s» for automaton «%s» — не определен state %s, для переключения %s;
error 088: number of arguments does not match definition — количество аргументов не совпадает с объявленными в функции;

Цитата

fatal error 100: cannot read from file: «%s» — невозможно прочитать/найти файл %s в стандартной директории;
fatal error 107: too many error messages on one line — слишком много ошибок на одной строке (обычно из-за одного неправильного параметра);

Цитата

warning 200: symbol «%s» is truncated to 31 characters — название переменной %s обрезается до 31 символа (укоротите название переменной %s);
warning 201: redefinition of constant/macro (symbol «%s») — двойное определение одинаковой константы (смотреть #define);
warning 202: number of arguments does not match definition — несовпадение количества аргументов;
warning 203: symbol is never used: «%» — символ «%» нигде не используется;
warning 204: symbol is assigned a value that is never used: «%s» — символ создан, ему присваивается значение, но далее он не используется.
warning 208: function with tag result used before definition, forcing reparse — функция с типовым результатом используется перед объявлением
warning 209: function «%s» should return a value — функция %s должна возвращать какое-либо значение (return 1; к примеру);
warning 211: possibly unintended assignment — в условии использовано не сравнение, а присвоение;
warning 213: tag mismatch — несовпадение тэгов;
warning 215: expression has no effect — выражение не имеет эффекта;
warning 216: nested comment — вложенный комментарий (вынесите его за функцию);
warning 217: loose indentation — невыровненная строка (return должен быть строго под телом функции по левому краю, либо можно добавить в начало мода строку #pragma tabsize 0, но это не рекомендуется, так как иногда может не понимать и не прочитывать скобки «{» и «}»);
warning 219: local variable «%s» shadows a variable at a preceding level — переменная дважды объявлена;
warning 224: indeterminate array size in «sizeof» expression (symbol «%s») — должен быть определён размер массива %s (если определён статиком, заменить дефайном);
warning 225: unreachable code — невалидный код;
warning 235: public function lacks forward declaration (symbol «%s») — необходим форвард функции %s (перед функцией пишем forward %s;

Ошибки в консоли

Цитата

Script[gamemodes/new.amx]: Run time error 20: «Invalid index parametr

» — отсутствует main() {} в начале мода.

%s — имя переменной/макроса/аргумента функции.


Авторы: OKStyle, webserfer, Kaza40k, [Nos]B[R]aiN[L], Ym[0]n, _volk_, ДениСыч, Roman1us


 Источник: pawn-wiki.ru

Author

Message

Veteran Member

minimiller's Avatar

Join Date: Aug 2007

Location: United Kingdom

Old

03-16-2009

, 16:30

 

[TUT] Compiling errors

Reply With Quote

#1


A friend messaged me on steam the other day, asking me to help him debug his plugin. I asked whether he knew how to read the error and warning messages to which he replied «no». As of 16/03/2009, i dont think there is a tutorial to read these messages so i thought i would create 1
Note:
This is mainly for newbie scripters, as im guessing alot of intermediate / advanced scripters allready know about these error messages

The error messages of doom
Below is an example of an error message when trying to compile.

Quote:

C:\Users\Stu\Desktop\other\Stu’s plugins\b_rush.sma(107) : error 035: argument type mismatch (argument 2)

Now lets break this error message down into smaller chunks

1) «

C:\Users\Stu\Desktop\other\Stu’s plugins\b_rush.sma«
This is where the source code of the plugin is saved. In my case, it is held in a folder on my desktop called «Stu’s Plugins». It might be a good idea to create a folder on your desktop to keep all your plugins neat and tidy. Another good place to house plugins would be «C:/Program Files/Pawn Studio/Plugins», or «C:/Program Files/AMXMODX/Plugins»

2) «

(107)«
(1/3 Main parts that you need to know)
The number within the brackets is what line the error/warning has been found. In our case, its occouring on line 107. With most good IDE’s (Pawn Studio, AMXX Studio, etc.) the line numbers are printed down the left hand side to make it easier to find. If you’re useing notepad or similar, there may be a keyboard shortcut E.g. Ctrl+H to goto a specific line number

3) «

error 035:«
This is the error code. Im not entirely sure if there is a list of pawn error codes, so ill probably steal the 2nd post and make a list of them there. Allthough this error code is not nesseserily needed, it might be worth noting it down and how you fixed it for future reference.

4) «

argument type mismatch«
(2/3 Main parts that you need to know)
In our case, an «argument type mismatch» is where the function «client_print» dosent have enough parameters.

5) «

(argument 2)«
(3/3 Main parts that you need to know)
This shows precisely where the error is within the function

Break it down
So now we have broken down the error, we have a clearer view of where the error is and what is wrong
Part 1/3 shows that the error is on line 107
If we find our line 107, we find this:

Code:

client_print(0, "Welcome to the server!");

2/3 shows that client_print dosent have enough arguments
3/3 shows that argument 2 is incorrect

What should it be?
Lets check funcwiki and see what the client_print function should be:

Quote:

Originally Posted by http://www.amxmodx.org/funcwiki.php?go=func&id=22

client_print — Sends a message to a player.
Syntax:

client_print ( index, type, const message[], … ) Type:

Native Notes:

id is a player index from 1 to 32. If 0, the message will be sent to all players.

The type is one of three types:
print_chat — chat text
print_console — console message
print_notify — console in dev mode
print_center — center say

Locating the error
So we can see that client_print should have a minimum of 3 arguments. Our code has 2
So lets check where we went wrong

our «index» is set to «0»
This is fine (Will print to the server)

Our «type» is set to «Welcome to the server!»
This is not a type, because the funcwiki says that we need to use print_chat, print_console, print_notify, or print_center.

If we check number (5) of our error again, we see that the error was in «(argument 2)», so this would back up our assumption that the «type» was wrong

Fixing the error
So we can now go back to line 107 and change it to this:

Code:

client_print(0, print_center, "Welcome to the server!");

Recompile
Now lets re-compile and see what happens…
Oh look!

Quote:

Welcome to the AMX Mod X 1.8.1-300 Compiler.
Copyright (c) 1997-2006 ITB CompuPhase, AMX Mod X Team

Header size: 944 bytes
Code size: 3796 bytes
Data size: 1364 bytes
Stack/heap size: 16384 bytes; max. usage is unknown, due to recursion
Total requirements: 22488 bytes
Done.

Compilation Time: 1.10 sec

Hope this tut helped you. Whether it did or not, it passed another 30 mins and now im off to play a mix =]
x

__________________


Last edited by minimiller; 03-16-2009 at 16:43.

minimiller is offline

Send a message via MSN to minimiller

Veteran Member

minimiller's Avatar

Join Date: Aug 2007

Location: United Kingdom

Old

03-16-2009

, 16:30

 

Re: [TUT] Compiling errors

Reply With Quote

#2


Thanks to Stupok =]

Quote:

/*001*/ «expected token: \»%s\», but found \»%s\»\n»,
/*002*/ «only a single statement (or expression) can follow each \»case\»\n»,
/*003*/ «declaration of a local variable must appear in a compound block\n»,
/*004*/ «function \»%s\» is not implemented\n»,
/*005*/ «function may not have arguments\n»,
/*006*/ «must be assigned to an array\n»,
/*007*/ «operator cannot be redefined\n»,
/*008*/ «must be a constant expression; assumed zero\n»,
/*009*/ «invalid array size (negative or zero)\n»,
/*010*/ «invalid function or declaration\n»,
/*011*/ «invalid outside functions\n»,
/*012*/ «invalid function call, not a valid address\n»,
/*013*/ «no entry point (no public functions)\n»,
/*014*/ «invalid statement; not in switch\n»,
/*015*/ «\»default\» case must be the last case in switch statement\n»,
/*016*/ «multiple defaults in \»switch\»\n»,
/*017*/ «undefined symbol \»%s\»\n»,
/*018*/ «initialization data exceeds declared size\n»,
/*019*/ «not a label: \»%s\»\n»,
/*020*/ «invalid symbol name \»%s\»\n»,
/*021*/ «symbol already defined: \»%s\»\n»,
/*022*/ «must be lvalue (non-constant)\n»,
/*023*/ «array assignment must be simple assignment\n»,
/*024*/ «\»break\» or \»continue\» is out of context\n»,
/*025*/ «function heading differs from prototype\n»,
/*026*/ «no matching \»#if…\»\n»,
/*027*/ «invalid character constant\n»,
/*028*/ «invalid subscript (not an array or too many subscripts): \»%s\»\n»,
/*029*/ «invalid expression, assumed zero\n»,
/*030*/ «compound statement not closed at the end of file\n»,
/*031*/ «unknown directive\n»,
/*032*/ «array index out of bounds (variable \»%s\»)\n»,
/*033*/ «array must be indexed (variable \»%s\»)\n»,
/*034*/ «argument does not have a default value (argument %d)\n»,
/*035*/ «argument type mismatch (argument %d)\n»,
/*036*/ «empty statement\n»,
/*037*/ «invalid string (possibly non-terminated string)\n»,
/*038*/ «extra characters on line\n»,
/*039*/ «constant symbol has no size\n»,
/*040*/ «duplicate \»case\» label (value %d)\n»,
/*041*/ «invalid ellipsis, array size is not known\n»,
/*042*/ «invalid combination of class specifiers\n»,
/*043*/ «character constant exceeds range for packed string\n»,
/*044*/ «positional parameters must precede all named parameters\n»,
/*045*/ «too many function arguments\n»,
/*046*/ «unknown array size (variable \»%s\»)\n»,
/*047*/ «array sizes do not match, or destination array is too small\n»,
/*048*/ «array dimensions do not match\n»,
/*049*/ «invalid line continuation\n»,
/*050*/ «invalid range\n»,
/*051*/ «invalid subscript, use \»[ ]\» operators on major dimensions\n»,
/*052*/ «multi-dimensional arrays must be fully initialized\n»,
/*053*/ «exceeding maximum number of dimensions\n»,
/*054*/ «unmatched closing brace\n»,
/*055*/ «start of function body without function header\n»,
/*056*/ «arrays, local variables and function arguments cannot be public (variable \»%s\»)\n»,
/*057*/ «unfinished expression before compiler directive\n»,
/*058*/ «duplicate argument; same argument is passed twice\n»,
/*059*/ «function argument may not have a default value (variable \»%s\»)\n»,
/*060*/ «multiple \»#else\» directives between \»#if … #endif\»\n»,
/*061*/ «\»#elseif\» directive follows an \»#else\» directive\n»,
/*062*/ «number of operands does not fit the operator\n»,
/*063*/ «function result tag of operator \»%s\» must be \»%s\»\n»,
/*064*/ «cannot change predefined operators\n»,
/*065*/ «function argument may only have a single tag (argument %d)\n»,
/*066*/ «function argument may not be a reference argument or an array (argument \»%s\»)\n»,
/*067*/ «variable cannot be both a reference and an array (variable \»%s\»)\n»,
/*068*/ «invalid rational number precision in #pragma\n»,
/*069*/ «rational number format already defined\n»,
/*070*/ «rational number support was not enabled\n»,
/*071*/ «user-defined operator must be declared before use (function \»%s\»)\n»,
/*072*/ «\»sizeof\» operator is invalid on \»function\» symbols\n»,
/*073*/ «function argument must be an array (argument \»%s\»)\n»,
/*074*/ «#define pattern must start with an alphabetic character\n»,
/*075*/ «input line too long (after substitutions)\n»,
/*076*/ «syntax error in the expression, or invalid function call\n»,
/*077*/ «malformed UTF-8 encoding, or corrupted file: %s\n»,
/*078*/ «function uses both \»return\» and \»return <value>\»\n»,
/*079*/ «inconsistent return types (array & non-array)\n»,
/*080*/ «unknown symbol, or not a constant symbol (symbol \»%s\»)\n»,
/*081*/ «cannot take a tag as a default value for an indexed array parameter (symbol \»%s\»)\n»,
/*082*/ «user-defined operators and native functions may not have states\n»,
/*083*/ «a function may only belong to a single automaton (symbol \»%s\»)\n»,
/*084*/ «state conflict: one of the states is already assigned to another implementation (symbol \»%s\»)\n»,
/*085*/ «no states are defined for function \»%s\»\n»,
/*086*/ «unknown automaton \»%s\»\n»,
/*087*/ «unknown state \»%s\» for automaton \»%s\»\n»,
/*088*/ «number of arguments does not match definition\n»

__________________


Last edited by minimiller; 03-24-2009 at 11:45.

minimiller is offline

Send a message via MSN to minimiller

Retired AMX Mod X Moderator

xPaw's Avatar

Old

03-16-2009

, 16:38

 

Re: [TUT] Compiling errors

Reply With Quote

#3


PHP Code:



client_print(0print_centre"Welcome to the server!");

// -> :)

client_print(0print_center"Welcome to the server!"); 




__________________

xPaw is offline

Veteran Member

minimiller's Avatar

Join Date: Aug 2007

Location: United Kingdom

Old

03-16-2009

, 16:44

 

Re: [TUT] Compiling errors

Reply With Quote

#4


fixed =]

__________________

minimiller is offline

Send a message via MSN to minimiller

AMX Mod X Plugin Approver

Emp`'s Avatar

Join Date: Aug 2005

Location: Decapod 10

Old

03-16-2009

, 17:34

 

Re: [TUT] Compiling errors

Reply With Quote

#5


Glad someone finally did it. I never got around to it. GJ.

Emp` is offline

Veteran Member

MeRcyLeZZ's Avatar

Old

03-22-2009

, 20:33

 

Re: [TUT] Compiling errors

Reply With Quote

#6


Nice tut, certainly helpful for those unfamiliar with compilers.

Quote:

Originally Posted by minimiller

In our case, an «argument type mismatch» is where the function «client_print» dosent have enough parameters.

Actually, the type mismatch in that case is because you are passing a string (array) when it expects a single cell for the 2nd parameter. The actual «you didn’t pass enough parameters» error is: error 088: number of arguments does not match definition. Just letting you know…

__________________

MeRcyLeZZ is offline

Veteran Member

stupok's Avatar

Old

03-23-2009

, 21:30

 

Re: [TUT] Compiling errors

Reply With Quote

#7


Quote:

Originally Posted by minimiller
View Post

Im not entirely sure if there is a list of pawn error codes

I found one! (posting them here might help to direct newbs to this post when they search ;)

from amxmodx-1.8.1\compiler\libpc300\sc5.scp

Code:

static char *errmsg[] = {
#ifdef SCPACK
/*001*/  "expected token: \"%s\", but found \"%s\"\n",
/*002*/  "only a single statement (or expression) can follow each \"case\"\n",
/*003*/  "declaration of a local variable must appear in a compound block\n",
/*004*/  "function \"%s\" is not implemented\n",
/*005*/  "function may not have arguments\n",
/*006*/  "must be assigned to an array\n",
/*007*/  "operator cannot be redefined\n",
/*008*/  "must be a constant expression; assumed zero\n",
/*009*/  "invalid array size (negative or zero)\n",
/*010*/  "invalid function or declaration\n",
/*011*/  "invalid outside functions\n",
/*012*/  "invalid function call, not a valid address\n",
/*013*/  "no entry point (no public functions)\n",
/*014*/  "invalid statement; not in switch\n",
/*015*/  "\"default\" case must be the last case in switch statement\n",
/*016*/  "multiple defaults in \"switch\"\n",
/*017*/  "undefined symbol \"%s\"\n",
/*018*/  "initialization data exceeds declared size\n",
/*019*/  "not a label: \"%s\"\n",
/*020*/  "invalid symbol name \"%s\"\n",
/*021*/  "symbol already defined: \"%s\"\n",
/*022*/  "must be lvalue (non-constant)\n",
/*023*/  "array assignment must be simple assignment\n",
/*024*/  "\"break\" or \"continue\" is out of context\n",
/*025*/  "function heading differs from prototype\n",
/*026*/  "no matching \"#if...\"\n",
/*027*/  "invalid character constant\n",
/*028*/  "invalid subscript (not an array or too many subscripts): \"%s\"\n",
/*029*/  "invalid expression, assumed zero\n",
/*030*/  "compound statement not closed at the end of file\n",
/*031*/  "unknown directive\n",
/*032*/  "array index out of bounds (variable \"%s\")\n",
/*033*/  "array must be indexed (variable \"%s\")\n",
/*034*/  "argument does not have a default value (argument %d)\n",
/*035*/  "argument type mismatch (argument %d)\n",
/*036*/  "empty statement\n",
/*037*/  "invalid string (possibly non-terminated string)\n",
/*038*/  "extra characters on line\n",
/*039*/  "constant symbol has no size\n",
/*040*/  "duplicate \"case\" label (value %d)\n",
/*041*/  "invalid ellipsis, array size is not known\n",
/*042*/  "invalid combination of class specifiers\n",
/*043*/  "character constant exceeds range for packed string\n",
/*044*/  "positional parameters must precede all named parameters\n",
/*045*/  "too many function arguments\n",
/*046*/  "unknown array size (variable \"%s\")\n",
/*047*/  "array sizes do not match, or destination array is too small\n",
/*048*/  "array dimensions do not match\n",
/*049*/  "invalid line continuation\n",
/*050*/  "invalid range\n",
/*051*/  "invalid subscript, use \"[ ]\" operators on major dimensions\n",
/*052*/  "multi-dimensional arrays must be fully initialized\n",
/*053*/  "exceeding maximum number of dimensions\n",
/*054*/  "unmatched closing brace\n",
/*055*/  "start of function body without function header\n",
/*056*/  "arrays, local variables and function arguments cannot be public (variable \"%s\")\n",
/*057*/  "unfinished expression before compiler directive\n",
/*058*/  "duplicate argument; same argument is passed twice\n",
/*059*/  "function argument may not have a default value (variable \"%s\")\n",
/*060*/  "multiple \"#else\" directives between \"#if ... #endif\"\n",
/*061*/  "\"#elseif\" directive follows an \"#else\" directive\n",
/*062*/  "number of operands does not fit the operator\n",
/*063*/  "function result tag of operator \"%s\" must be \"%s\"\n",
/*064*/  "cannot change predefined operators\n",
/*065*/  "function argument may only have a single tag (argument %d)\n",
/*066*/  "function argument may not be a reference argument or an array (argument \"%s\")\n",
/*067*/  "variable cannot be both a reference and an array (variable \"%s\")\n",
/*068*/  "invalid rational number precision in #pragma\n",
/*069*/  "rational number format already defined\n",
/*070*/  "rational number support was not enabled\n",
/*071*/  "user-defined operator must be declared before use (function \"%s\")\n",
/*072*/  "\"sizeof\" operator is invalid on \"function\" symbols\n",
/*073*/  "function argument must be an array (argument \"%s\")\n",
/*074*/  "#define pattern must start with an alphabetic character\n",
/*075*/  "input line too long (after substitutions)\n",
/*076*/  "syntax error in the expression, or invalid function call\n",
/*077*/  "malformed UTF-8 encoding, or corrupted file: %s\n",
/*078*/  "function uses both \"return\" and \"return <value>\"\n",
/*079*/  "inconsistent return types (array & non-array)\n",
/*080*/  "unknown symbol, or not a constant symbol (symbol \"%s\")\n",
/*081*/  "cannot take a tag as a default value for an indexed array parameter (symbol \"%s\")\n",
/*082*/  "user-defined operators and native functions may not have states\n",
/*083*/  "a function may only belong to a single automaton (symbol \"%s\")\n",
/*084*/  "state conflict: one of the states is already assigned to another implementation (symbol \"%s\")\n",
/*085*/  "no states are defined for function \"%s\"\n",
/*086*/  "unknown automaton \"%s\"\n",
/*087*/  "unknown state \"%s\" for automaton \"%s\"\n",
/*088*/  "number of arguments does not match definition\n"

__________________

stupok is offline

Veteran Member

minimiller's Avatar

Join Date: Aug 2007

Location: United Kingdom

Old

03-24-2009

, 05:15

 

Re: [TUT] Compiling errors

Reply With Quote

#8


nice 1 dude
ill update 2nd post when i get home

__________________

minimiller is offline

Send a message via MSN to minimiller

Veteran Member

MeRcyLeZZ's Avatar

Old

03-24-2009

, 23:42

 

Re: [TUT] Compiling errors

Reply With Quote

#9


It should also be noted that the errors aren’t always caused by what the compiler says it’s causing them.

For instance, today while I was working on ZP I started getting lots of error 017: undefined symbol «xxxxxx» (screenshot attached to post). About half an hour later I found out it was caused by the following code:

Code:

fnGetSurvivors() {     new iSurvivors, id         for (id = 1; id <= g_maxplayers; id++)     {         if (is_user_alive(id) && g_survivor[id])

            iSurvivor++

   

}         return iSurvivors; }

The highlighted line should read iSurvivors++ instead. After I fixed that, it compiled just fine.

And this is yet another reason why you should regularly backup your files…

Attached Thumbnails

Click image for larger version

Name:	zp_compiler_error.jpg
Views:	845
Size:	97.1 KB
ID:	39464
 

__________________

MeRcyLeZZ is offline

Veteran Member

minimiller's Avatar

Join Date: Aug 2007

Location: United Kingdom

Old

03-25-2009

, 06:43

 

Re: [TUT] Compiling errors

Reply With Quote

#10


so technically, it was correct
ISurvivor wasnt defined
So it was just a minor typo

__________________

minimiller is offline

Send a message via MSN to minimiller
  1. amxmodx.inc
  2. Functions
  3. log_error
  4. File
  5. Constants
native log_error(error, const fmt[], any:...);
error
Error number
fmt
Formatting rules
Variable number of formatting parameters
Logs an error in the native and breaks into the AMXX debugger.
This acts as if the calling plugin - the plugin that is calling the
native, not the plugin calling this function - triggered the error,
just like when AMXX natives error.
This function has no return value.
The function is guaranteed to throw an error, but will make
it appear as if the plugin calling the native triggered it.

Понравилась статья? Поделить с друзьями:
  • Id961 eliwell ошибка e1
  • Id ошибок pawn
  • Id ошибки reoow
  • Id ошибки hostmemorylow
  • Id ошибки brokensharedfolder