18.04.2018, 14:26
The red coloured characters represent the danger area, that's what's causing the problem.
to fix that, consider removing the number values from the array's bracket, just like the following.
In order to get the size of an array, you just have to pass in the array as a parameter on sizeof() which is actually not a function, it's a compiler directive, that's why we can only get array sizes at compile time, (imagine having this on runtime, how awesome would that be?).
Let's look at these few examples:
Witch outputs:
Код:
new string[2][128]; format(string[0],sizeof(string[0]), "{10F441}[VIP] {10F441}%s's {FFFFFF}VIP level has been set to {10F441}%d.", pInfo[pID][pName], vlevel); SendClientMessage(playerid, -1, string[0]); format(string[1],sizeof(string[1]), "{10F441}[VIP] {FFFFFF}Your VIP level has been set to {10F441}%d. {FFFFFF}Use {10F441}/vcmds {FFFFFF}to see available commands.", vlevel); SendClientMessage(pID, -1, string[1]);
PHP код:
new string[2][128];
format(string[0],sizeof(string[]), "{10F441}[VIP] {10F441}%s's {FFFFFF}VIP level has been set to {10F441}%d.", pInfo[pID][pName], vlevel);
SendClientMessage(playerid, -1, string[0]);
format(string[1],sizeof(string[]), "{10F441}[VIP] {FFFFFF}Your VIP level has been set to {10F441}%d. {FFFFFF}Use {10F441}/vcmds {FFFFFF}to see available commands.", vlevel);
SendClientMessage(pID, -1, string[1]);
Let's look at these few examples:
PHP код:
new array[3][5][8];
printf("%d", sizeof(array));
printf("%d", sizeof(array[]));
printf("%d", sizeof(array[][]));
Код:
3 5 8