3-D Array Problem [+REP]
#1

pawn Код:
new Float:spawnPoint [] [] [] =
{
    {   //[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
    },
    {   //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
    },
    {   //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
    }
};

main()
{
    new num;
    for(new i=0; i < sizeof spawnPoint; i++)
    {
        for(new d=0; d < sizeof spawnPoint[]; d++)
        {
            num++;
            printf("SPAWN(%i): %f, %f, %f", num, spawnPoint[i][d][0], spawnPoint[i][d][1], spawnPoint[i][d][2]);
        }
    }
}
Reply
#2

I think it should be like this?

pawn Код:
for(new i=0; i < sizeof(spawnPoint); i++)
    {
        for(new d=0; d < sizeof(spawnPoint[]); d++)
        {
            num++;
            printf("SPAWN(%i): %f, %f, %f", num, spawnPoint[i][d][0], spawnPoint[i][d][1], spawnPoint[i][d][2]);
        }
    }
Reply
#3

Quote:
Originally Posted by Universal
Посмотреть сообщение
I think it should be like this?

pawn Код:
for(new i=0; i < sizeof(spawnPoint); i++)
    {
        for(new d=0; d < sizeof(spawnPoint[]); d++)
        {
            num++;
            printf("SPAWN(%i): %f, %f, %f", num, spawnPoint[i][d][0], spawnPoint[i][d][1], spawnPoint[i][d][2]);
        }
    }
That's not the problem mate.
Reply
#4

wait my bad didnt read full code
Reply
#5

I dont think there is any mistake here.
Reply
#6

Quote:
Originally Posted by DRIFT_HUNTER
Посмотреть сообщение
wait my bad didnt read full code
That's not a problem. Instead it will create a new problem for the assertion.
Reply
#7

Hey T0pAz,
the problem is
pawn Код:
new Float:spawnPoint [] [] [] =
{
    {   //[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
    },
    {   //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
    },
    {   //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
    }
};
In this code.
In the starting u can't do
pawn Код:
{   //[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
    },
    {   //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
    },
    {   //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
    }
To make it work either do it like
pawn Код:
//[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
   
     //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
   
      //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
And the rest of the code.
Reply
#8

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
Hey T0pAz,
the problem is
pawn Код:
new Float:spawnPoint [] [] [] =
{
    {   //[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
    },
    {   //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
    },
    {   //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
    }
};
In this code.
In the starting u can't do
pawn Код:
{   //[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
    },
    {   //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
    },
    {   //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
    }
To make it work either do it like
pawn Код:
//[0][*][*]
        {155.55, 255.55, 355.55}, //[0][0][*]
        {544.44, 344.44, 124.44}, //[0][1][*]
        {256.56, 356.56, 156.56}  //[0][2][*]
   
     //[1][*][*]
        {158.88, 258.88, 358.88}, //[1][0][*]
        {264.64, 364.64, 164.64}, //[1][1][*]
        {236.36, 336.36, 136.36}  //[1][2][*]
   
      //[2][*][*]
        {195.95, 295.95, 395.95}, //[2][0][*]
        {594.94, 394.94, 194.94}, //[2][1][*]
        {296.56, 396.56, 196.56}  //[2][2][*]
And the rest of the code.
Sorry, that's not what I'm trying to achieve.
Reply
#9

But the way you are typing it will never work.(I think)
If you need help check this thread https://sampforum.blast.hk/showthread.php?tid=318212
Reply
#10

Quote:
Originally Posted by [HK]Ryder[AN]
Посмотреть сообщение
But the way you are typing it will never work.(I think)
If you need help check this thread https://sampforum.blast.hk/showthread.php?tid=318212
It has to work. There should be a thing, I'm missing.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)