SA-MP Forums Archive
Warning xD - 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: Warning xD (/showthread.php?tid=247450)



Warning xD - wheelman_WM - 09.04.2011

Код:
if(strcmp(cmd, "/help", true) == 0)
	{
        new string[768];
    	new message[] = "BLALA ;
		new message2[] = \NLABLA"\n 
		format(string, sizeof(string),"%s %s",message,message2);
		ShowPlayerDialog(playerid, 1244, DIALOG_STYLE_MSGBOX,"",string,"Okay","");
		return 1;
}
Warning

Код:
C:\Users\Bhupesh\Desktop\my new\Gamemodes\lvdm.pwn(928) : warning 219: local variable "string" shadows a variable at a preceding level
How to fix it


Re: Warning xD - BizzyD - 09.04.2011

You have two strings defined or how to call it. search for string


Re: Warning xD - gamer931215 - 09.04.2011

Quote:
Originally Posted by AlexzzPro
Посмотреть сообщение
You have two strings defined or how to call it. search for string
Depends on what you mean, if it "shadows a variable" you probaly have already a string in an Enum.

Try renaming string in the enum to _string to avoid these problems.



Edit: WHY are you using two strings (one with undefined size) and one with the redicilous size of 765.
One string of 128 should be enough, also you cannot use new 'message[128] = "test";'
this should be:
pawn Код:
new message[128];
format(message,sizeof message,"blabla");



Re: Warning xD - wheelman_WM - 09.04.2011

Код:
	new string[256];
shit its defined on command text and it 2 whihc should i use


Re: Warning xD - und3rcore - 09.04.2011

WOW your string is way too big


Re: Warning xD - wheelman_WM - 09.04.2011

fixed thanks


Re: Warning xD - tanush - 09.04.2011

ok sister, remove new string[765];


Re: Warning xD - BizzyD - 09.04.2011

Yea, If you got in OnPlayerCommandText. You dont need to define it again.

And its way to big