/================================ Motor an/aus =======================================================
if(newkeys == KEY_NO)
{
if(GetPlayerVehicleSeat(playerid) == 0)
{
new car = GetPlayerVehicleID(playerid);
if(GetVehicleModel(car) == 509 || GetVehicleModel(car) == 481 || GetVehicleModel(car) == 510)
{
SendClientMessage(playerid, ROT, "Du sitzt auf einem Fahrrad, das keinen Motor hat.");
return 1;
}
if (Tank[car] < 1)
{
SendClientMessage(playerid, ROT, "Dein Tank ist leer.");
return 1;
}
if (Motor[car] == false )
{
if(Motorschaden[car] == true) return SendClientMessage(playerid, ROT, "Motor Kaputt");
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
PlayerTextDrawSetString(playerid, MotorStatus[playerid],"~b~Motor: ~g~an");
Motor[car] = true;
TankTimer[car] = SetTimerEx("BenzinVerlust",5000,1,"i",car);
}
else
{
GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
PlayerTextDrawSetString(playerid, MotorStatus[playerid], "~b~Motor: ~r~aus");
Motor[car] = false;
KillTimer(TankTimer[car]);
}
}
return 1;
}
Probier es mal so rum und mach bei OnPlayerKeyStateChange das SetTimerEx weg
Ansonsten weiß ich nicht weiter...
Gut Aber guck dir trotzdem mal an was ich geändert habe
Ist etwas optimierter