multi-dimensional arrays must be fully initialized
#1

Hello hai, i'm making a little TDM Script, and was making random spawn for the both of teams but got error, and didn't find solution so i came to samp forums because it might help me

here is the code:


PHP код:
new Float:CopsRandomSpawns[4][3] =
{
    {
231.2603,161.5262,1003.0234},
    {
294.6489,183.2269,1007.1719},
    {
275.9243,182.4573,1007.1719}
Line 87 >>};
new 
Float:RacersRandomSpawns[4][3] =
{
    {
2630.0979,1824.9392,11.0234},
    {
2630.3567,1716.6747,11.0234},
    {
2597.3518,1897.6078,11.0312}
Line 95 >>}; 
And the Error:

PHP код:
C:\Users\Admin\Desktop\SAMP Releases\samp037_svr_R2-1-1_win32 (1)\gamemodes\TDM.pwn(87) : error 052multi-dimensional arrays must be fully initialized
C
:\Users\Admin\Desktop\SAMP Releases\samp037_svr_R2-1-1_win32 (1)\gamemodes\TDM.pwn(95) : error 052multi-dimensional arrays must be fully initialized 
Thanks in advance guys
Reply
#2

You just have to reduce the size of the first dimension (change it from 4 to 3)
like that
PHP код:
new Float:RacersRandomSpawns[3][3] = 

    {
2630.0979,1824.9392,11.0234}, 
    {
2630.3567,1716.6747,11.0234}, 
    {
2597.3518,1897.6078,11.0312
}; 
You have to be accurate using two dimensional arrays,

if you feel the need to add more data into that array, just put it this way
PHP код:
new Float:RacersRandomSpawns[][] = 

    {
2630.0979,1824.9392,11.0234}, 
    {
2630.3567,1716.6747,11.0234}, 
    {
2597.3518,1897.6078,11.0312
}; 
Don't bother defining a size of the array, and let the compiler calculate it instead

more info can be found here
https://sampforum.blast.hk/showthread.php?tid=318212
Reply
#3

Quote:
Originally Posted by Eoussama
Посмотреть сообщение
You just have to reduce the size of the first dimension (change it from 4 to 3)
like that
PHP код:
new Float:RacersRandomSpawns[3][3] = 

    {
2630.0979,1824.9392,11.0234}, 
    {
2630.3567,1716.6747,11.0234}, 
    {
2597.3518,1897.6078,11.0312
}; 
You have to be accurate using two dimensional arrays,

if you feel the need to add more data into that array, just put it this way
PHP код:
new Float:RacersRandomSpawns[][] = 

    {
2630.0979,1824.9392,11.0234}, 
    {
2630.3567,1716.6747,11.0234}, 
    {
2597.3518,1897.6078,11.0312
}; 
Don't bother defining a size of the array, and let the compiler calculate it instead

more info can be found here
https://sampforum.blast.hk/showthread.php?tid=318212
Okay, thank you oussama it's done
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)