Index 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: Index tag mismatch (
/showthread.php?tid=641489)
Index tag mismatch -
Misiur - 16.09.2017
I feel a lil' stupid right now, but I have a simple question:
pawn Код:
enum Test {
Float:WTF[3]
}
new Foo[5][Test];
main() {
new Float:a[3];
a = Foo[0][WTF]; // index tag mismatch
}
How to solve this? I know I can assign one by one, don't write me that, I just want to get array reference. I've tried:
pawn Код:
a = Float:(Foo[0][WTF]);
// and
a = Foo[0][Float:WTF];
// and
a = Foo[0][WTF][0];
Re: Index tag mismatch -
Silentx9 - 16.09.2017
Wupps , i read the topic a bit wrong .How about you use a loop to assign the values to the array you made?
Re: Index tag mismatch -
Meller - 16.09.2017
That's not what he asked for, he even stated that.. Jesus!
Quote:
I know I can assign one by one, don't write me that
|
Plus, why even bother using a loop for 3 variables? That's ridiculous.. Don't respond to shit by guessing people.
Re: Index tag mismatch -
SyS - 17.09.2017
PHP код:
memcpy(_:a,_:Foo[0][WTF],0,12);
Re: Index tag mismatch -
GaByM - 06.01.2018
Sorry for bump, but I have kinda the same problem
Код:
enum HACK_Enum
{
LastX,
LastY,
LastZ,
TimePlayed,
LastUpdate,
LastMove
}
static Hack[MAX_PLAYERS+1][HACK_Enum];
main()
{
new playerid;
memcpy(Hack[playerid], Hack[MAX_PLAYERS], 0, sizeof(Hack[])*4);
// 2x index tag mismatch (symbol "Hack")
}
Re: Index tag mismatch -
SyS - 06.01.2018
Quote:
Originally Posted by GaByM
Sorry for bump, but I have kinda the same problem
Код:
enum HACK_Enum
{
LastX,
LastY,
LastZ,
TimePlayed,
LastUpdate,
LastMove
}
static Hack[MAX_PLAYERS+1][HACK_Enum];
main()
{
new playerid;
memcpy(Hack[playerid], Hack[MAX_PLAYERS], 0, sizeof(Hack[])*4);
// 2x index tag mismatch (symbol "Hack")
}
|
Mostly because having an enumeration as index (not specifying the constant) .
define the array like this
PHP код:
static Hack[MAX_PLAYERS+1][_:HACK_Enum];
//and use this
memcpy(Hack[playerid], Hack[MAX_PLAYERS], 0, sizeof(Hack[])*4);
or
You can always use a dummy array
PHP код:
new playerid;
new tmp[HACK_Enum];
Hack[playerid] = tmp;
Re: Index tag mismatch -
GaByM - 06.01.2018
Quote:
Originally Posted by SyS
PHP код:
new playerid;
new tmp[HACK_Enum];
Hack[playerid] = tmp;
|
Thank you! I think the second version is more useful because it let you add tags inside the enum without getting other warnings.