warning 219: local variable "pName" shadows a variable at a preceding level
#1

Error:
Quote:

warning 219: local variable "pName" shadows a variable at a preceding level

Code:
PHP код:
public ServerRobbery()
{
         for(new 
i=0i<MAX_PLAYERSi++)
        {
            if(
IsPlayerConnected(i)) // checking if player connected
            
{
                
//ROBBERIES
                  
if(ROBBING_TATOO[i] > 1// Checking if robbery time is above 1
                
{
                    
ROBBING_TATOO[i] --; // Decreasing time
                    
new time[20]; //adding time variable
                    
format(time,sizeof(time),"Robbery Time: %d",ROBBING_TATOO[i]);
                    
GameTextForPlayer(i,time,500,3); //shows gametext showing the time remaining for the robbery
                
}
                if(
ROBBING_TATOO[i] == 1// IF the timer reached 1
                
{
                    new 
string[64], pName[MAX_PLAYER_NAME];
                    
GetPlayerName(i,pName,MAX_PLAYER_NAME);
                    
SendClientMessage(iCOLOR_GREEN"Robbery Complete"); //sending message to the player that robbery was complete
                    
SetPlayerWantedLevel(iGetPlayerWantedLevel(i) + 1); //giving player 1 wanted level
                    
ROBBING_TATOO[i] =0// RESET timer
                    
new mrand =random(50000);
                    
format(string,sizeof(string),"[ROBBERY] %s(%d) has robbed a total of $%d from the tatoo shop! LOL!",pName,i,mrand);
                    
SendClientMessageToAll(COLOR_RED,string);
                    
GivePlayerMoney(imrand);
                }
            }
        }
        return 
1;

This is the line error:
PHP код:
new string[64], pName[MAX_PLAYER_NAME]; 
Reply
#2

new string[];
Reply
#3

You probably already defined pName somewhere in your script (as global array).
Just rename pName in this function to some name you haven't used yet.
Reply
#4

thank all for reply
+1 Schneider (y)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)