SA-MP Forums Archive
shadows a variable at a preceding level - 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: shadows a variable at a preceding level (/showthread.php?tid=284806)



shadows a variable at a preceding level - sherlock - 20.09.2011

What the hell does this mean? Cuz i just got a page full of these..


Re: shadows a variable at a preceding level - Stigg - 20.09.2011

It means your using some variables twice in your script.


Re: shadows a variable at a preceding level - Kush - 20.09.2011

This is usually the cause of global and local data types conflicting. Meaning, you have something declared most likely in a compound function, expression or statement in which the compiler doesn't know what do read it as!


Re: shadows a variable at a preceding level - Alureon - 20.09.2011

Example:
pawn Код:
public TestFunction()
{
    new test;
    if(Example)
    {
        new test;
        test = 1;
    }
}
Note the variable "test" to fix the error, take one of the variables out.


Re: shadows a variable at a preceding level - Kingunit - 20.09.2011

Quote:
Originally Posted by Alureon
Посмотреть сообщение
Example:
pawn Код:
public TestFunction()
{
    new test;
    if(Example)
    {
        new test;
        test = 1;
    }
}
Note the variable "test" to fix the error, take one of the variables out.
Very good example! Hope this will help him.


Re: shadows a variable at a preceding level - RobyRbb - 06.02.2017

Quote:
Originally Posted by Alureon
Посмотреть сообщение
Example:
pawn Код:
public TestFunction()
{
    new test;
    if(Example)
    {
        new test;
        test = 1;
    }
}
Note the variable "test" to fix the error, take one of the variables out.
You really helped me with this example, thx so much!


Re: shadows a variable at a preceding level - AndreiWow - 06.02.2017

Welcome back to life topic


Re: shadows a variable at a preceding level - SyS - 07.02.2017

Quote:
Originally Posted by AndreiWow
Посмотреть сообщение
Welcome back to life topic
there is no problem in that it shows that he is searching and not like other lazy people. And is also better than creating a whole new topic about same thing.


Re: shadows a variable at a preceding level - saffierr - 07.02.2017

Also this can be a cause of this error.
PHP код:
new hello;
public Function()
{
   new 
hello;
   
hello 1;
   return 
1;