Warnings problem [2]
#1

Can anyone help me with these two warnings? Thank you in advance.

1. Note: sendername is already defined above.
pawn Код:
41021    if(!strcmp(cmd, "/engine", true))
41022    {
41023
41024        new name[MAX_PLAYER_NAME];
41025        GetPlayerName(playerid, name, sizeof(name));
41026        GetPlayerName(playerid, sendername, sizeof(sendername));
41027        new vehicleid = GetPlayerVehicleID(playerid);
41028        new Float:Vehhp;
41029        GetVehicleHealth(vehicleid, Vehhp);
pawn Код:
(41024) : warning 219: local variable "name" shadows a variable at a preceding level
2.
pawn Код:
40137    if(strcmp(cmd, "/breakin", true) == 0)
40138    {
40139        if(IsPlayerConnected(playerid))
40140       {
40141            if(BreakAllow[playerid] != 0)
40142           {
40143                SendClientMessage(playerid,COLOR_GREY,"You must wait for your time to reduce to rob again !");
40144                return 1;
40145            }
40146            if(PlayerInfo[playerid][pLevel] == 1)
40147           {
40148                SendClientMessage(playerid,COLOR_GREY,"You must be level 2 and above to use this!");
40149                return 1;
40150            }
40151            for(new h = 0; h < sizeof(HouseInfo); h++)
40152           {
40153                new name[MAX_PLAYER_NAME];
40154                GetPlayerName(playerid, name, sizeof(name));
40155                if (PlayerToPoint(3, playerid,HouseInfo[h][hEntrancex], HouseInfo[h][hEntrancey], HouseInfo[h]40137[hEntrancez]))
40156               {
40157                    if(HouseInfo[h][hLock] == 1)
40158                   {
40159                        if(HouseInfo[h][hBreakTime] == 0)
pawn Код:
(40153) : warning 219: local variable "name" shadows a variable at a preceding level

Should I add the whole command/s?
Reply
#2

You already have another variable named 'name', maybe at the beginning of your script, or at the beginning of OnPlayerCommandText.
You can probably just remove the warning lines.
Reply
#3

You should just do everybody (and yourself) a favor and learn to search. This is a common error and I know it's been brought up multiple times. If you couldn't find your answer, then I'll help you.
Reply
#4

My bad, I forgot to add that if I remove any of them, it just gives me another errors.

If I remove the 41024 line it gives me this error.
pawn Код:
error 048: array dimensions do not match
If I remove the 40153 line, it gives me these errors.
pawn Код:
(41031) : error 048: array dimensions do not match
(41038) : error 048: array dimensions do not match
(41063) : error 048: array dimensions do not match
(41064) : error 048: array dimensions do not match
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)