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



warning 219: local variable "string" shadows a variable at a preceding level - s3ek - 29.07.2015

PHP Code:
.pwn(25628) : warning 219local variable "string" shadows a variable at a preceding level
.pwn(25648) : warning 219local variable "string" shadows a variable at a preceding level
.pwn(25668) : warning 219local variable "string" shadows a variable at a preceding level
.pwn(25688) : warning 219local variable "string" shadows a variable at a preceding level
.pwn(25708) : warning 219local variable "string" shadows a variable at a preceding level 
PHP Code:
    if(dialogid == DIALOG_PIZZA2)
    {
        if(
response)
        {
            
Pizzajob[playerid] = 1;
            new 
dsname[MAX_PLAYER_NAME], string[512];
            
GetPlayerName(playeriddsnamesizeof(dsname));
            
format(stringsizeof(string), "{33FF33}[~server]  {FF0000}%s {FFFFFF}now is a Pizzaboy"dsname );
            
SendClientMessageToAll(-1string);
            
SetPlayerCheckpoint(playerid2012.6134,-1729.3796,13.1536,10);
            
SendClientMessage(playerid, -1,"{00FFFF}INFO{FFFFFF} : Follow the red markers on map");
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF2400}[~server]  {FFFFFF}For See All Jobs type /jobs!");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_HOTDOG2)
    {
        if(
response)
        {
            
Hotdog[playerid] = 1;
              new 
dsname[MAX_PLAYER_NAME], string[512];
              
GetPlayerName(playeriddsnamesizeof(dsname));
            
format(stringsizeof(string), "{33FF33}[~server]  {FF0000}%s {FFFFFF}now is an Hotdog Delyverer"dsname );
            
SendClientMessageToAll(-1string);
            
SetPlayerCheckpoint(playerid804.1773,-1455.8715,13.1253,10);
            
SendClientMessage(playerid, -1,"{00FFFF}INFO{FFFFFF} : Follow the red markers on map");
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF2400}[~server]  {FFFFFF}For See All Jobs type /jobs!");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_DUNKINS2)
    {
        if(
response)
        {
            
Dunkins[playerid] = 1;
            new 
dsname[MAX_PLAYER_NAME], string[512];
            
GetPlayerName(playeriddsnamesizeof(dsname));
            
format(stringsizeof(string), "{33FF33}[~server]  {FF0000}%s {FFFFFF}Now Is A Donut Delyverer"dsname );
            
SendClientMessageToAll(-1string);
            
SetPlayerCheckpoint(playerid942.5912,-1311.0442,12.9442,10);
            
SendClientMessage(playerid, -1,"{00FFFF}INFO{FFFFFF} : Follow the red markers on map");
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF2400}[~server]  {FFFFFF}For See All Jobs type /jobs!");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_SWEEPER2)
    {
        if(
response)
        {
            
Sweeper1[playerid] = 1;
            new 
dsname[MAX_PLAYER_NAME], string[512];
            
GetPlayerName(playeriddsnamesizeof(dsname));
            
format(stringsizeof(string), "{33FF33}[~server]  {FF0000}%s {FFFFFF}Now Is A Sweeper"dsname );
            
SendClientMessageToAll(-1string);
            
SetPlayerCheckpoint(playerid1688.4083,-1160.9110,23.6563,10);
            
SendClientMessage(playerid, -1,"{00FFFF}INFO{FFFFFF} : Follow the red markers on map");
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF2400}[~server]  {FFFFFF}For See All Jobs type /jobs!");
        }
        return 
1;
    }
    if(
dialogid == DIALOG_TRUCKING2)
    {
        if(
response)
        {
            
Trucking[playerid] = 1;
              new 
dsname[MAX_PLAYER_NAME], string[512];
              
GetPlayerName(playeriddsnamesizeof(dsname));
            
format(stringsizeof(string), "{33FF33}[~server]  {FF0000}%s {FFFFFF}Now Is A Trucker"dsname );
            
SendClientMessageToAll(-1string);
            
SetPlayerCheckpoint(playerid804.1773,-1455.8715,13.1253,10);
            
SendClientMessage(playerid, -1,"{00FFFF}INFO{FFFFFF} : Follow the red markers on map");
        }
        else
        {
            
SendClientMessage(playerid, -1"{FF2400}[~server]  {FFFFFF}For See All Jobs type /jobs!");
        }
        return 
1;
    } 
warning all line:
Code:
new dsname[MAX_PLAYER_NAME], string[512];



Re: warning 219: local variable "string" shadows a variable at a preceding level - Dragonic - 29.07.2015

Dude, this message is shown when you are already using a "string", rename it to like "string2" then it won't conflit.


Re: warning 219: local variable "string" shadows a variable at a preceding level - s3ek - 29.07.2015

thanks Dragonic (y) Solved


Re: warning 219: local variable "string" shadows a variable at a preceding level - jamesmith12 - 30.07.2015

hmm Double Post ?

https://sampforum.blast.hk/showthread.php?tid=583646
https://sampforum.blast.hk/showthread.php?tid=583652