Motor system mit Der Taste Alt

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
  • So baust du das auf bei OnPlayerkey....
    if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
    if(Motor[veh] == 0)
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,Rot,"Motor angeschaltet!");
    Motor[veh] = 1;
    }
    else
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,Grün,"Motor ausgeschaltet!");
    Motor[veh] = 0;
    }
    }
    }
    das ist jetzt auf der N taste belegt
    die anderen tasten was du haben willst kannst du hier sehen:
    http://wiki.sa-mp.com/wiki/GetPlayerKeys


    MFG
    schnarre


    //edit
    hier wird so ein Thema auch noch besprochen
    Motor Starten mit M aber wie scripten???

  • hmm habs versucht rein zubauen aber irgentwie bekomme ich immer Pawno Problem hmm kann mir da jemand helfen


    Das hier ist meine Zeile wo Füg ich das am Besten hin


    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if ((newkeys==KEY_FIRE)) {
    if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452)) {
    SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
    }
    }
    return 1;
    }
    stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
    {
    new Float:pX,Float:pY,Float:pZ;
    GetPlayerPos(playerid,pX,pY,pZ);
    if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
    else return 0;
    }



    Wo kann ich das hier reinbauen



    if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
    if(Motor[veh] == 0)
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,Rot,"Motor angeschaltet!");
    Motor[veh] = 1;
    }
    else
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,Grün,"Motor ausgeschaltet!");
    Motor[veh] = 0;
    }
    }
    }



    EDITE: PWN Txet


    danke im vorraus


    mfg hunter

  • public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if ((newkeys==KEY_FIRE))
    {
    if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452))
    {
    SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
    }
    }
    if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(veh,engine,lights,alarm,doors,bonnet,boot,objective);
    if(Motor[veh] == 0)
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,Rot,"Motor angeschaltet!");
    Motor[veh] = 1;
    }
    else
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,Grün,"Motor ausgeschaltet!");
    Motor[veh] = 0;
    }
    }
    }
    return 1;
    }


    stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
    {
    new Float:pX,Float:pY,Float:pZ;
    GetPlayerPos(playerid,pX,pY,pZ);
    if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
    else return 0;
    }


    mfg

  • C:\Users\Marcel\Desktop\gm.pwn(39835) : warning 219: local variable "lights" shadows a variable at a preceding level
    C:\Users\Marcel\Desktop\gm.pwn(39838) : error 017: undefined symbol "Motor"
    C:\Users\Marcel\Desktop\gm.pwn(39838) : warning 215: expression has no effect
    C:\Users\Marcel\Desktop\gm.pwn(39838) : error 001: expected token: ";", but found "]"
    C:\Users\Marcel\Desktop\gm.pwn(39838) : error 029: invalid expression, assumed zero
    C:\Users\Marcel\Desktop\gm.pwn(39838) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Ja hab ich gemacht aber irgentwie sist der motor immer ncoh automatich an


    public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    Motor[GetPlayerVehicleID(playerid)] = 0;
    new modelid = GetVehicleModel(vehicleid);
    if(modelid == 522)
    {
    SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
    }
    if(PlayerInfo[playerid][pCarLic] < 1 && !IsAPlane(vehicleid) && !IsABoat(vehicleid))
    {
    SendClientMessage(playerid, COLOR_RED, " Du hast keinen Führerschein (15000$) !");
    SendClientMessage(playerid, COLOR_RED, " Meide die Polizei, denn wenn du erwischt wirst, siehts nicht gut für dich aus.");
    }
    new tmp = GetVehicleModel(GetPlayerVehicleID(playerid));
    new Float:armor;
    GetPlayerArmour(playerid, armor);
    if(tmp == 427)
    {
    SetPlayerArmour(playerid, armor);
    return 1;
    }
    SendClientMessage(playerid,COLOR_ORANGE,"Starte dein Motor Mit der Taste (N)");
    SendClientMessage(playerid,COLOR_ORANGE,"Bei Problemen mit ihrem Auto benutzen sie /service adac");
    gGas[playerid] = 1;
    new string[60];
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
    format(string, sizeof(string), "AdminInfo: VehicleID: %d || Model: %s[%d]", vehicleid, CarName[modelid-400], modelid);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    }
    if(gTeam[playerid] >= 3)
    {
    if (IsACopCar(vehicleid) && !ispassenger)
    {
    if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1 ||PlayerInfo[playerid][pMember]==2 ||PlayerInfo[playerid][pLeader]==2 ||PlayerInfo[playerid][pMember]==3 ||PlayerInfo[playerid][pLeader]==3) { }
    else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Diebstahl"); }
    }
    }
    return 1;
    }

  • public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
    {
    Motor[GetPlayerVehicleID(playerid)] = 0;
    new modelid = GetVehicleModel(vehicleid);
    if(modelid == 522)
    {
    SetPlayerAttachedObject(playerid, 1, 18645, 2, 0.07, 0, 0, 88, 75, 0);
    }
    if(PlayerInfo[playerid][pCarLic] < 1 && !IsAPlane(vehicleid) && !IsABoat(vehicleid))
    {
    SendClientMessage(playerid, COLOR_RED, " Du hast keinen Führerschein (15000$) !");
    SendClientMessage(playerid, COLOR_RED, " Meide die Polizei, denn wenn du erwischt wirst, siehts nicht gut für dich aus.");
    }
    new tmp = GetVehicleModel(GetPlayerVehicleID(playerid));
    new Float:armor;
    GetPlayerArmour(playerid, armor);
    if(tmp == 427)
    {
    SetPlayerArmour(playerid, armor);
    return 1;
    }
    SendClientMessage(playerid,COLOR_ORANGE,"Starte dein Motor Mit der Taste (N)");
    SendClientMessage(playerid,COLOR_ORANGE,"Bei Problemen mit ihrem Auto benutzen sie /service adac");
    gGas[playerid] = 1;
    new string[60];
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
    format(string, sizeof(string), "AdminInfo: VehicleID: %d || Model: %s[%d]", vehicleid, CarName[modelid-400], modelid);
    SendClientMessage(playerid, COLOR_ORANGE, string);
    }
    if(gTeam[playerid] >= 3)
    {
    if (IsACopCar(vehicleid) && !ispassenger)
    {
    if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1 ||PlayerInfo[playerid][pMember]==2 ||PlayerInfo[playerid][pLeader]==2 ||PlayerInfo[playerid][pMember]==3 ||PlayerInfo[playerid][pLeader]==3) { }
    else { WantedPoints[playerid]+=2; SetPlayerCriminal(playerid,255, "Diebstahl"); }
    }
    }
    return 1;
    }[/quote]
    da haste alles richtig gemacht,
    mh eventuell was mit der tastenkombination verhauen?

  • Welche tastenkombination meints denn?? die hier



    public OnPlayerKeyStateChange(playerid, newkeys, oldkeys)
    {
    if ((newkeys==KEY_FIRE))
    {
    if(IsPlayerInArea(playerid,1120.99, -951.5297, 1349.16, -837.0452))
    {
    SendClientMessage(playerid,0xFFFF00AA,"Du wurdest 5sek wegen DM gefreezt.");
    TogglePlayerControllable(playerid, 0);
    SetTimerEx("DmUnfreeze", 5000, 0, "i", playerid);
    }
    }
    if((newkeys & KEY_NO) && !(oldkeys & KEY_NO))//deine belegung
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    new engine,light,alarm,doors,bonnet,boot,objective;
    new veh = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(veh,engine,light,alarm,doors,bonnet,boot,objective);
    if(Motor[veh] == 0)
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_ON,light,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,0xFFFF00AA,"Motor angeschaltet!");
    Motor[veh] = 1;
    }
    else
    {
    SetVehicleParamsEx(veh,VEHICLE_PARAMS_OFF,light,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid,0xFFFF00AA,"Motor ausgeschaltet!");
    Motor[veh] = 0;
    }
    }
    }
    return 1;
    }


    stock IsPlayerInArea(playerid,Float:minX,Float:minY,Float:maxX,Float:maxY)
    {
    new Float:pX,Float:pY,Float:pZ;
    GetPlayerPos(playerid,pX,pY,pZ);
    if(pX >= minX && pX <= maxX && pY >= minY && pY <= maxY) return 1;
    else return 0;
    }


  • Deine Belegung, schreib da doch mal was anderes rein siehe hier


  • if(newkeys == 132)
    {
    if(IsPlayerConnected(playerid))
    {
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER)
    {
    OnPlayerCommandText(playerid, "/motor");
    }
    }
    }
    //Bei OnPlayerKeyStateChange


    if(strcmp(cmd, "/motor",true) == 0)
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}Fahrräder haben {FF0000}keinen{FFFFFF} Motor!");
    return 1;
    }
    new newcar = GetPlayerVehicleID(playerid);
    // new oldcar = gLastCar[playerid];
    TelePos[playerid][0] = 0.0;
    TelePos[playerid][1] = 0.0;
    if(GetPlayerState(playerid) != PLAYER_STATE_DRIVER) return 1;
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new vid = GetPlayerVehicleID(playerid);
    GetVehicleParamsEx(vid,engine,lights,alarm,doors,bonnet,boot,objective);
    if(vid != INVALID_VEHICLE_ID)
    {
    if(engine == VEHICLE_PARAMS_ON)
    {
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor ~r~aus!", 2000, 5);
    }
    else
    {
    if(PlayerInfo[playerid][pAdmin] != 0 && AdminDuty[playerid] == 1)
    {
    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor ~g~an!", 2000, 5);
    return 1;
    }



    SetVehicleParamsEx(vid,VEHICLE_PARAMS_ON,lights,alarm,doors,bonnet,boot,objective);
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~W~Motor ~g~an!", 2000, 5);

    }


    }


    return 1;
    }


    mfg