SA-MP Forums Archive
idx problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: idx problem (/showthread.php?tid=350202)



idx problem - N0FeaR - 11.06.2012

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



Re: idx problem - JaTochNietDan - 11.06.2012

This warning simply means that a variable named "idx" is declared in the same scope more than once, for example:

pawn Код:
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?


Re: idx problem - N0FeaR - 11.06.2012

Quote:
Originally Posted by JaTochNietDan
Посмотреть сообщение
This warning simply means that a variable named "idx" is declared in the same scope more than once, for example:

pawn Код:
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.

pawn Код:
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;
}