Hallo ich bekomme immer ein error wenn ich mein Motor anmache und der Timer startet.
HIER DER ERROR:
[21:24:06] [debug] Run time error 4: "Array index out of bounds"
[21:24:06] [debug] Accessing element at negative index -400
[21:24:06] [debug] AMX backtrace:
[21:24:06] [debug] #0 000414b8 in public vehTimer (7, 0) from selfmade.amx
HIER DER TIMER:
forward vehTimer(playerid,vehicleid);
public vehTimer(playerid,vehicleid)
{
new string[220];
//FAHRZEUGNAME
format(string,sizeof(string),"%s",VehicleNames[GetVehicleModel(GetPlayerVehicleID(playerid)) - 400]);
PlayerTextDrawSetString(playerid,Tachoname[playerid],string);
//KMH
format(string,sizeof(string),"Geschwindigkeit: %i Km/H",getPlayerSpeed(playerid));
PlayerTextDrawSetString(playerid,Tachokmh[playerid],string);
//TANK
format(string,sizeof(string),"Tank: %i/%i L",Tankmenge[GetPlayerVehicleID(playerid)],GasMax[GetVehicleModel(GetPlayerVehicleID(playerid))-400]);
PlayerTextDrawSetString(playerid,Tachotank[playerid],string);
//TANKART
format(string,sizeof(string),"Treibstoff: %s",Gasname(GetPlayerVehicleID(playerid)));
PlayerTextDrawSetString(playerid,Tachoart[playerid],string);
//MOTOR
if(motor[GetPlayerVehicleID(playerid)] == false)
{
PlayerTextDrawColor(playerid,Tachom[playerid],rot);
}
else
{
PlayerTextDrawColor(playerid,Tachom[playerid],grün);
}
return 1;
}