Habe ein Problem mit meinem Thermomat.
Und zwar wenn ich H drücken nimmt er die geschwindigkeit die ich gerade fahr
ABER wenn ich noch mal H drücken kann ich hält er die ganze zeit die geschwindigkeit 0
Ich glaube das liegt hierdran
PlayerCruiseSpeed[playerid] = 0.00;
Hier mal der Code
new CCKey = KEY_CROUCH;
else if(PRESSED(CCKey)&& IsPlayerInAnyVehicle(playerid) && GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
{
if (PlayerCruiseSpeed[playerid] == 0.00)
{
new vid = GetPlayerVehicleID(playerid);
if (GetVehicleSpeed(vid) == 0) return false;
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vid, x, y, z);
GetVehicleZAngle(vid, PlayerHeadingAngle[playerid]);
DistanceFlat(0, 0, x, y, PlayerCruiseSpeed[playerid]);
SetTimerEx("CruiseControl", 250, false, "d", playerid);
GameTextForPlayer(playerid, "~w~Tempomat~n~~g~an", 1000, 1);
}
else
{
PlayerCruiseSpeed[playerid] = 0.00;
GameTextForPlayer(playerid, "~w~Tempomat~n~~r~aus", 2000, 1);
return false;
}
}
public CruiseControl(playerid)
{
new vid = GetPlayerVehicleID(playerid);
new Float:x, Float:y, Float:z;
GetVehicleVelocity(vid, x, y, z);
new keys, ud, lr;
GetPlayerKeys(playerid, keys, ud, lr);
new Float:angle, Float:heading, Float:speed;
GetVehicleZAngle(vid, angle);
GetVehicleHeadingAngle(vid, heading);
DistanceFlat(0, 0, x, y, speed);
if (PlayerCruiseSpeed[playerid] == 0.00 ||
GetPlayerState(playerid) != PLAYER_STATE_DRIVER ||
(speed < 0.7 * PlayerCruiseSpeed[playerid]) || //if player slowed down too much
z > 1 || //if car is going upwards too fast
(floatabs(angle - heading) > 50 && floatabs(angle - heading) < 310))//if vehicle goes sideways
{
}
GetVehicleZAngle(vid, PlayerHeadingAngle[playerid]);
GetXYVelocity(vid, x, y, PlayerCruiseSpeed[playerid]);
SetVehicleVelocity(vid, x, y, z);
return SetTimerEx("CruiseControl", 250, false, "d", playerid);
}
mfg JoJu_REd
danke im vorraus