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)))
{
TextDrawHideForPlayer(i, Copyright);
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(SpeedoON[i] == 0)
{
TextDrawShowForPlayer(i, box[i]); TextDrawShowForPlayer(i, fahrzeug[i]); TextDrawShowForPlayer(i, kmh[i]);
TextDrawShowForPlayer(i, hoehe[i]); TextDrawShowForPlayer(i, zustand[i]);
SpeedoON[i] = 1;
}
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))*136.666667; // 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: ~y~%s",VehicleName[GetVehicleModel(GetPlayerVehicleID(i))-400]);
TextDrawSetString(fahrzeug[i], str1);
if(kmh_anzahl >= 150)
{
format(str2,sizeof(str2),"KM/H: ~r~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 90)
{
format(str2,sizeof(str2),"KM/H: ~y~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else if(kmh_anzahl >= 40)
{
format(str2,sizeof(str2),"KM/H: ~g~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
else
{
format(str2,sizeof(str2),"KM/H: ~b~%d",kmh_anzahl);
TextDrawSetString(kmh[i], str2);
}
new vehicleid = GetPlayerVehicleID(i);
format(str3,sizeof(str3),"Tank: ~g~%d / %d Liter", Gas[vehicleid],GetGasMax(GetVehicleModel(vehicleid)));
TextDrawSetString(hoehe[i], str3);
if(Speedo_HP >= 551)
{
format(str4,sizeof(str4),"Zustand: ~g~%.2f", Speedo_HP);
TextDrawSetString(zustand[i], str4);
}
else if(Speedo_HP >= 361)
{
format(str4,sizeof(str4),"Zustand: ~y~%.2f", Speedo_HP);
TextDrawSetString(zustand[i], str4);
}
else
{
format(str4,sizeof(str4),"Zustand: ~r~%.2f", Speedo_HP);
TextDrawSetString(zustand[i], str4);
}
}
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, hoehe[i]); TextDrawHideForPlayer(i, zustand[i]);
TextDrawShowForPlayer(i, Copyright);
SpeedoON[i] = 0;
die cars verschwinden bei ausloggen
Function CheckGas()
{
new string[256];
for(new i=0;i<MAX_PLAYERS;i++)
{
if(IsPlayerConnected(i))
{
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
{
new vehicle = GetPlayerVehicleID(i);
new Model = GetVehicleModel(GetPlayerVehicleID(i));
if(Gas[vehicle] >= 1)
{
if(Gas[vehicle] <= 10) { PlayerPlaySound(i, 1085, 0.0, 0.0, 0.0); }
if(gGas[i] == 1) {
format(string, sizeof(string), "~r~~n~~n~~n~~n~~n~~n~~n~~n~~n~Benzin:~w~ %d%",Gas[vehicle]);
GameTextForPlayer(i,string,15500,3); }
if(IsAPlane(vehicle) || IsABoat(vehicle) || Model == 462 || Model == 481)
{
Gas[vehicle]++;
}
new engine,lights,alarm,doors,bonnet,boot,objective;
new vid = GetPlayerVehicleID(i);
GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
if(vid != INVALID_VEHICLE_ID)
{
if(engine == VEHICLE_PARAMS_ON)
{
Gas[vehicle]--;
}
}
}
else
{
NoFuel[i] = 1;
FreezePlayer(i);
GameTextForPlayer(i,"~w~~n~~n~~n~~n~~n~~n~~n~~n~Kein Benzin mehr~n~Gib /exit zum ausgestiegen ein",1500,3);
}
if(Gas[vehicle] > GetGasMax(GetVehicleModel(vehicle)))
{
Gas[vehicle] = GetGasMax(GetVehicleModel(vehicle));
}
}
}
}
return 1;
}