SA-MP Forums Archive
How to fix this error? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: How to fix this error? (/showthread.php?tid=308385)



How to fix this error? - Littlehelper - 03.01.2012

Код:
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.


Re: How to fix this error? - Kaperstone - 03.01.2012

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


Re: How to fix this error? - Littlehelper - 03.01.2012

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


Re: How to fix this error? - Kaperstone - 03.01.2012

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.


Re: How to fix this error? - Notis123 - 03.01.2012

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]
.


Re: How to fix this error? - Littlehelper - 03.01.2012

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.


Re: How to fix this error? - Konstantinos - 03.01.2012

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


Re: How to fix this error? - Littlehelper - 03.01.2012

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....


Re: How to fix this error? - Konstantinos - 03.01.2012

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



Re: How to fix this error? - JiHost - 03.01.2012

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.