SA-MP Forums Archive
A stupid annoying warning. - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: A stupid annoying warning. (/showthread.php?tid=258376)



A stupid annoying warning. - nuriel8833 - 30.05.2011

Hello all
Today I have madea tiny script,I won't give any details,but during the preparations I got a warning which I can not get rid of:
pawn Код:
warning 219: local variable "min" shadows a variable at a preceding level
For those lines:
pawn Код:
new year,month,day,hour,min,sec; //The warning is for this line
gettime(hour,min,sec);
getdate(year,month,day);
Can someone please help me?
Thanks and have a good day


Re: A stupid annoying warning. - Babul - 30.05.2011

you are simply using the variable "min" somewhere else in your script (most prolly a global variable). by renaming (all) of your date variables should solve it:
Код:
new Tyear,Tmonth,Tday,Thour,Tmin,Tsec;
gettime(Thour,Tmin,Tsec);
getdate(Tyear,Tmonth,Tday);
the "T" will make the time variables unique. feel free to change that ugly T to a different char ^^
edit: just noticed its the native min(value1,value2) is causing it...


Re: A stupid annoying warning. - nuriel8833 - 30.05.2011

Quote:
Originally Posted by Babul
Посмотреть сообщение
you are simply using the variable "min" somewhere else in your script (most prolly a global variable). by renaming (all) of your date variables should solve it:
Код:
new Tyear,Tmonth,Tday,Thour,Tmin,Tsec;
gettime(Thour,Tmin,Tsec);
getdate(Tyear,Tmonth,Tday);
the "T" will make the time variables unique. feel free to change that ugly T to a different char ^^
lol I don't want to,I like the T
Although I have just checked and there is no "min" variable in my script


Re: A stupid annoying warning. - Babul - 30.05.2011

argh youre too fast! if you would have used "max" as minutes timer, the same would have happened too.
its the natives like min, max.
plop