Tag Mismatch Warning 2 - 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)
+--- Thread: Tag Mismatch Warning 2 (
/showthread.php?tid=458914)
Tag Mismatch Warning 2 -
ProjectMan - 19.08.2013
I want to get the size of enum, this is valid but it gives a warning
pawn Код:
enum test1
{
bla,
bla2,
bla3
}
new Test[MAX_PLAYERS][test1];
pawn Код:
for (new i = 0; i < test1; i++) // The line 1
{
if (Test[playerid][i] == 1) // The line 2
{
//blabla
}
}
I know that test1 = 3 but I put "test1" into
The line 1 because I don't want to change it every time I add or remove something from the enum. That gives me the tag missmatch warning. The same goes to
The line 2. How do I get rid of the warning? The code works by the way.
Re: Tag Mismatch Warning 2 -
avivelkayam - 19.08.2013
Quote:
Originally Posted by ProjectMan
I want to get the size of enum, this is valid but it gives a warning
pawn Код:
enum test1 { bla, bla2, bla3 }
new Test[MAX_PLAYERS][test1];
pawn Код:
for (new i = 0; i < test1; i++) // The line 1 { if (Test[playerid][i] == 1) // The line 2 { //blabla } }
I know that test1 = 3 but I put "test1" into The line 1 because I don't want to change it every time I add or remove something from the enum. That gives me the tag missmatch warning. The same goes to The line 2. How do I get rid of the warning? The code works by the way.
|
hello !
if you using enum you cant use the index as number
you can do this..
pawn Код:
new Test[MAX_PLAYERS][3];
pawn Код:
for (new i = 0; i < test1; i++) // The line 1
{
if (Test[playerid][i] == 1) // The line 2
{
//blabla
}
}
or if you still want the enum you can do like this:
pawn Код:
enum test1
{
bla1,
bla2,
bla3
}
new Test[MAX_PLAYERS][test1];
pawn Код:
for (new i = 0; i < test1; i++) // The line 1
{
new string[100];
format(string, sizeof(string), "bla%d", i + 1);
if (Test[playerid][string] == 1) // The line 2
{
//blabla
}
}
hope i helped you