Huhu ihr lieben,
ich habe das Problem, das Tacho wird InGame nicht angezeigt. (beim Roller)
Die Log:
[13:57:55] [debug] Run time error 4: "Array index out of bounds"
[13:57:55] [debug] Accessing element at index 842 past array upper bound 699
[13:57:55] [debug] AMX backtrace:
[13:57:55] [debug] #0 00039434 in public OtherTimer () from x-1-0-0.amx
[13:57:56] [debug] Run time error 4: "Array index out of bounds"
[13:57:56] [debug] Accessing element at index 842 past array upper bound 699
[13:57:56] [debug] AMX backtrace:
[13:57:56] [debug] #0 00039434 in public OtherTimer () from x-1-0-0.amx
Unter OtherTimer:
public OtherTimer()
{
new Float:maxspeed = 175.0;
new plname[MAX_PLAYER_NAME];
new string[256];
new Float:Speedo_X,Float:Speedo_Y,Float:Speedo_Z;
new Float:Speedo_HP;
for(new i=0; i<SLOTS; i++)
{
if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i) && !IsANoTachoVehicle(GetPlayerVehicleID(i)))
{
GetPlayerPos(i, Speedo_X, Speedo_Y, Speedo_Z);
GetPlayerVehicleID(i);
GetVehicleHealth(GetPlayerVehicleID(i), Speedo_HP);
new str1[256],str2[256],str3[256],str4[256];
if(TachoAn[i] == 0)
{
TextDrawShowForPlayer(i, box[i]); TextDrawShowForPlayer(i, fahrzeug[i]); TextDrawShowForPlayer(i, kmh[i]);
TextDrawShowForPlayer(i, tank[i]); TextDrawShowForPlayer(i, zustand[i]); ShowProgressBarForPlayer(i, BarZustand[i]); TextDrawShowForPlayer(i, KilometerAnzeige[i]); TextDrawShowForPlayer(i, StatusAnzeige[i]);
TachoAn[i] = 1;
}
new veh = GetPlayerVehicleID(i);
new Float:speed_x,Float:speed_y,Float:speed_z,Float:final_speed,final_speed_int;
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; // 136.666667 = kmph // 85.4166672= mph
final_speed_int = floatround(final_speed,floatround_round);
new kmh_anzahl = final_speed_int;
format(str1,sizeof(str1),"Fahrzeug: ~b~%s ~n~~l~---------------------------------",VehicleName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
TextDrawSetString(fahrzeug[i], str1);
if(kmh_anzahl >= 150)
{
format(str2,sizeof(str2),"KM/H: ~r~%d ~n~~l~---------------------------------",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 100)
{
format(str2,sizeof(str2),"KM/H: ~y~%d ~n~~l~---------------------------------",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 50)
{
format(str2,sizeof(str2),"KM/H: ~g~%d ~n~~l~---------------------------------",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else
{
format(str2,sizeof(str2),"KM/H: ~b~%d ~n~~l~---------------------------------",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
new vehicleid = GetPlayerVehicleID(i);
format(str3,sizeof(str3),"Tank: ~g~%d / %d Liter ~n~~l~---------------------------------", Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)));
TextDrawSetString(tank[i], str3);
if(kmh_anzahl == 0) {}
else
{
Kilometer[vehicleid] += final_speed*0.0008;
}
format(str4,sizeof(str4),"Kilometer: ~g~%d ~n~~l~---------------------------------",floatround(Kilometer[vehicleid],floatround_floor));
TextDrawSetString(KilometerAnzeige[i], str4);
if(Speedo_HP >= 551)
{
SetProgressBarColor(BarZustand[i], 0x00A628FF);
}
else if(Speedo_HP >= 361)
{
SetProgressBarColor(BarZustand[i], 0xFFA300FF);
}
else
{
SetProgressBarColor(BarZustand[i], 0xFF0000FF);
}
SetProgressBarValue(BarZustand[i], floatround(Speedo_HP,floatround_round)-281);
UpdateProgressBar(BarZustand[i], i);
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine == VEHICLE_PARAMS_ON && lights == VEHICLE_PARAMS_OFF)
{
TextDrawSetString(StatusAnzeige[i], " ~g~Motor~w~ - ~r~Licht");
}
else if(engine == VEHICLE_PARAMS_ON && lights == VEHICLE_PARAMS_ON)
{
TextDrawSetString(StatusAnzeige[i], " ~g~Motor~w~ - ~g~Licht");
}
else if(engine == VEHICLE_PARAMS_OFF && lights == VEHICLE_PARAMS_ON)
{
TextDrawSetString(StatusAnzeige[i], " ~r~Motor~w~ - ~g~Licht");
}
else if(engine == VEHICLE_PARAMS_OFF && lights == VEHICLE_PARAMS_OFF)
{
TextDrawSetString(StatusAnzeige[i], " ~r~Motor~w~ - ~r~Licht");
}
else if(engine == VEHICLE_PARAMS_ON)
{
TextDrawSetString(StatusAnzeige[i], " ~g~Motor~w~ - ~r~Licht");
}
else
{
TextDrawSetString(StatusAnzeige[i], " ~r~Motor~w~ - ~r~Licht");
}
}
SavePlayerPos[i][sX] = Speedo_X, SavePlayerPos[i][sY] = Speedo_Y, SavePlayerPos[i][sZ] = Speedo_Z;
}
for(new i=0; i<SLOTS; i++)
{
if(!IsPlayerInAnyVehicle(i))
{
TextDrawHideForPlayer(i, box[i]); TextDrawHideForPlayer(i, fahrzeug[i]); TextDrawHideForPlayer(i, kmh[i]);
TextDrawHideForPlayer(i, tank[i]); TextDrawHideForPlayer(i, zustand[i]); HideProgressBarForPlayer(i, BarZustand[i]); TextDrawHideForPlayer(i, KilometerAnzeige[i]); TextDrawHideForPlayer(i, StatusAnzeige[i]);
TachoAn[i] = 0;
}
}
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(SafeTime[i] > 0)
{
SafeTime[i]--;
}
if(SafeTime[i] == 1)
{
if(gPlayerAccount[i] == 1 && gPlayerLogged[i] == 0)
{
SendClientMessage(i, COLOR_WHITE, "");
}
}
if(GetPlayerState(i) == 2)
{
GetPlayerPos(i, TelePos[i][3], TelePos[i][4], TelePos[i][5]);
if(TelePos[i][5] > 550.0)
{
TelePos[i][0] = 0.0;
TelePos[i][1] = 0.0;
}
if(TelePos[i][0] != 0.0)
{
new Float:xdist = TelePos[i][3]-TelePos[i][0];
new Float:ydist = TelePos[i][4]-TelePos[i][1];
new Float:sqxdist = xdist*xdist;
new Float:sqydist = ydist*ydist;
new Float:distance = (sqxdist+sqydist)/31;
if(gSpeedo[i] == 2)
{
if(distance <10)
{
format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
}
if(distance > 10 && distance < 100)
{
format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
}
if(distance > 100)
{
format(string, 256, "~n~~n~~n~~n~~n~~n~~n~~g~mph : ~w~%.0f",distance);
}
GameTextForPlayer(i, string, 2000, 5);
}
if(distance > maxspeed && PlayerInfo[i][pAdmin] < 1)
{
new tmpcar = GetPlayerVehicleID(i);
if(!IsAPlane(tmpcar))
{
GetPlayerName(i, plname, sizeof(plname));
format(string, 256, "[!]: [%d]%s %.0f km/h",i,plname,distance);
ABroadCast(COLOR_YELLOW,string,1);
}
}
}
if(TelePos[i][5] < 550.0 && TelePos[i][3] != 0.0)
{
TelePos[i][0] = TelePos[i][3];
TelePos[i][1] = TelePos[i][4];
}
}
if(CellTime[i] > 0)
{
if (CellTime[i] == cchargetime)
{
CellTime[i] = 1;
if(Mobile[Mobile[i]] == i)
{
CallCost[i] = CallCost[i]+callcost;
}
}
CellTime[i] = CellTime[i] +1;
if (Mobile[Mobile[i]] == 255 && CellTime[i] == 5)
{
if(IsPlayerConnected(Mobile[i]))
{
new called[MAX_PLAYER_NAME];
GetPlayerName(Mobile[i], called, sizeof(called));
format(string, sizeof(string), "* %s's Handy klingelt.", called);
RingTone[Mobile[i]] = 10;
ProxDetector(30.0, Mobile[i], string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
}
}
}
if(CellTime[i] == 0 && CallCost[i] > 0)
{
format(string, sizeof(string), "~w~Der Anruf kostet~n~~r~$%d",CallCost[i]);
GivePlayerMoney(i, -CallCost[i]);
SBizzInfo[2][sbTill] += CallCost[i];
ExtortionSBiz(2, CallCost[i]);
GameTextForPlayer(i, string, 5000, 1);
CallCost[i] = 0;
}
if(TransportTime[i] > 0)
{//Taxi driver and passenger only
if(TransportTime[i] >= 16)
{
TransportTime[i] = 1;
if(TransportDriver[i] < 999)
{
if(IsPlayerConnected(TransportDriver[i]))
{
TransportCost[i] += TransportValue[TransportDriver[i]];
TransportCost[TransportDriver[i]] = TransportCost[i];
}
}
}
TransportTime[i] += 1;
format(string, sizeof(string), "~r~%d ~w~: ~g~$%d",TransportTime[i],TransportCost[i]);
GameTextForPlayer(i, string, 15000, 6);
}
}
}
return 1;
}
Ich hoffe ihr könnt mir helfen. (Alle Dinge sind natürlich auch defined.)