What does this debug mean?
#1

Код:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at negative index -1
[debug] AMX backtrace:
[debug] #0 0001f070 in public cmd_exit (0x00000000, 0x000a1410) from MySQL.amx
[debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[debug] #2 000005ac in public OnPlayerCommandText (0x00000000, 0x000a13f8) from
MySQL.amx
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at negative index -1
[debug] AMX backtrace:
[debug] #0 0001f070 in public cmd_exit (0x00000000, 0x000a1410) from MySQL.amx
[debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[debug] #2 000005ac in public OnPlayerCommandText (0x00000000, 0x000a13f8) from
MySQL.amx
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at negative index -1
[debug] AMX backtrace:
[debug] #0 0001f070 in public cmd_exit (0x00000000, 0x000a1410) from MySQL.amx
[debug] #1 native CallLocalFunction () [00472ad0] from samp-server.exe
[debug] #2 000005ac in public OnPlayerCommandText (0x00000000, 0x000a13f8) from
MySQL.amx
Here is my exit command:

pawn Код:
CMD:exit(playerid, params[])
{
    new i = PlayerInfo[playerid][pInHouse];
    if(!IsPlayerLoggedIn(playerid))
    {
        SendClientMessage(playerid, COLOR_RED, "Error"White": You are restricted from using commands until you log in.");
        return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid, 1, 1247.6592, -856.8844, 1086.4293)) // NatWest Bank
    {
        SetPlayerPos(playerid, -1581.4143,866.8643,7.6953);
        SetPlayerFacingAngle(playerid, 185.3846);
        SetCameraBehindPlayer(playerid);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1, 1170.2009, -829.2502, 1086.3462)) // Texaco Garage
    {
        SetPlayerPos(playerid, -1675.5232, 431.7340, 7.1797);
        SetPlayerFacingAngle(playerid, 223.7847);
        SetCameraBehindPlayer(playerid);
    }
    else if(IsPlayerInRangeOfPoint(playerid, 1, HouseInfo[i][hExitPos][0], HouseInfo[i][hExitPos][1], HouseInfo[i][hExitPos][2]))
    {
        if(i >= 0)
        {
            SetPlayerPos(playerid, HouseInfo[i][hEnterPos][0], HouseInfo[i][hEnterPos][1], HouseInfo[i][hEnterPos][2]);
            SetPlayerFacingAngle(playerid, HouseInfo[i][hEnterPos][3]-180);
            SetPlayerInterior(playerid, 0);
            SetPlayerVirtualWorld(playerid, 0);
            PlayerInfo[playerid][pInterior] = 0;
            SetCameraBehindPlayer(playerid);
            PlayerInfo[playerid][pInHouse] = -1;
        }
    }
    else if(PlayerInfo[playerid][pInHouse] > -1 && PlayerInfo[playerid][pInHouse] != HouseInfo[i][hHouseID])
    {
        SetPlayerInterior(playerid, 0);
        SetPlayerVirtualWorld(playerid, 0);
        PlayerInfo[playerid][pInterior] = 0;
        SetCameraBehindPlayer(playerid);
        PlayerInfo[playerid][pInHouse] = -1;
        SetPlayerPos(playerid, -2656.6123, 635.8759, 14.4531);
        SetPlayerFacingAngle(playerid, 182.7413);
        SetCameraBehindPlayer(playerid);
        SendClientMessage(playerid, COLOR_ORANGE, "The house you were in has been deleted. You have been set back to the newb spawn.");
    }
    else
    {
        SendClientMessage(playerid, COLOR_RED, "Error"White": You are not near an exit point.");
        return 1;
    }
    return 1;
}
It has only said that since I added the last two parts into the exit command, but they work fine in game..
Reply
#2

You should check if pInHouse is not -1 before using "i" in the array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)