Something strange with variables - 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: Something strange with variables (
/showthread.php?tid=343266)
Something strange with variables -
NickName3 - 16.05.2012
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?
Re: Something strange with variables -
a!DaN)_)-) - 16.05.2012
try renaming one of the variables
Re: Something strange with variables -
HDFord - 16.05.2012
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;
}
Re: Something strange with variables -
Mandrakke - 16.05.2012
it happens when you declare a variable that was already declared before somewhere in your script.
Re: Something strange with variables -
NickName3 - 16.05.2012
Ok thanks,
PAWN is strange
Re: Something strange with variables -
ReneG - 16.05.2012
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.