[debug] Run time error 4: "Array index out of bounds" problem
#1

Hello everyone! I have this problem as I am very new to scripting

Code:
[debug] AMX backtrace:
[22:09:55] [debug] #0 004ae518 in public cmd_exitgarage (0, 10500072) from GM.amx
[22:09:55] [debug] #1 native CallLocalFunction () from samp-server.exe
[22:09:55] [debug] #2 0000089c in public OnPlayerCommandText (0, 10500024) from GM.amx
[22:09:57] [debug] Run time error 4: "Array index out of bounds"
[22:09:57] [debug]  Attempted to read/write array element at negative index -1
This is the command:

Code:
CMD:exitgarage(playerid, params[])
{
    if(pInfo[playerid][aVar][61] != -1 && IsPlayerInRangeOfPoint(playerid, 3.0, 1341.2281,-1548.8905,10037.3174))
    if(GetPlayerState(playerid) == 2)
    {
        SetVehicleVirtualWorld(pInfo[playerid][aVar][1], 0), SetVehiclePos(pInfo[playerid][aVar][1], Houses[pInfo[playerid][aVar][61]][GEnterX], Houses[pInfo[playerid][aVar][61]][GEnterY], Houses[pInfo[playerid][aVar][61]][GEnterZ]), SetPlayerPos(playerid, Houses[pInfo[playerid][aVar][61]][GEnterX], Houses[pInfo[playerid][aVar][61]][GEnterY], Houses[pInfo[playerid][aVar][61]][GEnterZ]),
        SetPlayerVirtualWorldEx(playerid, Iter_Contains(Warp, playerid) || Iter_Contains(Warp2, playerid) ? (pInfo[playerid][aVar][87]) : (0)), PutPlayerInVehicle(playerid, pInfo[playerid][aVar][1], 0);
        pInfo[playerid][aVar][61] = -1;
    }    
    if(GetPlayerState(playerid) == 1)
    {
        SetPlayerPos(playerid, Houses[pInfo[playerid][aVar][61]][GEnterX], Houses[pInfo[playerid][aVar][61]][GEnterY], Houses[pInfo[playerid][aVar][61]][GEnterZ]),
        SetPlayerVirtualWorldEx(playerid, Iter_Contains(Warp, playerid) || Iter_Contains(Warp2, playerid) ? (pInfo[playerid][aVar][87]) : (0)), 
        pInfo[playerid][aVar][61] = -1;
    }
    return 1;
}
I also got this :

Code:
[22:53:15] [debug] Run time error 4: "Array index out of bounds"
[22:53:15] [debug]  Attempted to read/write array element at negative index -1
[22:53:15] [debug] AMX backtrace:
[22:53:15] [debug] #0 003568c0 in public OnPlayerLogin (1) from GM.amx
Reply


Messages In This Thread
[debug] Run time error 4: "Array index out of bounds" problem - by MaestrulFritz - 30.08.2019, 19:14
Re: [debug] Run time error 4: "Array index out of bounds" problem - by Nero_3D - 31.08.2019, 11:14

Forum Jump:


Users browsing this thread: 1 Guest(s)