27.01.2017, 19:01
Olб. Estou programando minha gamemode, e quando me deparo com os logs me vem isso. Alguйm tem ideia do que seja?
Cуdigo
PHP код:
[17:50:15] [debug] Run time error 4: "Array index out of bounds"
[17:50:15] [debug] Accessing element at index 2 past array upper bound 1
[17:50:15] [debug] AMX backtrace:
[17:50:15] [debug] #0 00032ed8 in public OnPlayerLogin (playerid=0, password[]=@00551c3c "w554879") at new.pwn:789
[17:50:15] [debug] #1 0003b03c in public OnDialogResponse (playerid=0, dialogid=1, response=1, listitem=-1, inputtext[]=@00551c3c "w554879") at new.pwn:1536
PHP код:
function::OnPlayerLogin(playerid, password[])
{
if(!strlen(password))
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Digite sua senha.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Fazendo o login", TextoLogin, "Entrar", "Sair");
return 1;
}
new zQuery[156], DBResult:zResult;
SHA256_PassHash(password, "123d1dfqwede2e", HashPass, sizeof(HashPass));
format(zQuery, sizeof(zQuery), "SELECT * FROM `accounts` WHERE `name` = '%q' AND `password` = '%q'", PlayerName(playerid), HashPass);
zResult = db_query(sConnect, zQuery);
if(db_num_rows(zResult) == 0)
{
if(GetPVarInt(playerid, "WrongPassword") >= 4)
{
SendClientMessage(playerid, COLOR_LIGHTRED, " Vocк errou sua senha mais de 5 vezes, e foi kickado.");
DeletePVar(playerid, "WrongPassword");
Kick(playerid);
return 1;
}
SendClientMessage(playerid, COLOR_LIGHTRED, " Sua senha estб incorreta.");
ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD, "Fazendo o login", TextoLogin, "Entrar", "Sair");
SetPVarInt(playerid, "WrongPassword", GetPVarInt(playerid, "WrongPassword")+1);
}
else
{
// infos da conta
}
db_free_result(zResult);
return 1;
}