Index tag mismatch
#1

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];
Reply
#2

Wupps , i read the topic a bit wrong .How about you use a loop to assign the values to the array you made?
Reply
#3

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.
Reply
#4

PHP код:
memcpy(_:a,_:Foo[0][WTF],0,12); 
Reply
#5

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")
}
Reply
#6

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], 0sizeof(Hack[])*4); 
or
You can always use a dummy array
PHP код:
new playerid;
new 
tmp[HACK_Enum]; 
Hack[playerid] = tmp
Reply
#7

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.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)