/motor Befehl geht nicht?

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
  • Hey ich bekomm das nicht hin den Motorbefehl zu "reparieren". Kann mal wer drüber schauen und eventuell den Fehler finden?



    stock SwitchEngine(playerid)
    {
    new sendername[MAX_PLAYER_NAME];
    new string[200];
    GetPlayerName(playerid,sendername,sizeof(sendername));
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(Adminmode[playerid] == 1 && PlayerInfo[playerid][pAdmin] >= 3 || Derbymode[playerid] == 1|| Eventmode[playerid] == 1)
    {
    new en, li, ala, doo, boo, boot, obj;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
    if(en == VEHICLE_PARAMS_OFF)
    {
    VehInfo[vehicleid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[vehicleid][vid], en, li, ala, doo, boo, boot, obj);
    SetVehicleParamsEx(PlayerCar[vehicleid][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehicleid][Licht] = 1;
    return 1;
    }
    else if(en == VEHICLE_PARAMS_ON)
    {
    SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, li, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
    VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0;
    }
    }
    for(new i = 0; i<MAX_VEHICLES; i++)
    {
    if(PlayerInfo[playerid][pArbeiter]!= 24 || PlayerInfo[playerid][pChef]!= 24)
    {
    if(PlayerCar[vid] == GetPlayerVehicleID(playerid))
    {
    if(PlayerCar[Towed] == 1)
    {
    SendClientMessage(playerid, GRAU, "Dieses Fahrzeug wurde abgeschleppt! Du kannst das Fahrzeug für 2000€ per /auslösen wieder auslösen!");
    SendClientMessage(playerid, GRAU, "Mit /exit kannst du das Fahrzeug verlassen.");
    TogglePlayerControllable(playerid, 0);
    }
    }
    }
    }
    if(PlayerInfo[playerid][pJob]==17)
    {
    new vehicleid = GetPlayerVehicleID(playerid);
    if(GetVehicleModel(vehicleid) == 538)
    {
    new en, li, ala, doo, boo, boot, obj;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
    if(en == VEHICLE_PARAMS_ON) { SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_OFF, li, VEHICLE_PARAMS_OFF, doo, boo, boot, obj); VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0; }
    else if(en == VEHICLE_PARAMS_OFF) { SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, li, VEHICLE_PARAMS_OFF, doo, boo, boot, obj); VehInfo[GetPlayerVehicleID(playerid)][Motor] = 1; }
    }
    }
    if(Refueling[playerid]) { SendClientMessage(playerid, Grey, "Du kannst den Motor während dem Tanken nicht stoppen/starten!"); return 1; }
    new engine, lights, alarm, doors, bonnet, boot, obj, Float:health;
    GetVehicleHealth(GetPlayerVehicleID(playerid), health);
    for(new ii = 0; ii<MAX_VEHICLES; ii++)
    {
    new str[128], vehid = GetPlayerVehicleID(playerid);
    format(str, sizeof str, "/Cars/%d.ini", ii);
    if(fexist(str))
    {
    if(PlayerCar[ii][vid] == vehid)
    {
    if(PlayerCar[ii][Broken]) { SendClientMessage(playerid, Grey, "Du kannst den Motor nicht starten, da du den falschen Kraftstoff getankt hast!"); SendClientMessage(playerid, Grey, "Du musst per /Service Mechaniker oder /Service Abschlepper einen Mechaniker/Abschlepper rufen, der dir deinen Tank auspumpt!"); return 1; }
    if(VehInfo[vehid][Motor])
    {
    VehInfo[vehid][Motor] = 0;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_OFF, VEHICLE_PARAMS_OFF, alarm, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s stoppt den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 0;
    return 1;
    }
    if(PlayerCar[ii][Fuel] > 0 && health > 30)
    {
    if(!VehInfo[vehid][Motor])
    {
    if(!strcmp(PlayerCar[ii][Key], "Staat", false) && !PlayerCar[ii][JobCar] && !PlayerCar[ii][FrakCar])
    {
    if(!VehInfo[vehid][Motor])
    {
    VehInfo[vehid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 1;
    return 1;
    }
    return 1;
    }
    else if(PlayerCar[ii][FrakCar])
    {
    if(PlayerCar[ii][Frak] == PlayerInfo[playerid][pArbeiter] || PlayerInfo[playerid][pChef] == PlayerCar[ii][Frak])
    {
    if(!VehInfo[vehid][Motor])
    {
    VehInfo[vehid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 1;
    return 1;
    }
    return 1;
    }
    return 1;
    }
    else if(PlayerInfo[playerid][pArbeiter] == 24 && PlayerInfo[playerid][pChef] == 24)
    {
    VehInfo[vehid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 1;
    return 1;
    }
    else if(Mission[playerid] > 1)
    {
    if(PlayerCar[ii][NSID] == Mission[playerid])
    {
    new en, li, ala, doo, boo;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
    if(en == VEHICLE_PARAMS_ON)
    {
    VehInfo[vehicleid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[vehicleid][vid], en, li, ala, doo, boo, boot, obj);
    SetVehicleParamsEx(PlayerCar[vehicleid][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehicleid][Licht] = 1;
    }
    else if(en == VEHICLE_PARAMS_OFF)
    {
    SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, li, ala, doo, boo, boot, obj);
    VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0;
    }
    }
    }
    else if(RCAuto[playerid] > 1)
    {
    if(PlayerCar[ii][NSID] == RCAuto[playerid])
    {
    new en, li, ala, doo, boo;
    new vehicleid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(GetPlayerVehicleID(playerid), en, li, ala, doo, boo, boot, obj);
    if(en == VEHICLE_PARAMS_ON)
    {
    VehInfo[vehicleid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[vehicleid][vid], en, li, ala, doo, boo, boot, obj);
    SetVehicleParamsEx(PlayerCar[vehicleid][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doo, boo, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehicleid][Licht] = 1;
    }
    else if(en == VEHICLE_PARAMS_OFF)
    {
    SetVehicleParamsEx(GetPlayerVehicleID(playerid), VEHICLE_PARAMS_ON, li, ala, doo, boo, boot, obj);
    VehInfo[GetPlayerVehicleID(playerid)][Motor] = 0;
    }
    }
    }
    else if(PlayerCar[ii][JobCar])
    {
    if(PlayerInfo[playerid][pJob] == PlayerCar[ii][Job])
    {
    if(!VehInfo[vehid][Motor])
    {
    VehInfo[vehid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 1;
    return 1;
    }
    return 1;
    }
    return 1;
    }
    else if(!strcmp(PlayerCar[ii][Key], pn(playerid), false) || PlayerCar[ii][NSID] == PlayerInfo[playerid][pRentCarKey])
    {
    if(!VehInfo[vehid][Motor])
    {
    VehInfo[vehid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 1;
    return 1;
    }
    return 1;
    }
    else if(PlayerCar[ii][Towed] == 1)
    {
    if(PlayerInfo[playerid][pArbeiter] == 24 || PlayerInfo[playerid][pChef] == 24)
    {
    if(!VehInfo[vehid][Motor])
    {
    VehInfo[vehid][Motor] = 1;
    GetVehicleParamsEx(PlayerCar[ii][vid], engine, lights, alarm, doors, bonnet, boot, obj);
    SetVehicleParamsEx(PlayerCar[ii][vid], VEHICLE_PARAMS_ON, VEHICLE_PARAMS_ON, VEHICLE_PARAMS_OFF, doors, bonnet, boot, obj);
    format(string, sizeof(string), "* %s startet den Motor von seinem Fahrzeug.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    VehInfo[vehid][Licht] = 1;
    return 1;
    }
    }
    return 1;
    }



    }
    return 1;
    }
    else
    {
    SendClientMessage(playerid,GRAU,"** Du kannst den Motor nicht mit leerem Tank starten!");



    }
    return 1;
    }
    }
    }
    }
    return 1;
    }

    Mit freundlichen Grüßen,
    Derakar

  • Poste dir mein code schnipel dir was raus.. :D


    ocmd:motor(playerid,params[])
    {
    if(GetPlayerState(playerid)!=PLAYER_STATE_DRIVER)return SendClientMessage(playerid,COLOR_GRAU,"Du bist nicht der Fahrer eines Fahrzeugs.");
    new vID=GetPlayerVehicleID(playerid),
    tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    GetVehicleParamsEx(vID,tmp_engine, tmp_lights,tmp_alarm,tmp_doors,tmp_bonnet,tmp_boot,tmp_objective);
    if(tmp_engine==1){
    tmp_engine = 0;
    GameTextForPlayer(playerid,"~w~MOTOR ~r~AUS",3000,3);
    }else{
    tmp_engine = 1;
    GameTextForPlayer(playerid,"~w~MOTOR ~g~AN",3000,3);
    }
    SetVehicleParamsEx(vID, tmp_engine, tmp_lights,tmp_alarm,tmp_doors,tmp_bonnet,tmp_boot,tmp_objective);
    return 1;
    }

  • warum das hier es geht viel einfacher :D


    new vID=GetPlayerVehicleID(playerid),
    tmp_engine,
    tmp_lights,
    tmp_alarm,
    tmp_doors,
    tmp_bonnet,
    tmp_boot,
    tmp_objective;
    GetVehicleParamsEx(vID,tmp_engine, tmp_lights,tmp_alarm,tmp_doors,tmp_bonnet,tmp_boot,tmp_objective);


    so hier meine stocks:



    stock VehicleEngine(vehicleid, onaus) { new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,onaus,q,w,e,r,t,z); return 1; }
    stock VehicleLights(vehicleid, onaus) {new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,eng,onaus,w,e,r,t,z); return 1; }
    stock VehicleAlarm(vehicleid, onaus) { new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,eng,q,onaus,e,r,t,z); return 1; }
    stock VehicleDoors(vehicleid, onaus) { new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,eng,q,w,onaus,r,t,z); return 1; }
    stock VehicleBonnet(vehicleid, onaus) { new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,eng,q,w,e,onaus,t,z); return 1; }
    stock VehicleBoot(vehicleid, onaus) { new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,eng,q,w,e,r,onaus,z); return 1; }
    stock VehicleObjective(vehicleid, onaus) { new eng,q,w,e,r,t,z; GetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,z); SetVehicleParamsEx(vehicleid,eng,q,w,e,r,t,onaus); return 1; }