SA-MP Forums Archive
local variable "Name" shadows a variable at a preceding level - 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: local variable "Name" shadows a variable at a preceding level (/showthread.php?tid=415793)



local variable "Name" shadows a variable at a preceding level - MiGu3X - 14.02.2013

My Code:

pawn Код:
stock GetName(playerid)
{
    new Name[24];
    GetPlayerName(playerid, Name, sizeof(Name));
    return Name;
}
ERROR: warning 219: local variable "Name" shadows a variable at a preceding level

Help me pls .. . thnx in advance


Re: local variable "Name" shadows a variable at a preceding level - Babul - 14.02.2013

somewhere, outside of the scope of GetName(), there is an (older) declaration of Name[];
simply change the variables' name inside:
Код:
stock GetName(playerid)
{
    new GName[24];
    GetPlayerName(playerid, GName, sizeof(GName));
    return GName;
}



Respuesta: local variable "Name" shadows a variable at a preceding level - MiGu3X - 14.02.2013

thank u alot