Motorsystem Fehler

Wichtiger Hinweis: Bitte ändert nicht manuell die Schriftfarbe auf schwarz sondern belasst es bei der Standardeinstellung. Somit tragt ihr dazu bei dass euer Text auch bei Verwendung unseren dunklen Forenstils noch lesbar ist!

Tipp: Ihr wollt längere Codeausschnitte oder Logfiles bereitstellen? Benutzt unseren eigenen PasteBin-Dienst Link
  • Guten Tag,


    obwohl mein Auto 1000 Health besitzt sagt er das er ein Motor Schaden hätte.


    Wo liegt der Fehler?


    if(newkeys == KEY_NO){
    if(GetPlayerVehicleSeat(playerid) == 0){
    new car = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(car) == 509 || GetVehicleModel(car) == 481 || GetVehicleModel(car) == 510){return 1;}
    new vehicleid = GetPlayerVehicleID(playerid), Float:vhp;
    if(GetVehicleHealth(vehicleid, vhp) <= 300)
    {
    SendClientMessage(playerid,Rot,"Dieses Fahrzeug hat einen Motorschaden.");
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    else if(Engine[car] == false){
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = true;
    }
    else{
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    }
    }

  • Deine Anfrage war etwas fail
    so sollte es gehen
    if(newkeys == KEY_NO)
    {
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    new car = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(car) == 509 || GetVehicleModel(car) == 481 || GetVehicleModel(car) == 510)return 1;
    new vehicleid = GetPlayerVehicleID(playerid), Float:vhp;
    if(GetVehicleHealth(vehicleid, vhp) <= 300)
    {
    SendClientMessage(playerid,Rot,"Dieses Fahrzeug hat einen Motorschaden.");
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    else
    {
    if(Engine[car] == false)
    {
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = true;
    }
    else
    {
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    }
    }
    }

    All in all it's just another brick in the wall

  • Du kannst GetVehicleHealth nicht so verwenden.
    Es wird doch extra die Variable mit dem Wert belegt:

    if(newkeys == KEY_NO)
    {
    if(GetPlayerVehicleSeat(playerid) == 0)
    {
    new car = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(car) == 509 || GetVehicleModel(car) == 481 || GetVehicleModel(car) == 510)return 1;
    new Float:vhp;
    GetVehicleHealth(car, vhp)
    if(vhp < 300.0)
    {
    SendClientMessage(playerid,Rot,"Dieses Fahrzeug hat einen Motorschaden.");
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    else
    {
    if(Engine[car] == false)
    {
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = true;
    }
    else
    {
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    }
    }
    }


    MFG Piet

  • Ein weiteres Problem, sobald ich 350 Hp noch hab, steig ich aus und steig wieder ein und kann weiter fahren.


    Wo ist diesmal der Fehler?


    if(newkeys == KEY_NO){
    if(GetPlayerVehicleSeat(playerid) == 0){
    new car = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(car) == 509 || GetVehicleModel(car) == 481 || GetVehicleModel(car) == 510)return 1;
    new Float:vhp;
    GetVehicleHealth(car, vhp);
    if(vhp < 350){
    SendClientMessage(playerid,Rot,"Dieses Fahrzeug hat einen Motorschaden.");
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    return 1;
    }
    else{
    if(Engine[car] == false){
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = true;
    }
    else{
    GetVehicleParamsEx(car,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(car,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[car] = false;
    }
    }
    }
    }


    if(newstate == PLAYER_STATE_DRIVER){
    new vehicleid = GetPlayerVehicleID(playerid), Float:vhp;
    GetVehicleHealth(vehicleid, vhp);
    if(vhp < 350){
    SendClientMessage(playerid,Rot,"Dieses Fahrzeug hat einen Motorschaden.");
    GetVehicleParamsEx(vehicleid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vehicleid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Engine[vehicleid] = false;
    }
    }