01.09.2013, 23:03
Hi i have some problems with crashdetect.dll !
[01:52:45] [debug] Run time error 4: "Array index out of bounds"
[01:52:45] [debug] Accessing element at index 500 past array upper bound 301
[01:52:45] [debug] AMX backtrace:
[01:52:45] [debug] #0 0006f8ec in public OnPlayerStateChange () from 1.amx
[01:52:45] [debug] Aborting...
Code:
public CheckGas()
{
for(new i=1; i<= MAX_VEHICLES; i++)
{
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON && alarmon[i] == 0)
{
if(IsAPlane(i) == 0 && IsABoat(i) == 0 && IsABmx(i) == 0 && Gas[i] > 0 && i != 307 && i != 308 && i != 171 &&i != 172 && i != 173 && i != 174 && i != 161 && i != 162 && i != 163)
{
Gas[i]--;
foreach(Player, o)
{
new Float:Viteza = GetVehicleSpeed_P(o);
if(Viteza > 5 && GetPlayerState(o) == PLAYER_STATE_DRIVER && GetPlayerVehicleID(o) == i)
{
CarData[i-PreVehicle][cKM]++;
new query[MAX_STRING];
format(query, sizeof(query), "UPDATE mnxmasini SET KM='%d' WHERE id=%d", CarData[i-PreVehicle][cKM], i-PreVehicle);
mysql_query(query);
}
}
}
}
}
foreach(Player, i)
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
}
else
{
GetVehicleParamsEx(vehicle,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(vehicle,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~Numai ai benzina",1500,3);
}
}
}
return 1;
}
[01:52:45] [debug] Accessing element at index 500 past array upper bound 301
[01:52:45] [debug] AMX backtrace:
[01:52:45] [debug] #0 0006f8ec in public OnPlayerStateChange () from 1.amx
[01:52:45] [debug] Aborting...

