PDA

View Full Version : idx problem


N0FeaR
11/06/2012, 06:59 PM
I got huge problem with my script i get this can someone help me?

C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(10528) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(16975) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(17057) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(17165) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(17226) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(17314) : warning 219: local variable "idx" shadows a variable at a preceding level
C:\Users\Hellman\Desktop\Rebound Roleplay server\gamemodes\RGRP.pwn(17395) : warning 219: local variable "idx" shadows a variable at a preceding level

JaTochNietDan
11/06/2012, 07:06 PM
This warning simply means that a variable named "idx" is declared in the same scope more than once, for example:


new idx; // This variable carries into any statements below it that are within the same block of code

if(something == something)
{
new idx; // A variable with this name is already declared in this scope, hence you get a warning.
}

Does that make sense?

N0FeaR
11/06/2012, 07:10 PM
This warning simply means that a variable named "idx" is declared in the same scope more than once, for example:


new idx; // This variable carries into any statements below it that are within the same block of code

if(something == something)
{
new idx; // A variable with this name is already declared in this scope, hence you get a warning.
}

Does that make sense?

Yes, let me send all lines too.

here if one of them.

line 10528 stock GetPlayerItemInfo(playerid,&idx,ItemName[],len=sizeof(ItemName),&Amount)
{
if(idx>=MAX_ITEMS)return 0;
format(ItemName,len,_GetItemNamePVar(playerid,idx) );
Amount=_GetItemAmountPVar(playerid,idx);
idx++;
return 1;
}