SA-MP Forums Archive
Array tag mismatch - 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: Array tag mismatch (/showthread.php?tid=399405)



Array tag mismatch - thefatshizms - 14.12.2012

Hello, I'm trying to load all my map icons by an array but come across a lot of tag mismatches while trying to do it and I'm not sure how it's a tag mismatch.

pawn Код:
//map icons
new MapIcons[][] =
{
    {1, -2672.3062,260.3582,4.6328, 14, 0, MAPICON_LOCAL},
    {2, -2625.1279,211.0532,4.6379, 6, 0, MAPICON_LOCAL},
    {3, -2569.8640,244.8265,10.1505, 7, 0, MAPICON_LOCAL},
    {4, -1911.8213,831.1151,35.1749, 10, 0, MAPICON_LOCAL},
    {5, -1806.8922,943.1697,24.8915, 29, 0, MAPICON_LOCAL},
    {6, -2332.5122,-167.6378,35.5547, 10, 0, MAPICON_LOCAL},
    {7, -2648.7676,625.9666,14.4531, 22, 0, MAPICON_LOCAL},
    {8, -2267.5876,-154.7548,35.3203, 54, 0, MAPICON_LOCAL},
    {9, -2493.7827,-29.5148,25.7656, 45, 0, MAPICON_LOCAL},
    {10, -2245.1411,-88.3401,36.3377, 49, 0, MAPICON_LOCAL},
    {11, -2493.4409,-39.3892,25.7656, 39, 0, MAPICON_LOCAL},
    {12, -2714.6047,217.2768,4.2957, 27, 0, MAPICON_LOCAL},
    {13, -2553.3040,193.2317,6.1514, 48, 0, MAPICON_LOCAL},
    {14, -1605.5450,711.4048,13.8672, 30, 0, MAPICON_LOCAL},
    {15, -1886.2000,862.4730,35.1719, 45, 0, MAPICON_LOCAL},
    {16, -1698.6287,950.0814,24.8906, 45, 0, MAPICON_LOCAL},
    {17, -1754.1758,962.8541,24.8828, 32, 0, MAPICON_LOCAL},
    {18, -2047.1050,456.4027,35.1719, 52, 0, MAPICON_LOCAL},
    {19, -1904.4305,277.4406,41.0469, 63, 0, MAPICON_LOCAL},
    {20, -1974.6096,293.3269,35.1719, 55, 0, MAPICON_LOCAL},
    {21, -2023.1322,79.7627,28.1035, 20, 0, MAPICON_LOCAL}
};

//onplayerconnect
for(new i = 0;i <sizeof(MapIcons);i++) SetPlayerMapIcon(playerid, MapIcons[i][0], MapIcons[i][1], MapIcons[i][2], MapIcons[i][3], MapIcons[i][4], MapIcons[i][5], MapIcons[i][6]);



Re: Array tag mismatch - RajatPawar - 14.12.2012

Since all of them are MAPICONS_LOCAL why not try removing it and adding it in the 'for' statement? I think the problem lies there.


Re: Array tag mismatch - LarzI - 14.12.2012

You'll have to use an enumerator to store different data types into one single array.
You get a tag mismatch error because MapIcons is declared as an integer array, while you have not only integers, but floats too.

Here's how you could do it:

pawn Код:
enum iconInfo
{
    integer1,
    Float:1,
    Float:2,
    Float:3,
    integer2,
    integer3,
    //skip the last one as all your mapicons are local; there's no point including this in the array
};
then define map icons with the enumerator as the cell:
pawn Код:
new MapIcons[iconInfo] =
{ //your shit };



Re: Array tag mismatch - thefatshizms - 14.12.2012

That's not the problem.
EDIT: i'll try the enum


Re: Array tag mismatch - [HK]Ryder[AN] - 14.12.2012

try changing it to
pawn Код:
new MapIcons[][7] =
{
    {1, -2672.3062,260.3582,4.6328, 14, 0, MAPICON_LOCAL},
    {2, -2625.1279,211.0532,4.6379, 6, 0, MAPICON_LOCAL},
    {3, -2569.8640,244.8265,10.1505, 7, 0, MAPICON_LOCAL},
    {4, -1911.8213,831.1151,35.1749, 10, 0, MAPICON_LOCAL},
    {5, -1806.8922,943.1697,24.8915, 29, 0, MAPICON_LOCAL},
    {6, -2332.5122,-167.6378,35.5547, 10, 0, MAPICON_LOCAL},
    {7, -2648.7676,625.9666,14.4531, 22, 0, MAPICON_LOCAL},
    {8, -2267.5876,-154.7548,35.3203, 54, 0, MAPICON_LOCAL},
    {9, -2493.7827,-29.5148,25.7656, 45, 0, MAPICON_LOCAL},
    {10, -2245.1411,-88.3401,36.3377, 49, 0, MAPICON_LOCAL},
    {11, -2493.4409,-39.3892,25.7656, 39, 0, MAPICON_LOCAL},
    {12, -2714.6047,217.2768,4.2957, 27, 0, MAPICON_LOCAL},
    {13, -2553.3040,193.2317,6.1514, 48, 0, MAPICON_LOCAL},
    {14, -1605.5450,711.4048,13.8672, 30, 0, MAPICON_LOCAL},
    {15, -1886.2000,862.4730,35.1719, 45, 0, MAPICON_LOCAL},
    {16, -1698.6287,950.0814,24.8906, 45, 0, MAPICON_LOCAL},
    {17, -1754.1758,962.8541,24.8828, 32, 0, MAPICON_LOCAL},
    {18, -2047.1050,456.4027,35.1719, 52, 0, MAPICON_LOCAL},
    {19, -1904.4305,277.4406,41.0469, 63, 0, MAPICON_LOCAL},
    {20, -1974.6096,293.3269,35.1719, 55, 0, MAPICON_LOCAL},
    {21, -2023.1322,79.7627,28.1035, 20, 0, MAPICON_LOCAL}
};

//onplayerconnect
for(new i = 0;i <sizeof(MapIcons);i++) SetPlayerMapIcon(playerid, MapIcons[i][0], MapIcons[i][1], MapIcons[i][2], MapIcons[i][3], MapIcons[i][4], MapIcons[i][5], MapIcons[i][6]);



Re: Array tag mismatch - LarzI - 14.12.2012

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
try changing it to
pawn Код:
//code
Will still return an error as there's both integers and floats stored. At least it does that for me.


Re: Array tag mismatch - thefatshizms - 14.12.2012

Okay, I've done the enum there is a lot less warnings but seems I'm still getting some on the loading part, maybe ive done something wrong lol?

pawn Код:
for(new i = 0;i <sizeof(MapIcons);i++) SetPlayerMapIcon(playerid, MapIcons[i][0], MapIcons[i][1], MapIcons[i][2], MapIcons[i][3], MapIcons[i][4], MapIcons[i][5], MAPICON_LOCAL);

new MapIcons[][IconsInfo] =
{
    {1, -2672.3062,260.3582,4.6328, 14, 0},
    {2, -2625.1279,211.0532,4.6379, 6, 0},
    {3, -2569.8640,244.8265,10.1505, 7, 0},
    {4, -1911.8213,831.1151,35.1749, 10, 0},
    {5, -1806.8922,943.1697,24.8915, 29, 0},
    {6, -2332.5122,-167.6378,35.5547, 10, 0},
    {7, -2648.7676,625.9666,14.4531, 22, 0},
    {8, -2267.5876,-154.7548,35.3203, 54, 0},
    {9, -2493.7827,-29.5148,25.7656, 45, 0},
    {10, -2245.1411,-88.3401,36.3377, 49, 0},
    {11, -2493.4409,-39.3892,25.7656, 39, 0},
    {12, -2714.6047,217.2768,4.2957, 27, 0},
    {13, -2553.3040,193.2317,6.1514, 48, 0},
    {14, -1605.5450,711.4048,13.8672, 30, 0},
    {15, -1886.2000,862.4730,35.1719, 45, 0},
    {16, -1698.6287,950.0814,24.8906, 45, 0},
    {17, -1754.1758,962.8541,24.8828, 32, 0},
    {18, -2047.1050,456.4027,35.1719, 52, 0},
    {19, -1904.4305,277.4406,41.0469, 63, 0},
    {20, -1974.6096,293.3269,35.1719, 55, 0},
    {21, -2023.1322,79.7627,28.1035, 20, 0}
};



Re: Array tag mismatch - LarzI - 14.12.2012

Don't do MapIcons[i][0], but the name of the identifier in the enum. "[0]" should be changed to whatever's on top in the enum. In my example, that would be "MapIcons[i][integer1]"


Re: Array tag mismatch - thefatshizms - 14.12.2012

Ohh oke thanks

EDIT: /cry i cant give you rep because i already given you it some other time


Re: Array tag mismatch - maramizo - 14.12.2012

pawn Код:
enum IconsType
{
    Float:coords[3],
    markertype
}

new MapIcons[][IconsType] =
{
    {-2672.3062,260.3582,4.6328, 14},
    {-2625.1279,211.0532,4.6379, 6},
    {-2569.8640,244.8265,10.1505, 7},
    {-1911.8213,831.1151,35.1749, 10},
    {-1806.8922,943.1697,24.8915, 29},
    {-2332.5122,-167.6378,35.5547, 10},
    {-2648.7676,625.9666,14.4531, 22},
    {-2267.5876,-154.7548,35.3203, 54},
    {-2493.7827,-29.5148,25.7656, 45},
    {-2245.1411,-88.3401,36.3377, 49},
    {-2493.4409,-39.3892,25.7656, 39},
    {-2714.6047,217.2768,4.2957, 27},
    {-2553.3040,193.2317,6.1514, 48},
    {-1605.5450,711.4048,13.8672, 30},
    {-1886.2000,862.4730,35.1719, 45},
    {-1698.6287,950.0814,24.8906, 45},
    {-1754.1758,962.8541,24.8828, 32},
    {-2047.1050,456.4027,35.1719, 52},
    {-1904.4305,277.4406,41.0469, 63},
    {-1974.6096,293.3269,35.1719, 55},
    {-2023.1322,79.7627,28.1035, 20}
};
for(new i = 0;i <sizeof(MapIcons);i++)
{
    SetPlayerMapIcon(playerid, i, MapIcons[i][0], MapIcons[i][1], MapIcons[i][2], MapIcons[i][3], 0, MAPICON_LOCAL);
}
edit:

Lol too late.