Код:
Run time error 4: "Array index out of bounds"
Attempted to read/write array element at index 97 in array of size 25
#2 00010fa0 in public OnVehicleSpawn (97)
#0 002316c0 in public opvehicle_OnVehicleSpawn (97)
#5 00006c04 in public OnPlayerStateChange (0, 2, 1)
#1 00031b54 in public FC_OnPlayerStateChange (1, 2, 1)
Код:
public OnVehicleSpawn(vehicleid)
{
SetVehicleHealth(vehicleid, 1000.0);
for(new i; i < sizeof(VehConSirena); i++)
{
if(vehicleid == VehConSirena[i])
{
if(SirenaVeh[i] != INVALID_OBJECT_ID)
{
DestroyObject(SirenaVeh[i]);
SirenaVeh[i] = INVALID_OBJECT_ID;
break;
}
}
}
if(EsVehRenta(vehicleid))
{
if(VehRentado[vehicleid])
{
foreach(Player,i)
{
if(GetPVarInt(i,"RentoVehID") == vehicleid)
{
DeletePVar(i,"RentoVehID");
Mensaje(i,-1,"El vehнculo que habias rentado, fue devuelto.");
}
}
}
return 1;
}
else if(EsCamion(vehicleid))
{
foreach(Player,i)
{
if(EsCamionero(i))
{
if(GetPVarInt(i,"Chofer_Camion") == vehicleid)
{
Error(i,"Fallaste tu misiуn de camionero, perdiste el camiуn.");
DeletePVar(i,"Chofer_Camion");
DeletePVar(i,"NivelCamionero");
DeletePVar(i,"PasoEntrega");
}
}
}
strclr(InfoCamion[vehicleid][camChofer]);
InfoCamion[vehicleid][camCarga] = 0;
return 1;
}
else if(EsCosechadora(vehicleid))
{
foreach(Player,i)
{
if(EsCosechador(i))
{
if(GetPVarInt(i,"EstaCultivando") == vehicleid)
{
Error(i,"ЎFallaste tu trabajo de cosechador");
DeletePVar(i,"EstaCultivando");
DeletePVar(i,"ParteCosecha");
if (IsPlayerWhitSpecialBar (i))
{
DestroyPlayerSpecialBar (i);
}
DisablePlayerRaceCheckpoint(i);
}
}
}
}
foreach(Player,i)
{
if(GetPVarInt(i,"CAMION_BASURA") == vehicleid)
{
DeletePVar(i,"TerminoBasura");
DeletePVar(i,"CAMION_BASURA");
DeletePVar(i,"B_ParteLimpieza");
return 1;
}
}
Loop(i, 20, 0)
{
if(VehPrueba[i] != INVALID_VEHICLE_ID)
{
if(VehPrueba[i] == vehicleid)
{
veh_destroy(vehicleid);
VehPrueba[i] = INVALID_VEHICLE_ID;
foreach(Player,p)
{
if(GetPVarInt(p, "ESTADIO_VEHID") == vehicleid)
{
DeletePVar(p, "ESTADIO_VEHID");
break;
}
}
break;
}
}
}
foreach (Player, i)
{
if (PlayerBools [i] & e_LICENCIA)
{
if (PlayerTempData [i][e_VEH_LICENCIA] == vehicleid)
{
CancelLicense (i);
}
}
}
return 1;
}