Motor lässt sich nicht ausschalten

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
  • hallo habe nen problem mein Motor lässt sich zwar anschalten aber nicht abschalten wieso?


    if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }


    Danke euch
    mfg.
    bacardi

    Einmal editiert, zuletzt von Bacardi ()

  • Ich denke du musst unten Abfragen ob der Motor an ist, also ich weiß nicht genau wie man das Abfragt aber teste es mal so :


    if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 1)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }



    Edit :
    Verbessert
    Nochmal verbessert

    Einmal editiert, zuletzt von Application ()

  • bekomme errors (klammerfehler)


    //edit : Kann keiner helfen.

    Einmal editiert, zuletzt von Bacardi ()

  • if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 1)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }


    versuch mal so

  • if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 1)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }



    Mit freundlichen Grüßen,

  • das isn klmammerfehler
    }
    else
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 1)



    geht also nicht

  • if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else if(Motor[GetPlayerVehicleID(playerid)] == 1)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }


    das müsste klappen

  • alle normal er lässt sich zwar starten aber nicht abschalten
    //edit: kann keiner helfen?

    Einmal editiert, zuletzt von Bacardi ()

  • if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }

    Gruß
    keyboy

    www.g4e-clan.de


    Kein (unbez.) Scripting-Support per PN | Dafür ist das Forum da.

  • komplett ist es so Maxx
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    new string[256];
    new Motor[MAX_VEHICLES];
    new vid = GetPlayerVehicleID(playerid);
    if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[GetPlayerVehicleID(playerid)] == 0)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 1;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    Motor[GetPlayerVehicleID(playerid)] = 0;
    return 1;
    }
    }
    }
    return 1;
    }

  • Ich würde es so probieren:
    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    new string[256];
    new bool:Motor[MAX_VEHICLES];
    new vid = GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective;
    if (newkeys == KEY_FIRE) // Motor An/Aus
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    if(Motor[vid] == false)
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,1,lights,alarm,doors,bonnet,boot,objective);
    Motor[vid] = true;
    return 1;
    }
    else
    {
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(vid,0,lights,alarm,doors,bonnet,boot,objective);
    Motor[vid] = false;
    return 1;
    }
    }
    }
    return 1;
    }
    Ungetestet, unkompiliert ;)
    MfG
    Maxx

  • Danke dir werde es mal testen. ich editiere es wenn es geht oder nicht geht.
    //edit: ne geht nicht :( kann denn keiner helfen, da muss es doch nen problem geben :(

  • teste es mal einen Moment ich editiere ;)
    //edit: Danke haxler :) es geht danke trotzdem allen für die hilfe.

    Einmal editiert, zuletzt von Bacardi ()