error 032: array index out of bounds (variable "CasaInfo") -
NATANGameron - 05.04.2017
C:\Users\Natan\Desktop\Server\gamemodes\WERP.pwn(5 7607) : error 032: array index out of bounds (variable "CasaInfo")
C:\Users\Natan\Desktop\Server\gamemodes\WERP.pwn(5 7727) : error 032: array index out of bounds (variable "CasaInfo")
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase
2 Errors.
Код:
if(!strcmp(cmdtext, "/pb368", true))
{
if(!strcmp(CasaInfo[368][Proprietario], PlayerName(playerid), true) || //LINHA 57607
!strcmp(CasaInfo[368][Morador], PlayerName(playerid), true) ||
!strcmp(CasaInfo[368][Morador2], PlayerName(playerid), true) ||
!strcmp(CasaInfo[368][Morador3], PlayerName(playerid), true))
{
SendClientMessage(playerid, COR_AMARELO, "Abrindo o portгo da casa.");
MoveDynamicObject(casa_ls_id_368, 1373.3564500,-1882.2364500,5.6901000, 3.0);
}
else
{
SendClientMessage(playerid, COR_ERRO, "Vocк nгo tem permissгo!");
}
return 1;
}
if(!strcmp(cmdtext, "/pf368", true))
{
if(!strcmp(CasaInfo[368][Proprietario], PlayerName(playerid), true) || //LINHA 57727
!strcmp(CasaInfo[368][Morador], PlayerName(playerid), true) ||
!strcmp(CasaInfo[368][Morador2], PlayerName(playerid), true) ||
!strcmp(CasaInfo[368][Morador3], PlayerName(playerid), true))
{
SendClientMessage(playerid, COR_AMARELO, "Fechando o portгo da casa.");
MoveDynamicObject(casa_ls_id_368, 1373.3564500,-1882.2364500,13.6901000, 3.1);
}
else
{
SendClientMessage(playerid, COR_ERRO, "Vocк nгo tem permissгo!");
}
return 1;
}
Re: error 032: array index out of bounds (variable "CasaInfo") -
MultiKill - 05.04.2017
Vocк esta tentando acessar um нndice que nгo existe na array CasaInfo.
Exemplo:
PHP код:
new array[2];
//нndices existentes: 0, 1
//se tentar acessar o нndice 3 vai dar erro:
array[3] = 5;
Re: error 032: array index out of bounds (variable "CasaInfo") -
NATANGameron - 05.04.2017
Nгo entendi o que devo fazer pra consertar?
Re: error 032: array index out of bounds (variable "CasaInfo") -
MultiKill - 05.04.2017
Se uma array й criada com 300 нndices ela vai de 0 a 299:
Exemplo:
PHP код:
enum CInfo{
proprietario
}
new CasaInfo[300][CInfo];
//os нndices existes sгo 0 a 299.
//Entгo o cуdigo abaixo irб dar erro
if(CasaInfo[398][proprietario] == 6){
}
//Pois o нndice 398 nгo existe, й muito maior que 299. Й isso que o erro quer dizer