open.mp forum
[Pawn] warning 219: local variable "i" shadows a variable at a preceding level - Printable Version

+ open.mp forum (https://forum.open.mp)
-- Forum: SA-MP (https://forum.open.mp/forumdisplay.php?fid=3)
--- Forum: Pawn Scripting (https://forum.open.mp/forumdisplay.php?fid=10)
--- Thread: [Pawn] warning 219: local variable "i" shadows a variable at a preceding level (/showthread.php?tid=1653)



warning 219: local variable "i" shadows a variable at a preceding level - Zett0x - 2021-02-09

There is not any global variable i, you know how to solve this warning? its annoying.


RE: warning 219: local variable "i" shadows a variable at a preceding level - Pinch - 2021-02-09

Probably in a 3rd party library you added before getting this warning


RE: warning 219: local variable "i" shadows a variable at a preceding level - Zett0x - 2021-02-09

(2021-02-09, 02:18 AM)Pinch Wrote: Probably in a 3rd party library you added before getting this warning

Its strange. When i compile with pawno it doesnt appear. But if i compile the pwn file with sublime text it appear.


RE: warning 219: local variable "i" shadows a variable at a preceding level - Chessy - 2021-02-09

(2021-02-09, 04:46 AM)Zett0x Wrote:
(2021-02-09, 02:18 AM)Pinch Wrote: Probably in a 3rd party library you added before getting this warning



Its strange. When i compile with pawno it doesnt appear. But if i compile the pwn? file with sublime text it appear.



Looks like the directory of the pawncc.exe for sublime text is different to the one in your gamemode. Check that.


RE: warning 219: local variable "i" shadows a variable at a preceding level - Zett0x - 2021-02-09

(2021-02-09, 02:18 AM)Pinch Wrote: Probably in a 3rd party library you added before getting this warning



(2021-02-09, 05:21 PM)Chessy Wrote:
(2021-02-09, 04:46 AM)Zett0x Wrote:
(2021-02-09, 02:18 AM)Pinch Wrote: Probably in a 3rd party library you added before getting this warning



Its strange. When i compile with pawno it doesnt appear. But if i compile the pwn? file with sublime text it appear.



Looks like the directory of the pawncc.exe for sublime text is different to the one in your gamemode. Check that.



No, it is the same directory, and the same compiler. When i use sublime text for compiling x.pwn, the warning appear, when i use the compiler with cmd (pawncc.exe x.pwn) the error appear BUT when i used the old IDE pawno(in the same directory of the project), that error doesnt appear.



I tried to replace "i" for "index",(control) and the error appear again(warning 219: local variable "index" shadows a variable at a preceding level). I don?t know what is happening.?

Someone can help me?

The other warnings that i have is :?warning 213: tag mismatch: expected tags "Float", or none ("_"); but found "PlayerText" BECAUSE:



<

Quote:new PlayerText:drawid=CreatePlayerTextDraw(playerid,100.0,100.0,"Cargando texturas...");

? ? PlayerTextDrawShow(playerid,drawid);

SetTimerEx("spawn",3000,0,"di",playerid,drawid);





How can in pass a PlayerText tipe in the SetTimerEx? im starting to think that i have to ignore this strange warnings.


RE: warning 219: local variable "i" shadows a variable at a preceding level - Kwarde - 2021-02-10

Quote:he other warnings that i have is : warning 213: tag mismatch: expected tags "Float", or none ("_"); but found "PlayerText" BECAUSE:
Note the definition of function SetTimerEx:
Code:
native SetTimerEx(funcname[], interval, repeating, const format[], /*>>*/{Float,_}:/*<<*/...);
Just like the warning says, it expects either a variable with tag none (_) or Float. Either change the definition of the function or force pass it with no tag (that is what you should do)
Code:
SetTimerEx("spawn", 3000, 0, "ii", playerid, _:drawid);