SA-MP Forums Archive
3 warnings whats wrong with this code? - 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: 3 warnings whats wrong with this code? (/showthread.php?tid=89214)



3 warnings whats wrong with this code? - killdahobo99 - 31.07.2009

I get 3 warnings in this soon to be GM, Whats wrong with it?

Heres the pastebin:

Код:
http://pastebin.com/m29941964
Код:
C:\Documents and Settings\Anuj_2\Desktop\samp02Xserver.win32\pawno\include\utils.inc(1) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Anuj_2\Desktop\samp02Xserver.win32\gamemodes\fagget.pwn(424) : warning 219: local variable "string" shadows a variable at a preceding level
C:\Documents and Settings\Anuj_2\Desktop\samp02Xserver.win32\gamemodes\fagget.pwn(464) : warning 219: local variable "string" shadows a variable at a preceding level
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


3 Warnings.



Re: 3 warnings whats wrong with this code? - zombie13333 - 01.08.2009

rename all of the "string" In your gamemode to "string2", and the warnings should be gone XD


Re: 3 warnings whats wrong with this code? - [Hun]Ricsi - 01.08.2009

You are lot of declared the "string".


Sorry, i'am speak in English but low.


Re: 3 warnings whats wrong with this code? - Correlli - 01.08.2009

Global variable has the same name as local variable, rename it.


Re: 3 warnings whats wrong with this code? - Lazarus - 01.08.2009

You have defined string here, on line 59:
pawn Код:
new string[100];
As a global variable. That means it will be defined and work anywhere in the script.

But on line 464, your defining it again:
pawn Код:
new string[50];
And again, in strtok:
pawn Код:
strtok(const string[], &index)
Use this:
http://pastebin.com/m66ae1bdf