Crashdetect warning when i enter any vehicle
#1

Hello there. my problem is everytime i enter a vehicle crash detect warning shows. and points on callback OnPlayerStateChange

Warning
pawn Код:
[18:52:10] [debug] Run time error 4: "Array index out of bounds"
[18:52:10] [debug]  Accessing element at index 573 past array upper bound 349
[18:52:10] [debug] AMX backtrace:
[18:52:10] [debug] #0 00041694 in public OnPlayerStateChange () from lscnr_mysql.amx
Give's me warning on this part
pawn Код:
if(newstate == PLAYER_STATE_DRIVER)
    {
        //Anti-Driveby
        SetPlayerArmedWeapon(playerid, 0);
        //
        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 518  || GetVehicleModel(GetPlayerVehicleID(playerid)) == 482 || GetVehicleModel(GetPlayerVehicleID(playerid)) == 475)
        {
            if(gTeam[playerid] == TEAM_CARJACKER)
            {
                GameTextForPlayer(playerid, "You can sell this~n~Vehicle at Crane",5000,3);
                new veh = GetPlayerVehicleID(playerid);
                CanBeSellOnCrane[veh] =1;
                return 1;
            }
        }

        for(new i = 0; i < sizeof(CIAVeh); i++)
        {
            if(GetPlayerVehicleID(playerid) == CIAVeh[i])
            {
                if(gTeam[playerid] == TEAM_CIA) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only CIA Personnel can use this car");
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
        }
       

        for(new i = 0; i < sizeof(ArmyVeh); i++)
        {
            if(GetPlayerVehicleID(playerid) == ArmyVeh[i])
            {
                if(gTeam[playerid] == TEAM_ARMY) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only Army Personnel can use the Army vehicles.");
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
        }
       

        for(new i = 0; i < sizeof(PoliceVehicles); i++)
        {
            if(GetVehicleModel(GetPlayerVehicleID(playerid)) == PoliceVehicles[i])
            {
                if(gTeam[playerid] == TEAM_POLICE || gTeam[playerid] == TEAM_ARMY || gTeam[playerid] == TEAM_CIA || gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

                new current_zone;
                current_zone = player_zone[playerid];
                SendClientMessage(playerid,COLOR_GREY,"Law Enforcement Vehicle Theft");
                SendClientMessage(playerid,COLOR_RED,"You have stolen a Law Enforcement Vehicle. The police has been informed, watch out ..");
                IncreaseWantedLevel(playerid,4);

                format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Law Enforcement Vehicle. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
                SendClientMessageToAllCops(string);
                return 1;
            }
        }

        for(new i = 0; i < sizeof(FBISwat); i++)
        {
            if(GetPlayerVehicleID(playerid) == FBISwat[i])
            {
                if(GetPlayerSkin(playerid) == 286 || (GetPlayerSkin(playerid) == 285)) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");
                SendClientMessage(playerid,COLOR_RED_ERROR,""red"[ERROR] "white"Only FBI and SWAT Personnel can use the this vehicles.");
                RemovePlayerFromVehicle(playerid);
                return 1;
            }
        }

        if(GetVehicleModel(GetPlayerVehicleID(playerid)) == 416) //This one is correct as your comparing a model
        {
            if(gTeam[playerid] == TEAM_POLICE && gTeam[playerid] == TEAM_ARMY && gTeam[playerid] == TEAM_CIA && gTeam[playerid] == TEAM_MEDIC) return SendClientMessage(playerid,COLOR_LIGHTBLUE,"Welcome to Law Enforcement Vehicle");

            new current_zone;
            current_zone = player_zone[playerid];
            SendClientMessage(playerid,COLOR_GREY,"Ambulance Vehicle Theft");
            SendClientMessage(playerid,COLOR_RED,"You have stolen an Ambulance. The police has been informed, watch out ..");
            IncreaseWantedLevel(playerid,4);

            format(string,sizeof(string),"[VEHICLE THEFT] Suspect %s(%d) has stolen a Amubalance. Location: %s",PlayerName(playerid),playerid,zones[current_zone][zone_name]);
            SendClientMessageToAllCops(string);
            return 1;
        }
        //
        new vid, Name[24], Msg[128], engine, lights, alarm, doors, bonnet, boot, objective;
        vid = GetPlayerVehicleID(playerid);
        GetPlayerName(playerid, Name, sizeof(Name));
        if (AVehicleData[vid][Owned] == true)
        {
            if (strcmp(AVehicleData[vid][Owner], Name, false) != 0)
            {
                RemovePlayerFromVehicle(playerid);
                GetVehicleParamsEx(vid, engine, lights, alarm, doors, bonnet, boot, objective);
                SetVehicleParamsEx(vid, 0, 0, alarm, doors, bonnet, boot, objective);
                format(Msg, 128, ""red"[ERROR] "white"You cannot use this vehicle, it's owned by \"{FFFF00}%s{FF0000}\"", AVehicleData[vid][Owner]);
                SendClientMessage(playerid, 0xFFFFFFFF, Msg);
                return 1;
            }
        }
    }
    //
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)