SA-MP Forums Archive
Help warning on string2 - 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: Help warning on string2 (/showthread.php?tid=340962)



Help warning on string2 - lonako45 - 09.05.2012

this is the line
PHP код:
stock SendHelpersMessage(color,const string2[]) 
Why have warning ??
PHP код:
 warning 219local variable "string2" shadows a variable at a preceding level 



Re: Help warning on string2 - Vince - 09.05.2012

Because that variable is defined at a higher level. The warning is pretty clear. You have something like;
pawn Код:
new string2[128];

// later
stock SendHelpersMessage(color,const string2[])



Re: Help warning on string2 - lonako45 - 09.05.2012

I try this ..
I try 50 60 70 10
all !
and warning ..


Re: Help warning on string2 - lonako45 - 09.05.2012

HELP please?


Re: Help warning on string2 - DarrenRhoads - 09.05.2012

Go onto your script and press ctrl+F. Then type "String2". You will find something similar to:

Код:
new string2[128];
DELETE IT and try again.

Vince made it quiet clear as well as the warning itself!


Re: Help warning on string2 - lonako45 - 09.05.2012

WHAT !?
I delete new string2[180];
and now :
undefined symbol "string2"


Re: Help warning on string2 - DarrenRhoads - 09.05.2012

Okay..

1) just put back the "new string2" which you deleted..
2) change the name of "string2" on:

pawn Код:
stock SendHelpersMessage(color,const string2[])
maybe change it to?

pawn Код:
stock SendHelpersMessage(color,const string234[])
3) Change all the "string2" names in the stock to "string234" (or w/e you put as the variable name)


Re: Help warning on string2 - lonako45 - 09.05.2012

Warning ..
WHy?!?!?


Re: Help warning on string2 - aco_SRBIJA - 09.05.2012

Well, u can't add global variables into functions headers. Dont do anything, just do this

pawn Код:
stock SendHelpersMessage(color,string[])
{
       //..make what should it do
}



Re: Help warning on string2 - [ABK]Antonio - 09.05.2012

Quote:
Originally Posted by lonako45
Посмотреть сообщение
WHAT !?
I delete new string2[180];
and now :
undefined symbol "string2"
Delete string2, get the line of that undefined symbol...ctrl+g enter the line number, above it somewhere inside the same function, add new string2[180]. Then go back to where you're doing your message thing and add the new string.

So, delete the global variable
add it locally on the functions that need it.