[Ajuda] array index out of bounds
#3

Quote:
Originally Posted by elTioFrame
Посмотреть сообщение
Estava criando um sistema que apenas fundadores do servidor podem usar sу que me deparei com este erro: array index out of bounds(variable "SenhaAdmin")

peзo a ajuda de vocкs...

Variavel
PHP код:
new SenhaAdmin[1][10] = {
    
"senha123"
}; 
OnDialogResponse
PHP код:
    if(dialogid == DIALOG_LOGAR_ADMIN)
    {
        if(
response)
        {
            if(
inputtext[playerid] == SenhaAdmin[1])
            {
                
SendClientMessage(playerid, -1, "O SISTEMA TA FUNCIONANDOOOOOOOOOOO");
            }
            else
            {
                
SendClientMessage(playerid, -1, "[ERRO] Senha de fundador incorreta!");
                
Kick(playerid);
            }
        }
        else
        {
            
SendClientMessage(playerid, -1, "[INFO] Para logar como fundador somente digitar o comando de novo.");
        } 
voce esta tentando acessar a posiзгo 2 do vetor sendo que o vetor tem apenas 1 posiзгo que й a "0"(Todos vetores comeзam do 0 e vai ate n-1), entao deveria ser SenhaAdmin[0]

tente:

PHP код:
    if(dialogid == DIALOG_LOGAR_ADMIN) 
    { 
        if(
response) 
        { 
            if(!
strcmp(inputtext, SenhaAdmin[0])) 
            { 
                
SendClientMessage(playerid, -1, "O SISTEMA TA FUNCIONANDOOOOOOOOOOO"); 
            } 
            else 
            { 
                
SendClientMessage(playerid, -1, "[ERRO] Senha de fundador incorreta!"); 
                
Kick(playerid); 
            } 
        } 
        else 
        { 
            
SendClientMessage(playerid, -1, "[INFO] Para logar como fundador somente digitar o comando de novo."); 
        } 
Reply


Messages In This Thread
array index out of bounds - by elTioFrame - 19.12.2018, 19:50
Re: array index out of bounds - by ipsLuan - 19.12.2018, 19:53
Re: array index out of bounds - by PedroH - 19.12.2018, 19:57
Re: array index out of bounds - by ipsLuan - 19.12.2018, 20:00
Re: array index out of bounds - by elTioFrame - 19.12.2018, 20:03
Re: array index out of bounds - by Marllun - 20.12.2018, 04:18

Forum Jump:


Users browsing this thread: 1 Guest(s)