Something strange with variables
#1

Hello,

I have strange problem with variable

I have is the public OnDialogResponse the following code:
Код:
if(dialogid == DIALOG_REGISTER){
new SData[24][64];
...
return 1;
}
if(dialogid == DIALOG_LOGIN){
new SData[24][64];
...
return 1;
}
now the problem is that it says
Код:
local variable "SData" shadows a variable at a preceding level
about the second new
why is it doing that?
Reply
#2

try renaming one of the variables
Reply
#3

Just a try, sometimes you cant add a new in that way. if you're using many that are the same they can get information from eachother even if they are in different {}.
pawn Код:
new SData[24][64];
if(dialogid == DIALOG_REGISTER){
...
return 1;
}
if(dialogid == DIALOG_LOGIN){
...
return 1;
}
Reply
#4

it happens when you declare a variable that was already declared before somewhere in your script.
Reply
#5

Ok thanks,
PAWN is strange
Reply
#6

This happens when only a global variable matches a local variable in your script. That's why you can use the same variables while making a lot of zcmds.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)