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



warning 219: local variable "PlayerName" shadows a variable at a preceding level - [DC] - 02.01.2012

Error:
PHP код:
\pawno\include\lfuncs.inc(645) : warning 219local variable "PlayerName" shadows a variable at a preceding level 
Code of lfuncs:

PHP код:
stock ReturnPlayerID(PlayerName[])
{
    for(new 
0MAX_PLAYERSi++)
    {
    if(
IsPlayerConnected(i))
    {
    if(
strfind(pName(i),PlayerName,true)!=-1)
    return 
i;
    }
    }
    return 
INVALID_PLAYER_ID;

This is the line error:

PHP код:
stock ReturnPlayerID(PlayerName[]) 



Re: warning 219: local variable "PlayerName" shadows a variable at a preceding level - Norck - 02.01.2012

Check this out:
pawn Код:
stock ReturnPlayerID(plname[])
{
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(strfind(pName(i),plname,true)!=-1)
    return i;
    }
    }
    return INVALID_PLAYER_ID;
}



Respuesta: warning 219: local variable "PlayerName" shadows a variable at a preceding level - [DC] - 02.01.2012

It worked! Thanks Norck