unknown debug
#1

pawn Код:
[12:06:44] [debug] Run time error 4: "Array index out of bounds"
[12:06:44] [debug]  Accessing element at negative index -1
[12:06:44] [debug] AMX backtrace:
[12:06:44] [debug] #0 000a1258 in public OPJV_OnPlayerKeyStateChange () from rp.amx
[12:06:44] [debug] #1 0000a3d4 in public OnPlayerKeyStateChange () from rp.amx
pawn Код:
public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
{

    afk_movement[playerid] = AFK_TIME;
    if(newkeys == KEY_FIRE && displaying_stock[playerid])
    {

        TextDrawHideForPlayer(playerid,stocktitle);
        TextDrawHideForPlayer(playerid,stockcontent);

    }
    if(IsPlayerInAnyVehicle(playerid) && newkeys == KEY_CROUCH)
    {

        if(IsPlayerInRangeOfPoint(playerid,10.0,1958.17, -2189.74, 12.53))
        {

            if(CharacterInfo[playerid][active_character[playerid]][cFlyLic])
            {

                MoveObject(airport_gate1,1967.05, -2189.85, 12.53,6.0);
                MoveObject(airport_gate2,1947.42, -2189.79, 12.53,6.0);
                airport_timeout = 6;

            }

        }

    }
    if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE))
    {
        if(CharacterInfo[playerid][active_character[playerid]][cFaction] != 0)
        {
            if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
            {
                if(CharacterInfo[playerid][active_character[playerid]][cFaction] == 1)
                {
                    if(IsPlayerInRangeOfPoint(playerid,5,1548.7083,-1627.3934,13.3828) || IsPlayerInRangeOfPoint(playerid,5,1538.0371,-1627.1071,13.3828)) // PD front gate barrier /pd
                    {
                        DestroyObject(pdgate);
                        pdgate = CreateObject(968, 1544.746704, -1630.777222, 13.160947, 0.0000, 359.1406, 270.0000);
                        SetTimer("GateClose", 5000, 0);
                        return 1;
                    }
                    if(IsPlayerInRangeOfPoint(playerid,5,1586.3407,-1634.9952,13.3828) || IsPlayerInRangeOfPoint(playerid,5,1588.9292,-1643.8201,12.3352)) // PD Garage
                    {
                        MoveObject(pdgate1, 1591.738037, -1638.271606, -2.911936, 2.00);
                        SetTimer("GateClose1", 8000, 0);
                        return 1;
                    }
                }
                if(CharacterInfo[playerid][active_character[playerid]][cFaction] == 3)
                {
                    if(IsPlayerInRangeOfPoint(playerid,10,1132.09961, -1291.00000, 13.50000)) // PD front gate barrier /pd
                    {
                        DestroyObject(emsgate1);
                        emsgate1 = CreateObject(968, 1132.09961, -1291.00000, 13.50000,   0.00000, 0.00000, 0.00000);
                        SetTimer("EmsGateClose", 5000, 0);
                        return 1;
                    }
                    if(IsPlayerInRangeOfPoint(playerid,10,1149.69922, -1291.00000, 13.70000)) // PD front gate barrier /pd
                    {
                        DestroyObject(emsgate2);
                        emsgate2 = CreateObject(968, 1149.69922, -1291.00000, 13.70000,   0.00000, 359.00000, 0.00000);
                        SetTimer("EmsGateClose1", 5000, 0);
                        return 1;
                    }
                }
            }
        }
    }
    if(RELEASED(KEY_FIRE) && !IsLaw(playerid))
    {
        if(GetWeaponAmmo(playerid, CharacterInfo[playerid][active_character[playerid]][cPerm1]) > 0)
        {
            CharacterInfo[playerid][active_character[playerid]][cAmmo1] = GetWeaponAmmo(playerid, CharacterInfo[playerid][active_character[playerid]][cPerm1]);
        }
        else CharacterInfo[playerid][active_character[playerid]][cPerm1] = 0;

        if(GetWeaponAmmo(playerid, CharacterInfo[playerid][active_character[playerid]][cPerm2]) > 0)
        {
            CharacterInfo[playerid][active_character[playerid]][cAmmo2] = GetWeaponAmmo(playerid, CharacterInfo[playerid][active_character[playerid]][cPerm2]);
        }
        else CharacterInfo[playerid][active_character[playerid]][cPerm2] = 0;
    }
    if ((newkeys & KEY_FIRE) && !(oldkeys & KEY_FIRE) && (GetPlayerState(playerid) == PLAYER_STATE_DRIVER))
    {
        new idcar = GetPlayerVehicleID(playerid);
        new params[7];
        switch(GetPVarInt(playerid, "vMainOn"))
        {
            case 0:
            {
                GetVehicleParamsEx(idcar,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
                SetVehicleParamsEx(idcar,params[0],1,params[2],params[3],params[4],params[5],params[6]);
                VehicleLightsOn[idcar] = true;
                SetPVarInt(playerid, "vMainOn", 1);
                return 1;
            }
            case 1:
            {
                GetVehicleParamsEx(idcar,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
                SetVehicleParamsEx(idcar,params[0],0,params[2],params[3],params[4],params[5],params[6]);

                VehicleLightsOn[idcar] = false;
                SetPVarInt(playerid, "vMainOn", 0);
                return 1;
            }
        }
    }
    if(newkeys == KEY_LOOK_BEHIND)
    {

        if(in_shamal[playerid] == -1)
        {
            new shamal = NearShamal(playerid);
            if(shamal > -1 && !IsPlayerInAnyVehicle(playerid))
            {
                SetPlayerPos(playerid,1.6028,32.7263,1199.5938);
                SetPlayerInterior(playerid,1);
                SetPlayerFacingAngle(playerid,180.0);
                SetPlayerVirtualWorld(playerid,shamal);
                in_shamal[playerid] = shamal;
            }
        }
        else
        {

            new Float:X, Float:Y, Float:Z;
            GetVehiclePos(in_shamal[playerid],X,Y,Z);
            SetPlayerPos(playerid,(X + 2),(Y + 2),Z);
            SetPlayerInterior(playerid,0);
            SetPlayerVirtualWorld(playerid,0);
            in_shamal[playerid] = -1;

        }

    }
    if(newkeys == KEY_SPRINT)
    {

        if(in_anim[playerid])
        {

            CallLocalFunction("cmd_stopanim","is",playerid,"1");

        }

    }
    if(dancing[playerid])
    {

        if(newkeys == KEY_FIRE)
        {

            if(old_action[playerid] != SPECIAL_ACTION_NONE)
            {

                SetPlayerSpecialAction(playerid,old_action[playerid]);
                old_action[playerid] = SPECIAL_ACTION_NONE;

            }
            else
            {

                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);

            }
            dancing[playerid] = 0;

        }

    }
    if(sleeping[playerid])
    {

        SendEmote(playerid,"se trezeste");
        TogglePlayerControllable(playerid,1);
        CallLocalFunction("cmd_stopanim","is",playerid,"1");
        sleeping[playerid] = 0;

    }
    if(filling[playerid])
    {

        if(newkeys == KEY_HANDBRAKE)
        {

            filling_started[playerid] = 1;

        }

    }
    if(drinking[playerid] > 0)
    {

        if(newkeys == KEY_FIRE)
        {

            drinking[playerid] --;
            new action = GetPlayerSpecialAction(playerid);
            switch(action)
            {

                case SPECIAL_ACTION_DRINK_SPRUNK:
                {

                    new Float:hp;
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,(hp + 2.0));

                }
                case SPECIAL_ACTION_DRINK_BEER:
                {

                    new Float:hp;
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,(hp + 3.0));
                    SetPlayerDrunkLevel(playerid,(GetPlayerDrunkLevel(playerid) + 750));

                }
                case SPECIAL_ACTION_DRINK_WINE:
                {

                    new Float:hp;
                    GetPlayerHealth(playerid,hp);
                    SetPlayerHealth(playerid,(hp + 4.0));
                    SetPlayerDrunkLevel(playerid,(GetPlayerDrunkLevel(playerid) + 1000));

                }

            }
            if(drinking[playerid] == 0) { SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE); drinking[playerid] = 0; }

        }

    }
    if(weed[playerid] > 0)
    {

        if(newkeys == KEY_FIRE)
        {

            weed[playerid] ++;
            new dlevel = GetPlayerDrunkLevel(playerid);
            if((dlevel + 2000) < 10000) { SetPlayerDrunkLevel(playerid,(dlevel + 2000)); }
            if(weed[playerid] == 10)
            {

                SetPlayerSpecialAction(playerid,SPECIAL_ACTION_NONE);
                SendEmote(playerid,"termina tigara.");
                weed[playerid] = 0;

            }

        }

    }
    if(newkeys == KEY_SPRINT)
    {

        if(tutorial_skip[playerid])
        {
            tutorial_stage[playerid] ++;
            //RefreshPlayerTutorial(playerid);
        }

    }
    if((newkeys & KEY_WALK) && (newkeys & KEY_SPRINT))
    {

        //****ENTER****

        new house = GetClosestHouse(playerid);
        if(house > -1 && in_house[playerid] == -1 && GetPlayerVirtualWorld(playerid) == 0)
        {

            if(HouseInfo[house][hLocked]) { GameTextForPlayer(playerid,"~r~Incuiat",5000,6); PlayerPlaySound(playerid,1145,0.0,0.0,0.0); return 1; }
            SetPlayerInterior(playerid,HouseInfo[house][hInterior]);
            SetPlayerVirtualWorld(playerid,house);
            SetPlayerPos(playerid,HouseInfo[house][hInteriorX],HouseInfo[house][hInteriorY],HouseInfo[house][hInteriorZ]);
            in_house[playerid] = house;
            return 1;

        }

        new biz = GetClosestBiz(playerid);
        if(biz > -1 && GetPlayerVirtualWorld(playerid) == 0)
        {

            if(!BizInfo[biz][bOpen]) { GameTextForPlayer(playerid,"~r~Inchis",5000,6); PlayerPlaySound(playerid,1145,0.0,0.0,0.0); return 1; }
            OnPlayerEnterBusiness(playerid,biz);
            return 1;

        }

        new inter = GetClosestInterior(playerid);
        if(inter > -1 && GetPlayerVirtualWorld(playerid) == 0)
        {

            OnPlayerEnterInterior(playerid,inter);
            return 1;

        }

        //****EXIT****

        house = in_house[playerid];
        if(house > -1)
        {

            if(HouseInfo[house][hLocked]) { GameTextForPlayer(playerid,"~r~Incuiat",5000,6); PlayerPlaySound(playerid,1145,0.0,0.0,0.0); return 1; }
            SetPlayerPos(playerid,HouseInfo[house][hSpawnX],HouseInfo[house][hSpawnY],HouseInfo[house][hSpawnZ]);
            SetPlayerInterior(playerid,0);
            SetPlayerVirtualWorld(playerid,0);
            in_house[playerid] = -1;
            return 1;

        }
        biz = in_biz[playerid];
        if(biz > -1)
        {

            OnPlayerExitBusiness(playerid,biz);
            return 1;

        }

        OnPlayerExitInterior(playerid);
        return 1;

    }
    return 1;
}
Reply
#2

Create this error again with a -d3 state.
Create a pawno.cfg and add -d3 there.

Post the new error after it.

(also, the error happens inside OPJV_OnPlayerKeyStateChange not actual OnPlayerKeyStateChange)
Reply
#3

You will need to compile with debug info (-d3) as BullseyeHawk said already to get more information and it's better to use the latest version of crashdetect (4.13). So if you don't use the latest one, load crashdetect plugin and compile with debug info (-d3). Re-compile your scripts and run the server. If crashdetect prints something, post the server log.

By the way, every hooked callback is called first that's why the original callback is called last. That doesn't mean the run time error caused by an include, atleast not as far as it has lack of -d3 (not compiled with).

Last, because I've seen a lot of threads about it - the problem is:
pawn Код:
active_character[playerid]
It's -1 and you pass it in CharacterInfo array.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)