Varible shown at a proceeding level
#1

ok ive een somone fix this error yesterday but i didnt watch how he did it anyway today i got this error for the first time in scripting what do it do

warning 219: local variable "string" shadows a variable at a preceding level
Reply
#2

It means that you've declared a variable named 'string' earlier before that declaration. You can just remove the 2nd declaration. Example.

pawn Код:
public MyFunction(playerid)
{
    new string[128];
    /*
        CODE HERE
    */

    new string[128];
    /*
        MORE CODE
    */

    return 1;
}
Would give a warning. This however...

pawn Код:
public MyFunction(playerid)
{
    new string[128];
    /*
        CODE HERE
    */

    return 1;
}

public MyOtherFunction(playerid)
{
    new string[128];
    /*
        CODE HERE
    */

    return 1;
}
Would not. The variable 'string's scope is limited to that function. Unless, of course you made it global by declaring outside any function.
Reply
#3

Lol i have like 30 of these im going to the script now ive found one thanks mate
Reply
#4

mate you are the very very very very very very best found all of them now thanks for your help
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)