31.03.2010, 15:48
Hello, I have found a bug with multi-index non-global variables.
Here is the example:
Compiler shows an error:
When I remove the "new pos[3][50];" from second command, it compiles good, but...
In-game, when you type "/XYZ_LOL" it teleports you to coords 0.0 0.0 0.0. It means, that variable "pos" does no longer exist.
I would be glad, if this can be fixed.
Thanks.
Here is the example:
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
new cmd[100], i;
cmd = strtok(cmdtext, i);
if(!strcmp(cmd, "/XYZ", true))
{
new pos[3][50];
for(new a; a<3; a++) pos[a] = strtok(cmdtext, i);
if(!strlen(pos[2])) return true;
return SetPlayerPos(playerid, floatstr(pos[0]), floatstr(pos[1]), floatstr(pos[2]));
}
if(!strcmp(cmd, "/XYZ_LOL", true))
{
new pos[3][50];
for(new a; a<3; a++) pos[a] = strtok(cmdtext, i);
if(!strlen(pos[2])) return true;
return SetPlayerPos(playerid, floatstr(pos[0]), floatstr(pos[1]), floatstr(pos[2]));
}
return false;
}
Код:
Symbol already defined ("pos").
In-game, when you type "/XYZ_LOL" it teleports you to coords 0.0 0.0 0.0. It means, that variable "pos" does no longer exist.
I would be glad, if this can be fixed.
Thanks.