How to fix this error?
#1

Код:
D:\Game Softs\0.3D\gamemodes\LDriftGM.pwn(95894) : warning 219: local variable "name" shadows a variable at a preceding level
D:\Game Softs\0.3D\gamemodes\LDriftGM.pwn(95862) : warning 219: local variable "name" shadows a variable at a preceding level
D:\Game Softs\0.3D\gamemodes\LDriftGM.pwn(95864) : warning 219: local variable "name" shadows a variable at a preceding level
Hello,
I need to know how to fix this error.
Thankx.
Reply
#2

first of all its a warning,second can you show that line?
Reply
#3

Код:
 name[ MAX_PLAYER_NAME ] // create a name string
this is the line.
Reply
#4

pawn Код:
name[MAX_PLAYER_NAME];
well i see/think that you used too much times this,and maybe you used not in the right place's.
check if you didnt use it for other target's(except name) or tried to get 2 names in 1.
Reply
#5

Quote:
Originally Posted by xkirill
Посмотреть сообщение
pawn Код:
name[MAX_PLAYER_NAME];
well i see/think that you used too much times this,and maybe you used not in the right place's.
check if you didnt use it for other target's(except name) or tried to get 2 names in 1.
if its like so i think he should put the player name in a stock
but if he uses it multiple times it doesnt matters
as he said the right code is
pawn Код:
name[MAX_PLAYER_NAME]
.
Reply
#6

Quote:
Originally Posted by xkirill
Посмотреть сообщение
pawn Код:
name[MAX_PLAYER_NAME];
well i see/think that you used too much times this,and maybe you used not in the right place's.
check if you didnt use it for other target's(except name) or tried to get 2 names in 1.
Checked Everything, nothing is wrong.
Reply
#7

Just change it to another. Like
pawn Код:
Playername[MAX_PLAYER_NAME];
on the part of code on lines 95800 to 95900.
Reply
#8

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Just change it to another. Like
pawn Код:
Playername[MAX_PLAYER_NAME];
on the part of code on lines 95800 to 95900.
Works, but dosent show player's name.
it only shows player id....
Reply
#9

Did you change it on the code after this line
pawn Код:
Playername[MAX_PLAYER_NAME];
The format
pawn Код:
// new string[128]; <- An example
// From "name" to "Playername"
format(string, sizeof(string), "%s blabla..", Playername);
However, to show the id of the player it should be
pawn Код:
%d
and on Players Name
pawn Код:
%s
Reply
#10

This warning appears when you are trying to create same variable two or more times under same callback.
You probably have two or more "new name[MAX_PLAYER_NAME];" under one of your callbacks, remove one and things should work.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)