[Crash Detect Errors] Array index out of bound.
#1

Errors : Run time error 4: "Array index out of bounds"
[22:46:15] [debug] Accessing element at index 933 past array upper bound 254
[22:46:15] [debug] AMX backtrace:
[22:46:15] [debug] #0 000731cc in public OnVehicleSpawn () from bluegamesv1.amx
[22:46:15] [debug] #1 000ae98c in public RespawnAll () from bluegamesv1.amx
[22:46:15] [debug] Run time error 4: "Array index out of bounds"
[22:46:15] [debug] Accessing element at index 934 past array upper bound 254
[22:46:15] [debug] AMX backtrace:
[22:46:15] [debug] #0 000731cc in public OnVehicleSpawn () from bluegamesv1.amx
[22:46:15] [debug] #1 000ae98c in public RespawnAll () from bluegamesv1.amx

Code 1 :
pawn Код:
public OnVehicleDeath(vehicleid, killerid)
{
    SetTimerEx("OnVehicleSpawn", 1000, false, "d", vehicleid);
}

public OnVehicleSpawn(vehicleid)
{
    if(vehicleid>sizeof(Vehicles)) return DestroyVehicle(vehicleid);
    vTrailer[vehicleid] = 0;
    CarBombActive[vehicleid] = 0;
    vehicleGuns[vehicleid] = 0;
    vehicleBullets[vehicleid] = 0;
    for(new i=0;i<13;i++)
    {
        VehicleWeapon[vehicleid][i]     = 0;
        VehicleAmmo[vehicleid][i]     = 0;
    }
    HasGunCrates[vehicleid] = 0;
    HasBulletCrates[vehicleid] = 0;
    HasCGuns[vehicleid] = 0;
    comps[vehicleid][guns] = 0;
    comps[vehicleid][oil] = 0;
    comps[vehicleid][alchool] = 0;
    VehicleInfo[vehicleid][iBroken]= 0;
    VehicleInfo[vehicleid][iEngine]= 0;
    comps[vehicleid][money] = 0;
    comps[vehicleid][drugs] = 0;
    comps[vehicleid][stuffs] = 0;
    compscar[vehicleid] = 0;
    SetVehicleVirtualWorld(vehicleid,0);
    SetTimerEx("SetVehicleWorld", 500, false,"dd", vehicleid, Vehicles[vehicleid][vw]);
    if(vehicleid<sizeof(Vehicles)) LinkVehicleToInterior(vehicleid, 0);
    if(Gas[vehicleid]<20) Gas[vehicleid]+=20;
    UnlockVehicle(vehicleid);
    if(!strcmp(Vehicles[vehicleid][carowner], "NoBodY", false) || Vehicles[vehicleid][carprice] > 0) UnlockVehicle(vehicleid);
    else LockVehicle(-1, vehicleid);
    SetTimerEx("ModCar", 1000, 0, "d", vehicleid);
    ChangeVehiclePaintjob(vehicleid, Vehicles[vehicleid][paintjob]);
    return 1;
}
Code 2 :
pawn Код:
forward RespawnAll();
public RespawnAll()
{
    for(new i; i < MAX_VEHICLES; i++)
    {
        if(IsVehicleOccupied(i)) continue;
        SetVehicleToRespawn(i);
    }
    SendClientMessageToAll(COLOR_HELPEROOC, "(( INFO: All unoccupied vehicles have been respawned. ))");
}
Thanks in advance
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)