1 warning
#1

for(new i = 0; i <= i; i++)

warning 219: local variable "i" shadows a variable at a preceding level
Reply
#2

You're already using the variable "i" in the same code.

Try this;

pawn Код:
for(new j = 0 j <= j; j++)
Whatever is in the loop you'll need to change them to "j" as well.
Reply
#3

C:\Users\sss\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(276) : warning 219: local variable "j" shadows a variable at a preceding level
C:\Users\sss\Desktop\Scripting tests\filterscripts\AntiCheat.pwn(276) : error 001: expected token: ";", but found "-identifier-"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.


PHP код:
       for(new 0 j <= jj++) // <<<<<<<<<<<
       
{
            
GetPlayerWeaponData(playeridjweapons[j][0], weapons[j][1]);
       } 
Reply
#4

Ah, sorry!
pawn Код:
for(new j = 0; j <= j; j++)
Also, it seems you're using "j" for something else as well.
Reply
#5

Dude, stop comparing the same variable with itself, it's really annoying. I thought you got it from the last topic. By the way, your mistake here is that you forgot another ';' after "j = 0". Here:
pawn Код:
for(new j = 0; j <= 12; j++) // j <= j means infinite loop, that's why i changed it into j <= 12 since there are only 12 weapon slots
       {
            GetPlayerWeaponData(playerid, j, weapons[j][0], weapons[j][1]);
       }
You know what that "for" loop says? It's something like this:
Код:
- Hey, let's set j to 0.
- Is j less or equal to j? Well, yes it is, because 0 is less or equal to 0. Good, then call GetPlayerWeaponData.
- We called GetPlayerWeaponData, now let's increase j by 1. j is 1 now.
- Is j less or equal to j? Well, yes it is, because 1 is less or equal to 1. Good, then call GetPlayerWeaponData.
- We called GetPlayerWeaponData, now let's increase j by 1. j is 2 now.
[...] TO INFINITY AND BEYOND. Never do this, you'll crash your server due to a huge CPU consumption.
Reply
#6

local variable "j" shadows a variable at a preceding level
Reply
#7

Where are you using the code? Cause that warning means the variable "j" is being used somewhere else in the same code.
Reply
#8

Quote:
Originally Posted by Stuun23
Посмотреть сообщение
local variable "j" shadows a variable at a preceding level
Ok, do this:
pawn Код:
for(new qzh = 0; qzh <= 12; qzh ++) // j <= j means infinite loop, that's why i changed it into qzh <= 12 since there are only 12 weapon slots
{
    GetPlayerWeaponData(playerid, qzh, weapons[qzh][0], weapons[qzh][1]);
}
I'm pretty sure you don't have any qzh variable.
Reply
#9

fixed, thanks
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)