In /motor einen Timer reinbauen

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 ,


    Wie soll ich in dem Befehl



    if(strcmp(cmd, "/motor",true) == 0)
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}Fahrräder haben {FF0000}keinen{FFFFFF} Motor!");
    return 1;
    }
    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
    {
    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;
    }


    Einen Timer rein machen , das der Motor nach 5 Sekunden angeht,
    Aber wenn er schon an ist das er trotzdem sofort aus geht


    Weiß nicht wie ich das machen soll :D

  • if(strcmp(cmd, "/motor",true) == 0)
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}Fahrräder haben {FF0000}keinen{FFFFFF} Motor!");
    return 1;
    }
    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
    {
    //SetTimerEx
    }
    }
    return 1;
    }


    public Motor()
    {
    new engine,lights,alarm,doors,bonnet,boot,objective;
    new vid = GetPlayerVehicleID(playerid);
    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);
    }


    Sowas?


  • ganz oben:


    forward MotorTimer(playerid);




    if(strcmp(cmd, "/motor",true) == 0)
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}Fahrräder haben {FF0000}keinen{FFFFFF} Motor!");
    return 1;
    }
    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
    {
    SendClientMessage(playerid, COLOR_WHITE, "Versuche Motor zu starten......");
    SetTimer("MotorTimer", 3000, false);
    }
    }
    return 1;
    }


    public MotorTimer(playerid){


    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);


    }

  • [pwn]
    ganz oben:


    forward MotorTimer(playerid);




    if(strcmp(cmd, "/motor",true) == 0)
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "{FFFFFF}Fahrräder haben {FF0000}keinen{FFFFFF} Motor!");
    return 1;
    }
    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
    {
    SendClientMessage(playerid, COLOR_WHITE, "Versuche Motor zu starten......");
    SetTimer("MotorTimer", 3000, false);
    }
    }
    return 1;
    }


    public MotorTimer(playerid){


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


    }[/pwn]


    War das so schwer? Du benötigst die Vehicle ID des Spielers.

  • Immernoch



    C:\Users\Daniel Keller\Desktop\Script\AR0.6b.pwn(5056) : error 017: undefined symbol "vid"
    C:\Users\Daniel Keller\Desktop\Script\AR0.6b.pwn(5055) : warning 204: symbol is assigned a value that is never used: "vids"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    1 Error.
    //Edit
    Hab was geändert jetzt kommt


    C:\Users\Daniel Keller\Desktop\Script\AR0.6b.pwn(5056) : error 017: undefined symbol "lights"

    Einmal editiert, zuletzt von dnlk ()