Hallo,
ich bekomme ständig während des Spielens diese Debug Nachricht:
Code
[21:41:50] [debug] Run time error 4: "Array index out of bounds"
[21:41:50] [debug] Accessing element at negative index -400
[21:41:50] [debug] AMX backtrace:
[21:41:50] [debug] #0 0002c584 in public Speedometer (playerid=0) at
Und das soll in der Zeile 16 im unteren code sein:
Code
public Speedometer(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
//TextDrawHideForPlayer(playerid, Profico[playerid]);
//TextDrawHideForPlayer(playerid, punkenun[playerid]);
new vehicleid,Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,speed_string[256],final_speed_int, Float:chealth;
vehicleid = GetPlayerVehicleID(playerid);
GetVehicleVelocity(vehicleid,speed_x,speed_y,speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*175; // 136.666667 = kmph // 85.4166672= mph
final_speed_int = floatround(final_speed,floatround_round);
GetVehicleHealth(vehicleid, chealth);
new LocationZone[MAX_ZONE_NAME];
GetPlayer2DZone(playerid, LocationZone, MAX_ZONE_NAME);
format(speed_string,200,"~B~Fahrzeug: ~W~%s~n~~B~Km/h: ~W~%d km/h~n~~B~Benzin: ~W~%dl/%dl~n~~B~GPS: ~W~%s",VehicleName[GetVehicleModel(vehicleid)-400], final_speed_int, Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)), LocationZone);
TextDrawSetString(Speedo[playerid], speed_string);
}
return 1;
}
Alles anzeigen