PDA

View Full Version : help pls :D


SheerlockHolmess
07/03/2017, 01:13 AM
They could help me I have these mistakes I'm sorry for my bad english



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)

X337
07/03/2017, 01:17 AM
Can you post your codes under OnVehicleSpawn callback?

SheerlockHolmess
07/03/2017, 01:32 AM
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;
}


public OnVehicleSpawn(vehicleid) {

#if defined opvehicle_OnVehicleSpawn
opvehicle_OnVehicleSpawn(vehicleid);
#endif

veh_refuel(vehicleid);

if (veh_getType(vehicleid) == VEH_TYPE_OWNVEH || veh_getType(vehicleid) == VEH_TYPE_SELLVEH) {
veh_applySpawnInfo(vehicleid);
}
return 1;
}