Local variable new rand pwarning ?
#1

why i get this warning everything seems alright

PHP код:
C:\Users\Elvis JR\Desktop\CNR-rp\gamemodes\1.2.pwn(8481) : warning 219local variable "rand" shadows a variable at a preceding level
C
:\Users\Elvis JR\Desktop\CNR-rp\gamemodes\1.2.pwn(8587) : warning 219local variable "rand" shadows a variable at a preceding level
Pawn compiler 3.2.3664              Copyright 
(c1997-2006ITB CompuPhase
2 Warnings

line 8481
PHP код:
if(RobbingInfo[i][pRecently69cent] == 1)
            {
                new 
ID;
                new 
string[120];
                new 
randrandom(10000);
                
format(string120""COL_GREY"["COL_LRED"ROBBERY"COL_GREY"]"COL_YTUNA" %s "COL_WHITE"has robbed $%d from the 69 Cent Store in idlewood."PlayerInfo(i), rand);
                
SendClientMessageToAll(0xFFFFFFFFstring);
                
RobbingInfo[i][pRecently69cent] = 0;
                if(
gTeam[ID] == Team_Cop || gTeam[ID] == Team_Army || gTeam[ID] == Team_FBI || gTeam[ID] == Team_Guard)
                {
                       
format(string120"[DISPATCH] %s has robbed the Los Santos 69 Cent Store in LS idlewood. Respond now."PlayerInfo(i));
                    
SendCopMessage(string);
                    return 
0;
                }
                
IncreaseWantedLevelNM(i6);
                
GivePlayerMoney(irand);
                if(
IsPlayerAttachedObjectSlotUsed(ii)) RemovePlayerAttachedObject(ii);
                
PlayerTextDrawHide(iBANKR[i]);
                
IncreaseScore(i2);
                
AccountInfo[i][pRobSkill] += 1;
                
format(string120"[SKILL UPGRADE] Your robbing skill has increased. Read /robjob.");
                
SendClientMessage(iCOLOR_GREYstring);
            }
            if(
RobbingInfo[i][pRobbed69cent] >= 1)
            {
                --
RobbingInfo[i][pRobbed69cent];
            } 
line 8587
PHP код:
            if(AccountInfo[i][pRobbingBank] > 1)
            {
                new 
string[45];
                --
AccountInfo[i][pRobbingBank];
                
format(stringsizeof(string), "~y~[~r~BANK ROBBERY~y~] ~n~            ~w~%d"AccountInfo[i][pRobbingBank]);
                
PlayerTextDrawSetString(i,BANKR[i],string);
                
PlayerTextDrawShow(iBANKR[i]);
                
SetPlayerAttachedObject(i,0,1550,1,0.122000,-0.249000,0.057000,-4.899999,42.100002,134.699966,1.000000,1.000000,1.000000);
            }
            if(
AccountInfo[i][pRobbingBank] == 1)
            {
                new 
string[120];
                new 
tdstring[130];
                new 
rand random(10000);
                
format(string120"[BANK ROBBERY] %s has robbed $%d from the Los Santos bank."PlayerInfo(i), rand);
                
SendClientMessageToAll(COLOR_LIGHTBLUEstring);
                
CNR_PrintString(string);
                
GivePlayerMoney(irand);
                
IncreaseScore(i3);
                   
format(tdstringsizeof(tdstring), "~g~+~g~~h~$~g~~h~~h~~h~%d"rand);
                 
PlayerTextDrawSetString(iWMoney[i], tdstring);
                   
PlayerTextDrawShow(iWMoney[i]);
                   
SetTimer("HideWM"70000);
                
format(string120"[DISPATCH] %s has robbed the Los Santos Bank. Respond now."PlayerInfo(i));
                
SendCopMessage(string);
                
format(string120"Type /radiooff to turn your radio off and stop recieving alerts.");
                
SendCopMessage(string);
                if(
IsPlayerAttachedObjectSlotUsed(ii)) RemovePlayerAttachedObject(ii);
                
PlayerTextDrawHide(iBANKR[i]);
                
AccountInfo[i][pRobbingBank] = 0;
                   if(
AccountInfo[i][pRobSkill] <= 3)
                {
                    
AccountInfo[i][pRobSkill] += 2;
                    
format(string120"[SKILL UPGRADE] Your robbing skill has increased. Read /robjob.");
                    
SendClientMessage(iCOLOR_GREYstring);
                }
            }
            if(
AccountInfo[i][pBankRobbed] > 1)
            {
                --
AccountInfo[i][pBankRobbedRecently];
            }
        }
    }
    return 
1;

Reply
#2

Change rand to rand1 or rand2
Reply
#3

Quote:
Originally Posted by GeekSiMo
Посмотреть сообщение
Change rand to rand1 or rand2
thank you man +rep
Reply
#4

Thank You !!!!
Reply
#5

The main reason why you are getting this is because you already have a global variable at the top of your gamemode got the same name, always to get rid of that warning change the variable name like what the user above me mentioned.
I hope I helped any feedback would be appreciated.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)