I've got 2 Warnings. - 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: I've got 2 Warnings. (
/showthread.php?tid=270425)
I've got 2 Warnings. -
Ben7544 - 20.07.2011
PHP код:
C:\Documents and Settings\gidon\щемзп дтбегд\VortexRoleplay.pwn(10105) : warning 219: local variable "Faction" shadows a variable at a preceding level
C:\Documents and Settings\gidon\щемзп дтбегд\VortexRoleplay.pwn(10111) : warning 213: tag mismatch
The command itself :
Код:
public LiteralFactionMessage(Faction, colour, string[])
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnectedEx(i))
{
if(Player[i][Faction] == Faction)
{
SendClientMessage(i, colour, string);
}
}
}
return 1;
}
Warning lines :
Line 10105:
Warning :
PHP код:
C:\Documents and Settings\gidon\щемзп дтбегд\VortexRoleplay.pwn(10105) : warning 219: local variable "Faction" shadows a variable at a preceding level
Line:
Код:
public LiteralFactionMessage(Faction, colour, string[])
Line 10111:
Warning:
PHP код:
C:\Documents and Settings\gidon\щемзп дтбегд\VortexRoleplay.pwn(10111) : warning 213: tag mismatch
Line :
Код:
if(Player[i][Faction] == Faction)
Re: I've got 2 Warnings. -
Jofi - 20.07.2011
You have defined "Factions" variable twice or more ( global and local ). It can be in includes.
You can rename "Factions" to something else..
Re: I've got 2 Warnings. -
Ben7544 - 20.07.2011
If I will ignore this warning, it might lead to serious bugs?
Re: I've got 2 Warnings. -
XGh0stz - 20.07.2011
Ignoring warnings usually don't lead to any bugs, but not a good habit to keep...
If it's within your power to stop a warning, should always do so
But no serious bug will come from it
Edit: Also, a tag mismatch means you either have too little or too many arguments, check the line it says it on...
(In your case, check the Player Function for the correct usage)
Oh this is a warning, this warning will lead to serious bugs, but not the first one, sorry...
Re: I've got 2 Warnings. -
Jofi - 20.07.2011
Why dont just rename it something like "factionid"
Re: I've got 2 Warnings. -
Ben7544 - 20.07.2011
Alright, fixed it up, thanks.