Two Dimensional String Problem
#2

The red coloured characters represent the danger area, that's what's causing the problem.
Код:
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]);
to fix that, consider removing the number values from the array's bracket, just like the following.
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, -1string[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, -1string[1]); 
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:
PHP код:
new array[3][5][8];
printf("%d"sizeof(array));
printf("%d"sizeof(array[]));
printf("%d"sizeof(array[][])); 
Witch outputs:
Код:
3
5
8
Reply


Messages In This Thread
Two Dimensional String Problem - by NoteND - 18.04.2018, 14:12
Re: Two Dimensional String Problem - by Eoussama - 18.04.2018, 14:26
Re: Two Dimensional String Problem - by NoteND - 18.04.2018, 14:35

Forum Jump:


Users browsing this thread: 2 Guest(s)