Waring.... Weee... - 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: Waring.... Weee... (
/showthread.php?tid=163821)
Waring.... Weee... -
robert4049 - 29.07.2010
How can i get rid of the error?
Код:
C:\Users\Robert\Desktop\VortexRoleplay\gamemodes\VortexRoleplay.pwn(9789) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
1 Warning.
pawn Код:
new pname[MAX_PLAYER_NAME], string[22 + MAX_PLAYER_NAME];
GetPlayerName(playerid, pname, sizeof(pname));
format(string, sizeof(string), "%s has joined the server", pname);
SendClientMessageToAll(0xAAAAAAAA, string);
Re: Waring.... Weee... -
Rocky Balboa - 29.07.2010
there may be two , new string[22+MAX_PLAYER_NAME]; in the same callback , or what ever that is called
Re: Waring.... Weee... -
Carlton - 29.07.2010
pawn Код:
new pname[MAX_PLAYER_NAME], stringz[46];
GetPlayerName(playerid, pname, sizeof(pname));
format(stringz, sizeof(stringz), "%s has joined the server", pname);
SendClientMessageToAll(0xAAAAAAAA, stringz);
You created the variable string twice, make sure you don't fall for that again.
Re: Waring.... Weee... -
Las Venturas CNR - 29.07.2010
Try just using
pawn Код:
new string[64], pName[MAX_PLAYER_NAME];
GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
format(string,sizeof string,"%s has joined the server.",pName);
SendClientMessageToAll(0xFFFFFFAA,string);
Re: Waring.... Weee... -
Carlton - 29.07.2010
Quote:
Originally Posted by Las Venturas CNR
Try just using
pawn Код:
new string[64], pName[MAX_PLAYER_NAME]; GetPlayerName(playerid,pName,MAX_PLAYER_NAME); format(string,sizeof string,"%s has joined the server.",pName); SendClientMessageToAll(0xFFFFFFAA,string);
|
That wouldn't work because you're still making the error occur.
Re: Waring.... Weee... -
Las Venturas CNR - 29.07.2010
Quote:
Originally Posted by Carlton
That wouldn't work because you're still making the error occur.
|
Huh...? Umm... wonder why thats on Wiki then, strange...
go to
https://sampwiki.blast.hk/wiki/OnPlayerConnect and look at the example, lol.
Re: Waring.... Weee... -
Carlton - 29.07.2010
Quote:
Originally Posted by Las Venturas CNR
|
If you know what the warning means then don't reply, but obviously you don't. It means you defined a variable twice. He used string twice in a callback. That wiki link has
Nothing to do with this solving this.
Re: Waring.... Weee... -
Las Venturas CNR - 29.07.2010
Quote:
Originally Posted by Carlton
If you know what the warning means then don't reply, but obviously you don't. It means you defined a variable twice. He used string twice in a callback. That wiki link has Nothing to do with this solving this.
|
I misread something. Sorry, please excuse me...
Re: Waring.... Weee... -
John_F - 29.07.2010
You have 2 of the same variable.
Delete the 1 on the lowest level, AKA the 1 that is pointed out by the warning.