array - dimension problem
#1

Ok, so I'm using Y-Commands because it offers so much more than any other processor. But that has nothing to do with the problem, the problem is that the script freezes at the point where I call "aCommandsA[i]", to better explain, let me give you my code!

Here is the array! Which is the list of commands to be used in the ycmd function.
pawn Код:
new aCommandsA[][]={"commands1", "coommands2", "commands3"};
Here is where I call "aCommandsA[i]" using the ycmd function, Group_SetGlobalCommand.
pawn Код:
for(new i=sizeof(aCommandsA); i!=0; i--) Group_SetGlobalCommand(Command_GetID(aCommandsA[i]), false);
Using my knowledge I was able to narrow thge rpoblem down to the point that "aCommandsA[i]" is called for sure. So can anyone explain what is wrong with the array? Note that the the script just seems to skip the rest of onplayerconnect after this, its very important to me...
Reply
#2

It goes out of bounds. Change to:
pawn Код:
for (new i; i != sizeof (aCommandsA); ++i)
or with your way:
pawn Код:
for (new i = sizeof (aCommandsA) - 1; i != -1; i--)
Reply
#3

It gets through opc now, but this somehow corrupted my cmd command, it may be ok with tweaking though..
Reply


Forum Jump:


Users browsing this thread: