enum, adminCMDS[n][n] = { }....
#1

Hey guys,

could somebody explain me that problem? Because I really can't get through that...

Thank you.

Btw. I tried to recount it, change numbers, ... well, nothing happened.

PHP Code:
#define         ACMDS                   24
enum ACMDPROPERTIES{
    
acmdACCESS,
    
acmdCMD     [16],
    
acmdHELP    [32]
}
new 
adminCMD[ACMDS][ACMDPROPERTIES] = {
    { 
1,     "#"                    ,             "[TEXT]"                                                                     },
    { 
3,     "/answer"            ,             "[Q-ID] [MSG]"                                                                 },
    { 
3,     "/questions"        ,             " "                                                                         },
    { 
5,     "/asay"                ,             "[MSG]"                                                                     },
    { 
7,     "/ainfo"            ,             "[P-ID]"                                                                     },
    { 
78,     "/goto"                ,             "[P-ID]"                                                                     },
    { 
99,     "/tmute"            ,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         },
    { 
105,     "/war"                ,             "[P-ID] [REASON]"                                                             },
    { 
120,     "/get"                ,             "[P-ID]"                                                                     },
    { 
140,     "/kick"                ,             "[P-ID] [REASON]"                                                             },
    { 
154,     "/tfreeze"            ,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         },
    { 
178,     "/tban"                ,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         },
    { 
230,     "/banlist"            ,             " "                                                                         },
    { 
240,     "/unban"            ,             "[P-NAME] [0,1,2=MUTE,FREEZE,BAN]"                                             },
    { 
350,     "/setaa"            ,             "[P-ID] [ACCESS]"                                                             },
    { 
350,     "/setalvl"            ,             "[P-ID] [LEVEL] [ACCESS | 50, 100, 150, 200, 250, 350]"                     },
    { 
999,     "/jobvehicles"        ,             "[JOBID] [fful, savepos, respawn, repair, eoff, eon, unlock, lock, delete]" },
    { 
999,     "/arcon"            ,             "[gmx, exit, list, savedb]"                                                 },
    { 
999,     "/listmission"        ,             " "                                                                         },
    { 
999,     "/listcp"            ,             " "                                                                         },
    { 
999,     "/listvehicle"        ,             " "                                                                         },
    { 
999,     "/listjob"            ,             " "                                                                         },
    { 
999,     "/listrank"            ,             " "                                                                         },
    { 
999,     "/listhouse"        ,             " "                                                                         }
}; 
PHP Code:
C:\Users\RJ\Desktop\WinGTAsa\gamemodes\rn.pwn(193) : warning 228length of initialler exceeds size of the enum field
C
:\Users\RJ\Desktop\WinGTAsa\gamemodes\rn.pwn(193) : error 018initialization data exceeds declared size 
Reply
#2

PHP Code:
{      "/tmute"            ,99,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         }, 
That text was a problem. I just don't know why... Is it too long? Or it cannot be saved like that? Too many brackets? Don't understand.... :/

edit. it's connected with the length - but why, when I defined the length above?

done. was too short - 72 at least, srry... can't count i guess?
Reply
#3

Quote:
Originally Posted by TheRohlikar
View Post
PHP Code:
{      "/tmute"            ,99,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         }, 
That text was a problem. I just don't know why... Is it too long? Or it cannot be saved like that? Too many brackets? Don't understand.... :/

edit. it's connected with the length - but why, when I defined the length above?

done. was too short - 72 at least, srry... can't count i guess?
still too long

(6 words 49 characters)

string[49 + 1] // +1 = \0
Reply
#4

You're trying to make a tridimensional array, but only declared two parameters.
pawn Code:
new adminCMD[ACMDS][ACMDPROPERTIES][/*MAX_STRING_SIZE*/] = {
    { 1,     "#"                    ,             "[TEXT]"                                                                     },
    { 3,     "/answer"            ,             "[Q-ID] [MSG]"                                                                 },
    { 3,     "/questions"        ,             " "                                                                         },
    { 5,     "/asay"                ,             "[MSG]"                                                                     },
    { 7,     "/ainfo"            ,             "[P-ID]"                                                                     },
    { 78,     "/goto"                ,             "[P-ID]"                                                                     },
    { 99,     "/tmute"            ,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         },
    { 105,     "/war"                ,             "[P-ID] [REASON]"                                                             },
    { 120,     "/get"                ,             "[P-ID]"                                                                     },
    { 140,     "/kick"                ,             "[P-ID] [REASON]"                                                             },
    { 154,     "/tfreeze"            ,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         },
    { 178,     "/tban"                ,             "[P-ID] [REASON] [MONTHS] [DAYS] [HOURS] [SECONDS]"                         },
    { 230,     "/banlist"            ,             " "                                                                         },
    { 240,     "/unban"            ,             "[P-NAME] [0,1,2=MUTE,FREEZE,BAN]"                                             },
    { 350,     "/setaa"            ,             "[P-ID] [ACCESS]"                                                             },
    { 350,     "/setalvl"            ,             "[P-ID] [LEVEL] [ACCESS | 50, 100, 150, 200, 250, 350]"                     },
    { 999,     "/jobvehicles"        ,             "[JOBID] [fful, savepos, respawn, repair, eoff, eon, unlock, lock, delete]" },
    { 999,     "/arcon"            ,             "[gmx, exit, list, savedb]"                                                 },
    { 999,     "/listmission"        ,             " "                                                                         },
    { 999,     "/listcp"            ,             " "                                                                         },
    { 999,     "/listvehicle"        ,             " "                                                                         },
    { 999,     "/listjob"            ,             " "                                                                         },
    { 999,     "/listrank"            ,             " "                                                                         },
    { 999,     "/listhouse"        ,             " "                                                                         }
};
Reply
#5

The fix is simple: acmdHELP[74] but I think he already solved it.

Quote:
Originally Posted by Ermanhaut
View Post
You're trying to make a tridimensional array, but only declared two parameters.
No, he is not. A 2D array consists of pairs {{1, 2}, {3, 4}}
Reply
#6

Quote:
Originally Posted by Calisthenics
View Post
No, he is not. A 2D array consists of pairs {{1, 2}, {3, 4}}
1D Arrays:
pawn Code:
new 1DArray[32] = { "Insert here a 32 characters string" };
new 1DArray1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
2D Arrays:
pawn Code:
new playerName[MAX_PLAYERS][MAX_PLAYER_NAME];
new badVehicleNames[][MAX_VEHICLE_NAME] = {
  {"Clover"},
  {"Tampa"},
  {"Huntley"},
  {"Rancher"}
};
3D Arrays
pawn Code:
new randomStuff[][][] = {
  {"Pencil", "Book", "Screwdriver", "Rubber"},
  {"Tire", "Wheel", "Pedal", "Mirror"},
  {"Hand", "Ear", "Hair", "Retangle"}
};

new someNeatShit[][][] = {
  {4, "The ruler is ok", float:774.4},
  {5, "nice try mr. johnson", float:25.9},
  {11, "Tea is just grass sweat", float:44741.47}
};
Now tell me wich one of these is similar to his array.
Reply
#7

Quote:
Originally Posted by Ermanhaut
View Post
1D Arrays:
pawn Code:
new 1DArray[32] = { "Insert here a 32 characters string" };
new 1DArray1[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
2D Arrays:
pawn Code:
new playerName[MAX_PLAYERS][MAX_PLAYER_NAME];
new badVehicleNames[][MAX_VEHICLE_NAME] = {
  {"Clover"},
  {"Tampa"},
  {"Huntley"},
  {"Rancher"}
};
3D Arrays
pawn Code:
new randomStuff[][][] = {
  {"Pencil", "Book", "Screwdriver", "Rubber"},
  {"Tire", "Wheel", "Pedal", "Mirror"},
  {"Hand", "Ear", "Hair", "Retangle"}
};

new someNeatShit[][][] = {
  {4, "The ruler is ok", float:774.4},
  {5, "nice try mr. johnson", float:25.9},
  {11, "Tea is just grass sweat", float:44741.47}
};
Now tell me wich one of these is similar to his array.
He uses an enum, which basically adds another dimension.

Your third example is a real 3D array, however your fourth array also uses an enum which makes the third dimension, so even that would be wrong (try it yourself with an enum)... It won't even compile (if you properly add an enum to it).


Furthermore the error message itself tells us that this is only an issue of insufficient array size inside the enum, not the dimension itself. Otherwise the error would happen in the first set of data.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)