Guten Tag,
Ich habe ein Plugin drin das mir sagt warum der server abstürz
Das ist der Fehler Code: das Spammt meinen Ganzen Server Log voll!
[14:27:53] [debug] AMX backtrace:
[14:27:53] [debug] #0 000b161c in public CheckGas () from sRP.amx
[14:27:59] [debug] Run time error 4: "Array index out of bounds"
[14:27:59] [debug] Accessing element at negative index -400
CheckGas ist ein Timer der alle 5 Sekunden gemacht wird wo liegt das problem ?
Function CheckGas()
{
if(serverinfotext == 0)
{
SendRconCommand("gamemodetext "#SERVERVERSION"");
serverinfotext = 1;
}
else if(serverinfotext == 1)
{
SendRconCommand("gamemodetext It's unstoppable");
serverinfotext = 0;
}
for(new i=0;i<MAX_VEHICLES;i++)
{
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
if(Fahrzeug[i][Gas] >= 0.01 && !IsANoTachoVehicle(i))
{
/*if(Gas[vehicle] <= 10)
{
PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0);
}*/
if(engine == VEHICLE_PARAMS_ON && GetVehicleSpeed(i) < 1)
{
Fahrzeug[i][Gas]-=0.01;
}
if(engine == VEHICLE_PARAMS_ON && GetVehicleSpeed(i) >= 1 && GetVehicleSpeed(i) <= 50)
{
Fahrzeug[i][Gas]-=VehicleInfo[GetVehicleModel(i)-400][vTankverbrauch]/2;
}
if(engine == VEHICLE_PARAMS_ON && GetVehicleSpeed(i) >= 50 && GetVehicleSpeed(i) <= 100)
{
Fahrzeug[i][Gas]-=VehicleInfo[GetVehicleModel(i)-400][vTankverbrauch];
}
if(engine == VEHICLE_PARAMS_ON && GetVehicleSpeed(i) >= 100 && GetVehicleSpeed(i) <= 150)
{
Fahrzeug[i][Gas]-=VehicleInfo[GetVehicleModel(i)-400][vTankverbrauch]/2*3;
}
if(engine == VEHICLE_PARAMS_ON && GetVehicleSpeed(i) >= 150 && GetVehicleSpeed(i) <= 200)
{
Fahrzeug[i][Gas]-=VehicleInfo[GetVehicleModel(i)-400][vTankverbrauch]*2;
}
if(engine == VEHICLE_PARAMS_ON && GetVehicleSpeed(i) >= 200)
{
Fahrzeug[i][Gas]-=VehicleInfo[GetVehicleModel(i)-400][vTankverbrauch]/2*5;
}
if(Fahrzeug[i][Gas] > VehicleInfo[GetVehicleModel(i)-400][vTank])
{
Fahrzeug[i][Gas] = VehicleInfo[GetVehicleModel(i)-400][vTank];
}
}
else if(Fahrzeug[i][Gas] < 0.01 && !IsANoTachoVehicle(i))
{
SetVehicleParamsEx(i,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
Fahrzeug[i][motor] = 0;
}
}
for(new i=0;i<MAX_VEHICLES;i++)
{
GetVehicleParamsEx(i,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_OFF && lights == VEHICLE_PARAMS_ON && !IsANoTachoVehicle(i))
{
voltsec[i]++;
if(voltsec[i] >= 600/5)
{
Fahrzeug[i][Volt]--;
voltsec[i]=0;
if(Fahrzeug[i][Volt] <= 0)
{
SetVehicleParamsEx(i,engine,VEHICLE_PARAMS_OFF,alarm,doors,bonnet,boot,objective);
Fahrzeug[i][licht] = 0;
Fahrzeug[i][Volt] = 0;
return 1;
}
return 1;
}
return 1;
}
else if(engine == VEHICLE_PARAMS_ON && !IsANoTachoVehicle(i))
{
if(GetVehicleSpeed(i) < 1)
{
voltsec[i]+=1;
}
if(GetVehicleSpeed(i) >= 1 && GetVehicleSpeed(i) <= 100)
{
voltsec[i]+=2;
}
if(GetVehicleSpeed(i) >= 101 && GetVehicleSpeed(i) <= 200)
{
voltsec[i]+=3;
}
if(voltsec[i] >= 900/5)
{
Fahrzeug[i][Volt]++;
voltsec[i]=0;
if(Fahrzeug[i][Volt] >= 12)
{
Fahrzeug[i][Volt] = 12;
}
return 1;
}
return 1;
}
voltsec[i]=0;
}
return 1;
}