SA-MP Forums Archive
60+ warning - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: 60+ warning (/showthread.php?tid=200157)



60+ warning - Jack_Blade - 17.12.2010

I have 65 warnings.
They all look like this.
How can i fix these?

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


Re: 60+ warning - WillyP - 17.12.2010

You already have 'string' defined.


Re: 60+ warning - Mauzen - 17.12.2010

Let me guess, the warning lines point to lines in your OnPlayerCommandText callback?
remove the "new string[...]; " from all your commands, and check if you already have that line at the beginning of the callback.


Re: 60+ warning - blackwave - 17.12.2010

Quote:
Originally Posted by Jack_Blade
Посмотреть сообщение
I have 65 warnings.
They all look like this.
How can i fix these?

warning 219: local variable "string" shadows a variable at a preceding level
warning 219: local variable "string" shadows a variable at a preceding level
Just remove the
pawn Код:
new string[128];
Upon OnGameModeInit/OnFilterScriptInit.

Cause you redefine them each command, then you had to remove the global one.


Re: 60+ warning - Jack_Blade - 17.12.2010

Mkay, i removed there, but i didn't know how to remove from here "string"

1) public Encrypt(string[])
{
for(new x=0; x < strlen(string); x++)
{
string[x] += (3^x) * (x % 15);
if(string[x] > (0xff))
{
string[x] -= 256;
}
}
return 1;
}
2) stock asd(string[], format[], {Float,_}:...)
3)public CKLog(string[])
4)public PayLog(string[])
5)public KickLog(string[])
6)public BanLog(string[])
7)strtok(const string[], &index)
public BroadCast(color,const string[])
9)public ABroadCast(color,const string[],level)
10)public OOCOff(color,const string[])
11)public OOCNews(color,const string[])
12)public SendIRCMessage(channel, color, string[])


Re: 60+ warning - blackwave - 17.12.2010

No... I mean remove the string:

pawn Код:
new string[128]; // <<<<<< THIS ONE



Re: 60+ warning - Jack_Blade - 17.12.2010

and whatabout the others strings?


Re: 60+ warning - blackwave - 17.12.2010

Quote:
Originally Posted by Jack_Blade
Посмотреть сообщение
and whatabout the others strings?
...


Remove the one on the top. Forget the other.


Re: 60+ warning - Mauzen - 17.12.2010

look at the top of your script. there should be a
new string[...];
somewhere. Its not in a function, but at the first intendation level (if you have)

Remove that one, not the others.


Re: 60+ warning - Jack_Blade - 17.12.2010

public LottoTimer()
{
for(new playerid=0;playerid<=MAX_PLAYERS;playerid++)
{
if(IsPlayerConnected(playerid))
{
line 3782 -- format(string, sizeof(string), "Lottery news: Lets start with loto.");
OOCOff(COLOR_WHITE, string);
new rand = random(80);
if(rand < 77) { rand += 3; }
Lotto(rand);
}
return 1;
}
}

(3782) : error 017: undefined symbol "string"
(3782) : error 017: undefined symbol "string"
(3782) : error 029: invalid expression, assumed zero
(3782) : fatal error 107: too many error messages on one line

Did like blackwave told..