SA-MP Forums Archive
warning help - 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: warning help (/showthread.php?tid=448547)



warning help - semaj - 04.07.2013

pawn Код:
C:\Documents and Settings\james\Desktop\Titanium Roleplay GM\Titanium Roleplay v1.0\gamemodes\test.pwn(269) : warning 219: local variable "Name" shadows a variable at a preceding level
pawn Код:
stock PlayerName(playerid)
{
    new Name[MAX_PLAYER_NAME + 1];
    GetPlayerName(playerid, Name, MAX_PLAYER_NAME + 1);
    return Name;
}
can anyone help please?

Thanks


Re : warning help - Sandiel - 04.07.2013

You have another global variable in your script called "Name" (check on top of your script)
and so the easy fix would be to change one of them.


Re: warning help - DaRk_RaiN - 04.07.2013

You have already defined the array/string Name globally, so either delete that global array or, replace thestock with the following and it should go away.
pawn Код:
stock PlayerName(playerid)
{
    new PName[MAX_PLAYER_NAME + 1];
    GetPlayerName(playerid, PName, MAX_PLAYER_NAME + 1);
    return PName;
}
EDIT: Too late