24.06.2015, 09:24
A ver tengo el crash detect y me salta esta advertencia
Esto es el code completo:
Y la linea del error es esta:
Alguien me dice que pasa allн? de cierto modo el velocнmetro en el juego abre cuando le da la gana.
Quote:
[03:22:35] [debug] Run time error 4: "Array index out of bounds" [03:22:35] [debug] Accessing element at negative index -400 [03:22:35] [debug] AMX backtrace: [03:22:35] [debug] #0 0034fca0 in public SpeedoUpdate () at C:\Users\Administrador\Desktop\ExtremoRP\gamemodes \ExtremoRP.pwn:54913 |
PHP код:
public SpeedoUpdate()
{
for(new i = 0; i<MAX_PLAYERS; i++)
{
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
new veh = GetPlayerVehicleID(i);
GetVehicleVelocity(veh, speed_x, speed_y, speed_z);
final_speed = floatsqroot(((speed_x*speed_x)+(speed_y*speed_y))+(speed_z*speed_z))*120.0;
final_speed_int = floatround(final_speed,floatround_round);
new kmh_anzahl = final_speed_int;
new kmh[10],zustand[30],tank[10],cars[50];
format(kmh, 10,"KM/H: %d", kmh_anzahl);
new Float:hp;
GetVehicleHealth(GetPlayerVehicleID(i), hp);
if(hp > 700){format(zustand, 30,"Estado: ~g~%.0f", hp);}
if(hp < 700){format(zustand, 30,"Estado: ~y~%.0f", hp);}
if(hp < 350){format(zustand, 30,"Estado: ~r~%.0f", hp);}
if(hp < 250){format(zustand, 30,"Estado: ~r~%s", "BOOM");}
format(tank, 10,"Gas: %d", VehicleFuel[veh]);
format(cars, 50,"Modelo: %s", VehicleName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
TextDrawSetString(Tacho_KMH[i], kmh);
TextDrawSetString(Tacho_Zustand[i], zustand);
TextDrawSetString(Tacho_Tank[i], tank);
TextDrawSetString(Tacho_Car[i], cars);
}
return 1;
}
PHP код:
format(cars, 50,"Modelo: %s", VehicleName[GetVehicleModel(GetPlayerVehicleID(i))-400]);