local variable shadows a variable at a preceding level
#1

Hello,
i'm getting a warning "local variable "OnDutyPD" shadows a variable at a preceding level".

Global:
PHP код:
new OnDutyPD[MAX_PLAYERS] = 1
Function:
PHP код:
SendMessageToCopsBackup(OnDutyPD,Float:xbackFloat:ybackFloat:zback,COLOR,msg); 
PHP код:
stock SendMessageToCopsBackup(OnDutyPD,Float:xbackFloat:ybackFloat:zback,color,text[]) // This line i'm getting a warning
{
    for(new 
i=0i<MAX_PLAYERSi++)
    {
        if(
IsPlayerConnected(i))
        {
            if(
playerDB[i][job]==1)
            {
                if(
OnDutyPD[i]==1)
                   {
                    
SendClientMessage(i,color,text);
                    
SetPlayerCheckpoint(ixbackybackzback3.0);
                    return 
1;
                }
            }    
        }
    }

Thanks a Lot.
Reply
#2

You probably have OnDutyPD as a global variable or maybe as enumerator name/element...
Reply
#3

Yes,
Quote:

new OnDutyPD[MAX_PLAYERS] = 1;

Reply
#4

Try this.

PHP код:
stock SendMessageToCopsBackup(Float:xbackFloat:ybackFloat:zback,color,text[]) // This line i'm getting a warning 

    for(new 
i=0i<MAX_PLAYERSi++) 
    { 
        if(
IsPlayerConnected(i)) 
        { 
            if(
playerDB[i][job]==1
            { 
                if(
OnDutyPD[i]==1
                   { 
                    
SendClientMessage(i,color,text); 
                    
SetPlayerCheckpoint(ixbackybackzback3.0); 
                    return 
1
                } 
            }     
        } 
    } 

Reply
#5

Thanks, but getting a:
Quote:

undefined symbol "OnDutyPD"

on:
PHP код:
if(OnDutyPD[i]==1// THIS LINE
{
       
SendClientMessage(i,color,text);
       
SetPlayerCheckpoint(ixbackybackzback3.0);
       return 
1;

Reply
#6

On Global
Quote:

new OnDutyPD[MAX_PLAYERS] = 1;

Reply
#7

I'm already have under Global defined.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)