Warning 204 symbol is assigned a value that is never used
Warning 204 symbol is assigned a value that is never used
Помогите. | Выдает Warning. Оценка: 




Помогите, это не катастрофа, но не приятно видеть в коде такой Warning.
Я просто только начал разбираться с всем этим и решил добавить свой маппинг.
Первый раз всё было нормально, но когда второй раз добавлял были ошибки, а так дописал 2 и только Warning.
Почитай, что такое ПРЕДУПРЕЖДЕНИЯ и что такое ОШИБКИ.
Ты создал переменную, дал ей некое значение (в данном случае ID объекта), но нигде не используешь. Ты либо её вообще не создавай, либо не обращай внимания на это предупреждение, если же в дальнейшем тебе необходимо будет взаимодействовать с объектом посредством переменной.
Почитай, что такое ПРЕДУПРЕЖДЕНИЯ и что такое ОШИБКИ.
Ты создал переменную, дал ей некое значение (в данном случае ID объекта), но нигде не используешь. Ты либо её вообще не создавай, либо не обращай внимания на это предупреждение, если же в дальнейшем тебе необходимо будет взаимодействовать с объектом посредством переменной.
Огромное спасибо за помощь, в дальнейшем буду знать!
Errors List
From SA-MP Wiki
Contents
General Pawn Error List
This pages contains the most common errors and warnings produced by the pawn compiler when creating SA:MP scripts.
When the compiler finds an error in a file, it outputs a message giving, in this order:
Note: The error may be on the line ABOVE the line that is shown, since the compiler cannot always establish an error before having analyzed the complete expression.
Error categories
Errors are separated into three classes:
Errors
Fatal errors
Warnings
Common Errors
001: expected token
A required token is missing.
002: only a single statement (or expression) can follow each “case”
Every case in a switch statement can hold exactly one statement.
To put multiple statements in a case, enclose these statements
between braces (which creates a compound statement).
The above code also produces other warnings/errors:
004: function «x» is not implemented
Most often caused by a missing brace in the function above.
025: function heading differs from prototype
This usually happen when new sa-mp version comes with new addition of argument to a function, like OnPlayerGiveDamage from 0.3x to 0.3z. The scripter must add «bodypart» argument to OnPlayerGiveDamage callback on their script.
Caused by either the number of arguments or the argument name is different.
035: argument type mismatch (argument x)
An argument passed to a function is of the wrong ‘type’. For example, passing a string where you should be passing an integer.
036: empty statement
Caused by a rogue semicolon ( ; ), usually inadvertently placed behind an if-statement.
046: unknown array size (variable x)
For array assignment, the size of both arrays must be explicitly defined, also if they are passed as function arguments.
047: array sizes do not match, or destination array is too small
For array assignment, the arrays on the left and the right side of the assignment operator must have the same number of dimensions. In addition:
In the above code, we try to fit 12 characters in an array that can only support 8. By increasing the array size of the destination, we can solve this. Note that a string also requires a null terminator so the total length of «Hello World!» plus the null terminator is, in fact, 13.
055: start of function body without function header
This error usually indicates an erroneously placed semicolon at the end of the function header.
Common Fatal Errors
100: cannot read from file: » «
The compiler cannot find, or read from, the specified file. Make sure that the file you are trying to include is in the proper directory (default: \pawno\include).
Common Warnings
202: number of arguments does not match definition
The description of this warning is pretty self-explanatory. You’ve passed either too few or too many parameters to a function. This is usually an indication that the function is used incorrectly. Refer to the documentation to figure out the correct usage of the function.
This usually happen on GetPlayerHealth function with PAWNO function auto completion as it confuses with the NPC GetPlayerHealth function that only has ‘playerid’ argument.
203: symbol is never used: «symbol»
You have created a variable or a function, but you’re not using it. Delete the variable or function if you don’t intend to use it. This warning is relatively safe to ignore.
The stock keyword will prevent this warning from being shown, as variables/functions with the stock keyword are not compiled unless they are used.
204: symbol is assigned a value that is never used: «symbol»
Similar to the previous warning. You created a variable and assigned it a value, but you’re not using that value anywhere. Use the variable, or delete it. This warning, too, is relatively safe to ignore.
209: function should return a value
You have created a function without a return value
but you used it to assign on variable or function argument,
211: possibly unintended assignment
The assignment operator (=) was found in an if-statement, instead of the equality operator (==). If the assignment is intended, the expression must be wrapped in parentheses. Example:
213: tag mismatch
A tag mismatch occurs when:
Usually happen on a new variable created with missing tag on the required function such as Float:, Text3D:, Text:, etc. Example,
217: loose indentation
The compiler will issue this warning if the code indentation is ‘loose’, example:
Indentation means to push (indent) text along from the left of the page (by pressing the TAB key). This is common practice in programming to make code easier to read. This warning also exists to avoid dangling-else problem.
219: local variable «foo» shadows a variable at a preceding level
A local variable, i.e. a variable that is created within a function or callback, cannot have the same name as a global variable, an enum specifier, a function, or a variable declared higher up in the same function. The compiler cannot tell which variable you’re trying to alter.
It is customary to prefix global variables with ‘g’ (e.g. gTeam). However, global variables should be avoided where possible.
225: unreachable code
The indicated code will never run, because an instruction before (above) it causes a jump out of the function, out of a loop or elsewhere. Look for return, break, continue and goto instructions above the indicated line. Unreachable code can also be caused by an endless loop above the indicated line.
235: public function lacks forward declaration (symbol «symbol»)
Your public function is missing a forward declaration.
Warning 204 symbol is assigned a value that is never used
lop50956 писал(а): > Скажите мне пожалуйста вы скриптер или кто? если да то уж назовите цену я же к вам собираюсь идти хлеб покупать
Я хлебоутка, приходите.
warning 204: symbol is assigned a value that is never used:
Правила форума
1. Запрещено материться и оскорблять других участников форума.
2. Запрещен флуд, оффтоп, дабл постинг во всех разделах форума, кроме раздела «Болтовня».
3. Запрещено взламывать сайт/форум или наносить любой вред проекту.
4. Запрещено рекламировать другие ресурсы.
5. Запрещено создавать темы без информативного названия. Название темы должно отображать ее смысл.
В данном разделе форума разрешено создавать темы, касающие только скриптинга для AMX Mod X.
Правила при создании новой темы:
1. При вставке кода плагина необходимо использовать тег [code=php].
2. Любые изображения должны быть загружены, как вложения к вашему сообщению.
3. При описании проблемы или запросе на помощь в редактировании плагина обязательно выкладывайте исходник sma плагина.
warning 204: symbol is assigned a value that is never used:
ребят почему эта ошибка? подскажите пожалуйста
warning 204: symbol is assigned a value that is never used: «bdmin»
new bool : bdmin
public client_disconnect ( id )
<
bdmin = false
>
[Waring]
%s- переменная
Это значит что переменная дважды объявлена.
Пример:
PHP код:
;
Что же нам делать, а вот что:
1) мы можем одну из них удалить;
2) можем изменить;
Но не стоит забывать что при изменении переменной нам нужно заменить все что её касается
вот пример правильного изменения:
PHP код:
Это значит что код не табулирован(код не построен лесенкой)
Пример:
пример правильного табулирования
Что же делать? ответ прост
1) мы можем делать все вручную
2) можем поставить
3) можем с помощи notepad++ все исправить (на форуме есть урок)
Это означает что у функции нету forward
Пример:
Вы создали паблик
PHP код:
И увас появляется этот варинг что же делать?
ответ прост
добавляем forward
PHP код:
если вы не хотите каждый раз писать forward то можно сделать так:
PHP код:
и тогда новые паблики мы пишем так
PHP код:
Вот так это выглядит
PHP код:
Это означает не совпадения аргументов
вот допустим самый простой случай:
Это означает что в дефайнах(define)
Пример:
PHP код:
Решение одну из двух удалить!
7)
Это обозначает что мы при создании переменной ввели больше 31 символа
Пример:
PHP код:
Это значит что у нас не совпадают аргументы
Возьмем самый простой пример:
PHP код:
Наша ошибка содержится здесь:
PHP код:
решение простое:
Нам 0 нужно заменить на 1
PHP код:
Это означает что данный символ нигде не используется
Пример :
Создадим допустим переменную
И тут у нас возникает
PHP код:
Что же делать?
Ответ прост:
найти эту переменную и удалить
Это значит что создали переменную и массив а он негде не используется
Пример:
PHP код:
Решения: просто удалить
Это значит что наша функция не возвращается(простыми словами нету return 1; или return 0
пример:
Решения:
PHP код:
это означает что case стаким значением повторяется
Решение этой проблемы простое
PHP код:
нам нужно цифру 28 изменит на другую (в той строчке на которую жалуется )
Это означает что индекс массива превышен (но не всегда смотрим дальше)
Пример:
PHP код:
131- массив поигравшись с ним я понял что дело не в нем, а в чём-же спросите вы?
пример данной ошибки:
PHP код:
как видим
JoinPed[123] с начало с таким значением, а потом JoinPed[98]
Решение простое:
JoinPed[123] число в данных скобках должно быть одинаковым.
пример:
PHP код:
Это означает что строка неправильная а точнее где то допущена ошибка
пример:
PHP код:
как видим нам после слова «модера» не хватает »
пример:
PHP код:
Это значит что мы пропустили знак или скобку (в данном примере скобку)
Пример:
смотрим на
PHP код:
и вим что мы пропустили )
и так оно выглядит
PHP код:
Это означает что у вас после «case» идет if(dialogid == )
Пример:
PHP код:
Это означает что мы пропустили скобку.
Мой совет
1)проверить весь код в ручную
2)на форуме был урок как найти не по ставленую скобку
3)Можно воспользоватся notepad++ там показы линии открытых скобок и тогда можно найти эту скобку
Это означает что мы не поставили переменную (new)
Пример:
PHP код:
Решение:
Ко всем new добавим
PHP код:
C:\Users\Anton\Desktop\Stage RolePlay\gamemodes\RRP.pwn(13925) : warning 204: symbol is assigned a value that is never used: «sp»
C:\Users\Anton\Desktop\Stage RolePlay\gamemodes\RRP.pwn(37039) : warning 225: unreachable code
C:\Users\Anton\Desktop\Stage RolePlay\gamemodes\RRP.pwn(49900) : warning 219: local variable «newkeys» shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
Header size: 11572 bytes
Code size: 2640700 bytes
Data size: 29857280 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:32525936 bytes
Строчка 13925 new Float:sp = GetPlayerSpeed(i);
Код на который жалуется warning 225 if(VehicleSystem[l][cArrest] == 1)
<
new str[128];
format(str,128,»Транспорт на штраф стоянке, обратитесь в Полицию.»);
SendClientMessage(playerid,COLOR_GRAD2,str);
format(str,128,»Ид вашего транспорта %d»,carid);
SendClientMessage(playerid,COLOR_GRAD2,str);
return 1;
>
else
<
GivePlayerMoney(playerid,-500);
PlayerInfo[playerid][pCash]-=500;
SendClientMessage(playerid, COLOR_YELLOW, «Машина стоит там, где вы ее припарковали»);
SetVehiclePos(GetVID(PlayerInfo[playerid][pCKey]),VehicleSystem[PlayerInfo[playerid][pCKey]][xCA],VehicleSystem[PlayerInfo[playerid][pCKey]][yCA], VehicleSystem[PlayerInfo[playerid][pCKey]][zCA]);
SetVehicleZAngle(GetVID(PlayerInfo[playerid][pCKey]),VehicleSystem[PlayerInfo[playerid][pCKey]][aCA]);
SavePlayer(playerid);
return 1;
>
>
Строчка 37039 return 1;
Строчка 49900 public OnPlayerKeyStateChange(playerid, newkeys,oldkeys)
Помогите пожалуйста плюсик обещан