/MOD: Keine unnötigen Vollzitate bitte
Corvus:
Ich habe den Code getestet, der funktioniert.
Hast du Kilometer als Integer definiert? Poste mal alles von dem Code.
Kompletter Code:
forward CheckGas(playerid);
public CheckGas(playerid)
{
for(new i=0; i<MAX_PLAYERS; i++)
{
if(IsPlayerNPC(i)) continue;
new veh = GetPlayerVehicleID(i), string[32];
if(veh)
{
if(!MotorSystemMotor[veh]) continue;
if(Gas[veh] <= 0)
{
new engine,lights,alarm,doors,bonnet,boot,objective;
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
MotorSystemMotor[veh] = false;
}
new Float:ST[4];
GetVehicleVelocity(veh,ST[0],ST[1],ST[2]);
ST[3] = floatsqroot(floatpower(floatabs(ST[0]), 2.0) + floatpower(floatabs(ST[1]), 2.0) + floatpower(floatabs(ST[2]), 2.0)) / 1000.0;
Kilometer[veh] += ST[3];
format(string, sizeof string, "Kilometer: %d Km", floatround(Kilometer[veh]));
TextDrawSetString(Tacho7[playerid],string);
if(Gas[veh] <= 0) SendClientMessage(i, COLOR_YELLOW, "Boardcomputer: Tank leer, der Motor ist abgestorben.");
}
}
new engine,lights,alarm,doors,bonnet,boot,objective;
for(new i=0; i<MAX_VEHICLES; i++)
{
GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
if(engine)
{
Gas[i]--;
}
}
return 1;
}
format(string,sizeof(string),"~r~%s",VehNames[GetVehicleModel(VID)-400]);
format(string1,sizeof(string1),"~r~KM/H:~g~ %d",value);
format(string2,sizeof(string2),"~r~Tank:~g~ %s %d", Tank, Gas[VID]);
format(string4,sizeof(string4),"~r~Zustand:~g~ %.1f",leben/10);
format(string3,sizeof(string3),"~r~KM:~g~ %i.%i",Fahrzeug[VID][Meter]/1000,Fahrzeug[VID][Meter]00);
TextDrawSetString(Tacho3[playerid], string);
TextDrawSetString(Tacho4[playerid],string1);
TextDrawSetString(Tacho6[playerid],string2);
TextDrawSetString(Tacho5[playerid],string4);
TextDrawSetString(Tacho7[playerid],string3);
public SekundenTimer6()
{
new string[500],
Float:maxspeed = 200.0,
playername[MAX_PLAYER_NAME],
value,
Float:xX,
Float:yY,
Float:zZ,
Float:X,
Float:Y,
Float:Z,
string2[40],
string1[40],
string3[40],
string4[40];
ForAllPlayers(i){if(IsPlayerConnected(i) && gPlayerLogged[i] && !IsPlayerNPC(i) && AFKModus[i] == 0)
{
new VID = GetPlayerVehicleID(i);
if(IsPlayerInAnyVehicle(i))
{
if(GetPlayerState(i) == 2)
{
GetVehicleVelocity(GetPlayerVehicleID(i) ,X, Y, Z);
value = floatround(floatsqroot((X*X) + (Y*Y) + (Z*Z)) * 100 * 1.40);
if(value > maxspeed && PlayerInfo[i][pSQLID] != 1)
{
new tmpcar = GetPlayerVehicleID(i);
if(!IsAPlane(tmpcar))
{
// new VID = GetPlayerVehicleID(i);
GetPlayerName(i, playername, sizeof(playername));
GetVehiclePos(VID, xX, yY, zZ);
format(string, sizeof(string), "AdmWarnung: %s(ID: %d) %d KM/H Position: %f,%f,%f", playername, i, value, xX, yY, zZ);
SendAdminMessage(COLOR_KNALLROT, -1, string);
}
}
}
if(IsABoat(VID) || IsAFahrrad(VID))
{
// new VID = GetPlayerVehicleID(i);
format(string2,sizeof(string2),"~r~KM/H:~g~ %d",value);
format(string,sizeof(string),"~r~%s",VehNames[GetVehicleModel(VID)-400]);
TextDrawSetString(Tacho2[i], string);
TextDrawSetString(Tacho4[i],string2);
}
else if(IsAPlane(VID))
{
// new VID = GetPlayerVehicleID(i);
new Float:cx,Float:cy,Float:cz;
GetVehiclePos(VID,cx, cy, cz);
format(string, sizeof(string), "%f",cz);
format(string2,sizeof(string2),"~r~KM/H:~g~ %d",value);
format(string,sizeof(string),"~r~%s",VehNames[GetVehicleModel(VID)-400]);
TextDrawSetString(Tacho2[i], string);
TextDrawSetString(Tacho4[i],string2);
}
else
{
new Speed[20];
new Float:leben;
if(value >= 0 && value <= 75){Speed = "~g~";}
if(value > 75){Speed = "~r~";}
new Tank[20];
if(Gas[VID] > 10 && Gas[VID] <= 20){Tank = "~y~";}
if(Gas[VID] <= 10){Tank = "~r~";}
if(Gas[VID] > 20){Tank = "~g~";}
VehSpeed[VID] = value;
GetVehicleHealth(VID,leben);
new fID = GetPlayerVehicleID(i);
Fahrzeug[fID][Meter] += GetVehicleDistanz(fID);
GetVehiclePos(fID,Fahrzeug[fID][PosXLast],Fahrzeug[fID][PosYLast],Fahrzeug[fID][PosZLast]);
format(string,sizeof(string),"~r~%s",VehNames[GetVehicleModel(VID)-400]);
format(string1,sizeof(string1),"~r~KM/H:~g~ %d",value);
format(string2,sizeof(string2),"~r~Tank:~g~ %s %d", Tank, Gas[VID]);
format(string4,sizeof(string4),"~r~Zustand:~g~ %.1f",leben/10);
format(string3,sizeof(string3),"~r~KM:~g~ %i.%i",Fahrzeug[fID][Meter]/1000,Fahrzeug[fID][Meter]%1000);
TextDrawSetString(Tacho3[i], string);
TextDrawSetString(Tacho4[i],string1);
TextDrawSetString(Tacho5[i],string4);
TextDrawSetString(Tacho6[i],string2);
TextDrawSetString(Tacho7[i],string3);
}
}
else
{
TextDrawHideForPlayer(i, Tacho[i]);
}
new IsInNoDm = 0;
for(new ZI = 0; ZI < sizeof(NODMZonenInfo); ZI++)
{
if(IsPlayerInArea(i, NODMZonenInfo[ZI][NODMMinX],NODMZonenInfo[ZI][NODMMinY],NODMZonenInfo[ZI][NODMMaxX],NODMZonenInfo[ZI][NODMMaxY]))
{
IsInNoDm += 1;
break;
}
}
if(IsInNoDm == 1)
{
NoDmTimer[i] += 1;
TextDrawShowForPlayer(i, NODMZoneTextdraw);
}
else
{
NoDmTimer[i] = 0;
NoDmWarnungen[i] = 0;
TextDrawHideForPlayer(i, NODMZoneTextdraw);
}
// CheckNODMZone Ende
}
}
return 1;
}