19.12.2010, 17:21
I made 3 example commands
And it gives 2 errors on /test2 and /test3:
But it shouldn't ??
Because arrays are in different scope.
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
if(strcmp(cmdtext, "/test1", true) == 0)
{
new array[16][32];
array[5] = "Testing command 1";
SendClientMessage(playerid, 0xFFFFFFFF, array[5]);
return 1;
}
if(strcmp(cmdtext, "/test2", true) == 0)
{
new array[16][32];
array[5] = "Testing command 2";
SendClientMessage(playerid, 0xFFFFFFFF, array[5]);
return 1;
}
if(strcmp(cmdtext, "/test3", true) == 0)
{
new array[16][32];
array[5] = "Testing command 3";
SendClientMessage(playerid, 0xFFFFFFFF, array[5]);
return 1;
}
return 0;
}
Код:
error 021: symbol already defined: "array" error 021: symbol already defined: "array"
Because arrays are in different scope.