yom buttons
#1

Код:
C:\Users\aa\Desktop\Server\pawno\include\yom_buttons.inc(99) : warning 219: local variable "Speed" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Warning.
PHP код:
stock GetButtonPos(buttonid, &Float:X, &Float:Y, &Float:Z, &Float:Angle 0.0)
{
    new 
objectid GetButtonObjectID(buttonid);
    
GetObjectPos(objectidXYZ);
    
GetObjectRot(objectidAngleAngleAngle);
}
stock SetButtonPos(buttonidFloat:XFloat:YFloat:ZFloat:Angle 0.0)
    return 
CallRemoteFunction("FS_SetButtonPos""iffff"buttonidXYZAngle); 
Reply
#2

Hello.
Whenever you get the warning:
Quote:

warning 219: local variable "VARIABLE NAME GOES HERE" shadows a variable at a preceding level

It basically means you have one variable active with the name between the ""s, in this case it's speed, and then at the same time, another variable active with the same name.

Go to line 99 and you will find that you are creating a new variable with the name speed, but somewhere before that you have already created a variable with the same name and it's still being used.
You either need to rename one of the variables, and whenever it's used, or if you are done using the variable when you're creating it a second time, just update it's value rather than re-create it.

e.g.
pawn Код:
new speed;//This can be accessed anywhere in the script (it's a global variable)

MyFunction(){
    new speed;//This can only be accessed within the function "MyFunction"
    //As there is a global variable with the same name, you will get a warning
}
MyOtherFunction(speed){
    //Here you will get a warning because the function is creating a variable with the name speed to store it's parameter
    if(some condition){
        new speed;
        //Here you will get another warning as there are two variables with the same name still in use
    }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)