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

Hi, i am getting this warning, can anybody tell me whats wrong?

This is the warning i get
pawn Код:
C:\Users\Mikkel\Desktop\gf_oct15_2015.pwn(44378) : warning 219: local variable "key" shadows a variable at a preceding level
This is the code
pawn Код:
if(strcmp(x_job,"unmod",true) == 0)
            {
                new key;
                if(ForwardOwnCar(1,playerid)) { key = 1; }
                else if(ForwardOwnCar(2,playerid)) { key = 2; }
                else if(ForwardOwnCar(3,playerid)) { key = 3; }
                else if(ForwardOwnCar(4,playerid)) { key = 4; }
                else if(ForwardOwnCar(5,playerid)) { key = 5; }
                else { return 1; }
                if (!IsPlayerInAnyVehicle(playerid))
                {
                    SendClientMessage(playerid,0xAFAFAFAA, "You have to be in your vehicle to do this.");
                    return 1;
                }
                new key2 = VehicleOwned[ForwardOwnCarID(key,playerid)];
                if(CarInfo[key2][cMod][0] == 0)
                {
                    SendClientMessage(playerid,COLOR_GREY,"Your vehicle is not even moded !");
                    return 1;
                }
                new idcar = GetPlayerVehicleID(playerid);
                if(!IsAnOwnableCar(idcar))
                {
                    SendClientMessage(playerid,COLOR_GREY,"This vehicle does not belong to you !");
                    return 1;
                }
                if (!PlayerToPoint(10.0, playerid, 1585.8218,-1414.2575,13.6231))
                {
                    SendClientMessage(playerid, COLOR_GRAD2, "You must be at the Mod Shop to do this. Follow the {FF6347}red marker");
                    SetPlayerCheckpoint(playerid,1585.8218,-1414.2575,13.6231, 5.0);
                    CP[playerid] = 44;
                    return 1;
                }
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, 0xAFAFAFAA, "Removing these mods will cost you $10000");
                    SendClientMessage(playerid, 0xAFAFAFAA, "type {FF6347}/v unmod confirm"COL_GREY" to remove the mods.");
                    return 1;
                }
This is the line where i get the warning
pawn Код:
new key;
Reply
#2

You have two variables named "key". You just have to change ones variable name into something different.
Reply
#3

Thank you, i will Rep+
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)