SA-MP Forums Archive
5 warnings << unreachable code / warning variable - 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: 5 warnings << unreachable code / warning variable (/showthread.php?tid=655454)



5 warnings << unreachable code / warning variable - DavidGravelli - 21.06.2018

i have warnings in my script here is the code:

4 warnings -
pawn Код:
WARNINGS LIST:

pawno\include\YSI\..\YSI_Coding\y_va/impl.inc(539) : warning 219: local variable "time" shadows a variable at a preceding level
pawno\include\YSI\..\YSI_Coding\y_va/impl.inc(544) : warning 219: local variable "time" shadows a variable at a preceding level
pawno\include\YSI\..\YSI_Coding\y_timers/impl.inc(84) : warning 219: local variable "time" shadows a variable at a preceding level
pawno\include\evf.inc(2059) : warning 219: local variable "time" shadows a variable at a preceding level

warning: 1336 line << unreachable code >>

pawn Код:
1336 if(!IsPlayerInRangeOfPoint(playerid, 2, PhoneStoreEntrance[0], PhoneStoreEntrance[1], PhoneStoreEntrance[2]))                         

1337           GetPlayerPos(playerid, pRestorePos[playerid][0], pRestorePos[playerid][1], pRestorePos[playerid][2]);
1338            GetPlayerFacingAngle(playerid, pRestorePos[playerid][3]);
1339        pRestorePos[playerid][3] = ((_:pRestorePos[playerid][3]+180) % 360);



Re: 5 warnings << unreachable code / warning variable - coool - 22.06.2018

warning 219: local variable "time" shadows a variable at a preceding level

This means you have a global or semi-global(idk how to say it) variable named "time". Just rename your variable.

Unreachable code, this means that the code will never be executed, are you using `return` just above the code?