debug errors ! NEED HELP !
#1

pawn Код:
[21:08:36] [debug] Run time error 4: "Array index out of bounds"
[21:08:36] [debug]  Accessing element at index 2001 past array upper bound 1999
[21:08:36] [debug] AMX backtrace:
[21:08:36] [debug] #0 0000f2ac in public CheckGas () from morp.amx
pawn Код:
forward CheckGas();
public CheckGas()
{
//  new Float:x,Float:y,Float:z;
//  new Float:distance,value;//string[256];
//  new string[128];
    foreach (Player, i)
    {
        if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
        {
            if(AdminDuty[i]) continue;
            new vehicle = GetPlayerVehicleID(i);
            if (VehicleEngine[vehicle] == 1 && !IsNotAEngineCar(vehicle))
            {
            if(CarInfo[VehicleOwned[vehicle]][cFuel] >= 1 && Gas[vehicle] >= 1)
            {

                    if(NoFuel[i] == 0) {

                        SendDebugMessage("Checkgas, Fuel Minus");
                    }
                    CarInfo[VehicleOwned[vehicle]][cFuel] -= 1;
                    Gas[vehicle] -= 1;
                }
                else {
                    VehAsk[i] = 1;
                    TogglePlayerControllable(i, 0);
                    GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Ai ramas fara benzina",1500,3);
                    SendDebugMessage("Checkgas, No Fuel");
                }
            }
        }
    }
    return 1;
}
pawn Код:
[21:08:18] [debug] Run time error 4: "Array index out of bounds"
[21:08:18] [debug]  Accessing element at index 2001 past array upper bound 1999
[21:08:18] [debug] AMX backtrace:
[21:08:18] [debug] #0 0001006c in public OnPlayerEnterVehicle () from morp.amx
pawn Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
    //new engine,lights,alarm,doors,bonnet,boot,objective;
    new string[256];
    if(AdminDuty[playerid]) return 1;
    if(!ispassenger)
    {
    /*  foreach (Player,i) {
            if(GetPlayerVehicleID(i) == vehicleid && GetPlayerState(i) == PLAYER_STATE_DRIVER) {
                ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
                SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
                new Float:cx, Float:cy, Float:cz;
                GetPlayerPos(playerid, cx, cy, cz);
                DOO_SetPlayerPos(playerid, cx,  cy, cz);
                SendClientMessage(playerid,COLOR_GRAD3," Someone is driving this vehicle, You must take it Properly !");
                LockCar[playerid][0] = 3;
                LockCar[playerid][1] = vehicleid;
                ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            }
        }
    }*/

    if(GetVehicleModel(vehicleid) == 509) // Bike
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine != VEHICLE_PARAMS_ON) { SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); }
    }
    if(GetVehicleModel(vehicleid) == 481) // Bike
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine != VEHICLE_PARAMS_ON) { SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); }
    }
    if(GetVehicleModel(vehicleid) == 510) // Bike
    {
        new engine, lights, alarm, doors, bonnet, boot, objective;
        GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
        if(engine != VEHICLE_PARAMS_ON) { SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective); }
    }
        if (IsACopCar(vehicleid) && !ispassenger && !(IsAnFbiCar(vehicleid)&&PlayerInfo[playerid][pMember]==2)) {
        if(PlayerInfo[playerid][pMember] != 1) {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
        //  SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul. (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }


    if(IsAGasVeh(vehicleid) && !ispassenger)
    {
        format(string,sizeof(string),"~y~Cantitate Combustibil:~w~ %d litri~n~~y~Il poti transporta si vinde cu comanda /sellgas",VGas[vehicleid]);
        //TextDrawSetString(Textdraw4[playerid],string);
        //TextDrawShowForPlayer(playerid,Textdraw4[playerid]);
    }

    if (IsATaxi(playerid) && !ispassenger) {
        if(PlayerInfo[playerid][pMember] != 7) {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
        //  SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }
    if(PlayerInfo[playerid][pCarkey] == VehicleOwned[vehicleid] && CarInfo[PlayerInfo[playerid][pCarkey]][cTicket] >= 1 && !ispassenger) {
    format(string, sizeof(string),"Ai primit o amenda pentru parcare neregulamentara ($%d)",CarInfo[PlayerInfo[playerid][pCarkey]][cTicket]);
    SendClientMessage(playerid,COLOR_LIGHTRED,string);
    return 1;
    }
    if(PlayerInfo[playerid][pCarkey2] == VehicleOwned[vehicleid] && CarInfo[PlayerInfo[playerid][pCarkey2]][cTicket] >= 1 && !ispassenger) {
    format(string, sizeof(string),"Ai primit o amenda pentru parcare neregulamentara ($%d)",CarInfo[PlayerInfo[playerid][pCarkey2]][cTicket]);
    SendClientMessage(playerid,COLOR_LIGHTRED,string);
    return 1;
    }
    if(PlayerInfo[playerid][pCarkey3] == VehicleOwned[vehicleid] && CarInfo[PlayerInfo[playerid][pCarkey3]][cTicket] >= 1 && !ispassenger) {
    format(string, sizeof(string),"Ai primit o amenda pentru parcare neregulamentara ($%d)",CarInfo[PlayerInfo[playerid][pCarkey3]][cTicket]);
    SendClientMessage(playerid,COLOR_LIGHTRED,string);
    return 1;
    }
    if(CarInfo[VehicleOwned[vehicleid]][cFaction] >= 1 && !ispassenger) {
        if(PlayerInfo[playerid][pMember] !=  CarInfo[VehicleOwned[vehicleid]][cFaction]) {
//format(string, sizeof(string),"ERROR:This vehicle belongs to a faction",FamilyInfo[PlayerInfo[playerid][pMember]][FamilyName]);
            //SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
        }
    }
    if(GetVehicleModel(vehicleid) == 481 && !ispassenger) {
        if(PlayerInfo[playerid][pDonateRank] >=  1) {}
        else {
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," Warning:Nu ai permisiunea pentru a folosi asta (Donator Only)");

        }
    }
      else if(GetVehicleModel(vehicleid) == 521 && !ispassenger) {
        if(PlayerInfo[playerid][pDonateRank] != 3) {
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," Warning:Nu ai permisiunea pentru a folosi asta (Necesita cont premium(Gold))");
        }
    }
    else if(GetVehicleModel(vehicleid) == 411 && !ispassenger) {
        if(PlayerInfo[playerid][pDonateRank] != 3) {
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," Warning:Nu ai permisiunea pentru a folosi asta (Necesita cont premium(Gold))");
        }
    }
    else if(GetVehicleModel(vehicleid) == 451 && !ispassenger)
    {
        if(PlayerInfo[playerid][pDonateRank] != 3)
        {
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," Warning:Nu ai permisiunea pentru a folosi asta (Necesita cont premium(Gold))");
        }
    }
    else if(GetVehicleModel(vehicleid) == 541 && !ispassenger)
    {
        if(PlayerInfo[playerid][pDonateRank] != 3)
        {
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," Warning:Nu ai permisiunea pentru a folosi asta (Necesita cont premium(Gold))");
        }
    }

    if(GetVehicleModel(vehicleid) == 468 && !ispassenger)
    {
        if(PlayerInfo[playerid][pDonateRank] >= 2)
        {
        }
        else
        {
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," Warning:Nu ai permisiunea pentru a folosi asta (trebuie sa fi donator(Silver sau Gold))");
        }
    }


    if(CarInfo[VehicleOwned[vehicleid]][cFuel] == 0 && !ispassenger && Gas[vehicleid] == 0  && !ispassenger)
    {
//format(string, sizeof(string),"ERROR:This vehicle belongs to a faction",FamilyInfo[PlayerInfo[playerid][pMember]][FamilyName]);
            SendClientMessage(playerid,COLOR_WHITE,"Nu ai combustibil in acest vehicul (/fill)!");
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            SetPlayerPos(playerid, cx,  cy, cz);

    }

   else if (IsAnArmyCar(vehicleid) && !ispassenger)
   {
        if(PlayerInfo[playerid][pMember] != 9)
        {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }
    else if (IsAnFbiCar(vehicleid) && !ispassenger)
    {
        if(PlayerInfo[playerid][pMember] != 2)
        {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }
    else if (IsAGovCar(vehicleid) && !ispassenger)
    {
        if(PlayerInfo[playerid][pMember] != 3)
        {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }
    else if (IsAnAmbulance(vehicleid) && !ispassenger)
    {
        if(PlayerInfo[playerid][pMember] != 4)
        {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }

    if (IsASheriffCar(vehicleid) && !ispassenger)
    {
        if(PlayerInfo[playerid][pMember] != 14)
        {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx,  cy, cz);
            SendClientMessage(playerid, COLOR_WHITE, "Nu ai permisiunea de a intra in acest vehicul (Vehicul Factiune)");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
        }
    }
    else if(IsAnOwnableCar(vehicleid) && CarInfo[VehicleOwned[vehicleid]][cLock] == 1)
    {
        if(AdminDuty[playerid] == 0)
        {
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            SetVehicleParamsForPlayer(vehicleid,playerid,0,1);
            new Float:cx, Float:cy, Float:cz;
            GetPlayerPos(playerid, cx, cy, cz);
            DOO_SetPlayerPos(playerid, cx, cy, cz);
            SendClientMessage(playerid,COLOR_LIGHTRED," [ERROR]Vehiculul este inchis!");
            LockCar[playerid][0] = 3;
            LockCar[playerid][1] = vehicleid;
            ApplyAnimationEx(playerid, "ped", "CAR_doorlocked_LHS", 3.0, 0, 0, 0, 0, 0);
            }
        }
    }
    return 1;
}
Reply
#2

Increase your array size
Reply
#3

what do you mean ? , can you take an example for my publics ?
Reply
#4

bump
Reply
#5

I need imediatly help ! please .
Reply
#6

Try searching [1999]

If you found it replace it with [2002] see if that works.

p.s / Răzvan cumva ?
Reply
#7

i don't have 1999 in gamemode - includes 2000-2001-2002 not on of this
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)