[HELP] negative index -1
#1

Hello I was get the error array index of bounds accesing element at negative index -1 that is in this command. thanks

pawn Код:
CMD:p(playerid,params[])
{
    new x = -1;
    foreach(Player,i)
    {
        if(RazgovaraSa[i] && i != playerid) x = i;
    }
    new ime[128],string[128];
    RPIme(playerid,ime);
    SCM(x,COLOR_GRAD2,"Javio se.");
    format(string,sizeof(string),"%s se javio na mobitel.",ime);
    RazgovaraSa[playerid] = ZoveGa[playerid];
    RazgovaraSa[ZoveGa[playerid]] = PozivZa[ZoveGa[playerid]];
    ProxDetector(10.0,playerid,string,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA,LJUBICASTA);
    NaplatiPoziv[RazgovaraSa[playerid]] = SetTimerEx("UzmiZaPoziv",Min(1),true,"d",RazgovaraSa[playerid]);
    SetPlayerSpecialAction(playerid,SPECIAL_ACTION_USECELLPHONE);
    return 1;
}
Reply
#2

Increase the limit of elements in that array.
Reply
#3

Use debug info (-d3) for getting the exact line caused it, all I can do at the moment is guessing:
pawn Код:
RazgovaraSa[ZoveGa[playerid]]
PozivZa[ZoveGa[playerid]]
// or
NaplatiPoziv[RazgovaraSa[playerid]]
so either ZoveGa[playerid] or RazgovaraSa[playerid] is -1.
Reply
#4

Is it a way to fix this I mean the line which you give me.Thanks.Konstantinos that is problem crashdetect won't show me the line I debug for few times it just says that error and in which command is it I use know crashedetect 4.13.1 and only this I get in server.log


[12:00:04] [debug] Run time error 4: "Array index out of bounds"
[12:00:04] [debug] Accessing element at negative index -1
[12:00:04] [debug] AMX backtrace:
[12:00:04] [debug] #0 000ee91c in public cmd_p (0x00000002, 0x0184fd54) from GURP.amx
Reply
#5

https://github.com/Zeex/samp-plugin-...ith-debug-info
Reply
#6

yes I try all of that and I never cant' get the line where is that error I try everything always I get where is the problem I mean like some public or command and the name of error for exaple runtime error 3 etc but never the line.
Reply
#7

You also need to re-compile your scripts after creating pawn.cfg (to pawno folder and "-d3" init) file.
Reply
#8

yes I do that this morning and nothing always get that what I post here. Thanks
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)