/heal für medic ausbessern GF

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
  • /heal für medic ausbessern GF
    Hallo ich habe hier eine idee wenn jemand hilfe mal benötigt von den medics zum heilen ?


    wenn medic jetzt /heal id preis macht


    Das man dann gefreezt ist und eine meldung kommt Bitte warte du wirst geheilt..
    Und die hp sich stückweise erhöht und man wieder entfreezt ist wenn sie voll ist und dann steht du wurdest komplett gehelt und bezahltest dem doc ... geld das gels wurder vorher aber bei heal Festgelegt


    Hier mal dasCommands



    // einmal der /heal command unter OnPLayerCommand text
    if(strcmp(cmd, "/heal", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new location = PlayerInfo[playerid][pLocal];
    if(!strlen(tmp))
    {
    if(location != 255)
    {
    if(location < 99)
    {
    if(HouseInfo[location][hArm] == 1)
    {
    format(string, sizeof(string), "* %s legt die Schutzweste an.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    FreezePlayer(playerid);
    GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
    Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
    Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
    SetPlayerPos(playerid,1527.5,-12.1,1002.0);
    PlayerInfo[playerid][pLocal] = 255;
    SetPlayerInterior(playerid,99);
    Spectate[playerid] = 257;
    }
    else
    {
    format(string, sizeof(string), "Dieser Ort hat keine Upgrades.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    if(HouseInfo[location][hHel] == 1)
    {
    new Float:tempheal;
    GetPlayerHealth(playerid,tempheal);
    if ( tempheal < 100.0)
    {
    SetPlayerHealth(playerid,100.0);
    PlayerInfo[playerid][pHunger] = 0;
    PlayerInfo[playerid][pDurst] = 0;
    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "Du wurdest wieder zu 100% geheilt.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    else
    {
    SendClientMessage(playerid, TEAM_GREEN_COLOR,"Du wurdest wieder zu 100% geheilt.");
    }
    }
    else
    {
    format(string, sizeof(string), "Dieser Ort ist nicht zum Healing Upgrade.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    return 1;
    }
    else if(location == 101)//Restaurant
    {
    new Float:tempheal;
    GetPlayerHealth(playerid,tempheal);
    if ( tempheal < 100.0)
    {
    SetPlayerHealth(playerid,100.0);
    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "Du wurdest wieder zu 100% geheilt.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    else
    {
    SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
    }
    }
    else if(location == 102 && IsACop(playerid))//Police Armoury
    {
    SetPlayerHealth(playerid,100.0);
    SetPlayerArmour(playerid,100.0);
    format(string, sizeof(string), "* %s legt die Schutzweste an.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    FreezePlayer(playerid);
    GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
    Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
    Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
    SetPlayerPos(playerid,1527.5,-12.1,1002.0);
    PlayerInfo[playerid][pLocal] = 255;
    SetPlayerInterior(playerid,99);
    Spectate[playerid] = 257;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /heal [Playerid/PartOfName] [Preis]");
    return 1;
    }
    }
    giveplayerid = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /heal [Playerid/PartOfName] [Preis]");
    return 1;
    }
    moneys = strval(tmp);
    if(moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, " Behandlungspreis nicht weniger als: 1$ und höher als 1000$ !"); return 1; }
    if (giveplayerid == playerid)
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Du kannst dich leider nicht selber Heilen!");
    return 1;
    }
    if (IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new giveambu = GetPlayerVehicleID(giveplayerid);
    new playambu = GetPlayerVehicleID(playerid);
    if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)//model
    {
    if (IsAnAmbulance(playambu) && playambu == giveambu)
    {
    new Float:tempheal;
    GetPlayerHealth(giveplayerid,tempheal);
    if(tempheal >= 99.0)
    {
    SendClientMessage(playerid, TEAM_GREEN_COLOR," Diese Person ist schon Geheilt.");
    return 1;
    }
    format(string, sizeof(string), "~y~Du heilst: ~n~~w~%s~n~~g~$%d", giveplayer,moneys);
    GameTextForPlayer(playerid, string, 5000, 1);
    GivePlayerMoney(playerid,moneys);
    PlayerDrunk[playerid] = 0;
    PlayerInfo[giveplayerid][pHunger] = 0;
    PlayerInfo[giveplayerid][pDurst] = 0;
    GivePlayerMoney(giveplayerid,-moneys);
    SetPlayerHealth(giveplayerid, 100);
    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
    PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "Du wurdest für $%d geheilt.",moneys);
    SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string);
    PlayerInfo[playerid][pDabhaengig] = 0;
    if(STDPlayer[giveplayerid] > 0)
    {
    STDPlayer[giveplayerid] = 0;
    SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Du bist nun nicht mehr an STD erkrankt. Die Ärzte konnten dich retten! !");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Nicht im Rettungswagen / Rettungshelikopter!");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Du darfst diesen Befehl nicht benutzen !");
    return 1;
    }
    }
    }
    else
    {
    format(string, sizeof(string), " %d ist kein aktiver Spieler.", giveplayerid);
    SendClientMessage(playerid, COLOR_GRAD1, string);
    }
    }
    return 1;
    }

    ich weis noch nicht so recht wie ich das scripten soll







    Nun wie code ich das `?


  • new timer[MAX_PLAYERS];






    timer[playerid] = SetTimerEx("FillHP", 10000, true, "d", playerid);




    forward FillHP(playerid);
    public FillHP(playerid)
    {
    new Float: HP;
    GetPlayerHealth(playerid, HP);
    if(HP < 100.0)
    {
    SetPlayerHealth(playerid, HP+10);
    }
    else
    {
    //Text
    KillTimer(timer[playerid]);
    }
    return true;
    }

    RFT

  • Danke für die schnelle nachricht und das
    timer[playerid] = SetTimerEx("FillHP", 10000, true, "d", playerid); ? muss bei dem heal rein ?


    format(string, sizeof(string), "~y~Du heilst: ~n~~w~%s~n~~g~$%d", giveplayer,moneys); GameTextForPlayer(playerid, string, 5000, 1); GivePlayerMoney(playerid,moneys); PlayerDrunk[playerid] = 0; PlayerInfo[giveplayerid][pHunger] = 0; PlayerInfo[giveplayerid][pDurst] = 0; GivePlayerMoney(giveplayerid,-moneys); //SetPlayerHealth(giveplayerid, 100); TogglePlayerControllable(giveplayerid,1); timer[giveplayerid] = SetTimerEx("FillHP", 1000, true, "d", playerid); PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0); PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0); format(string, sizeof(string), "Die behandlung kostet dich $%d geld.",moneys); SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string); PlayerInfo[playerid][pDabhaengig] = 0;



    Funkt nicht ingame wird die Hp nicht erhöht
    Hier der Public
    public FillHP(playerid){new Float: HP;GetPlayerHealth(playerid, HP);if(HP < 100.0){SetPlayerHealth(playerid, HP+10);}else{//TextTogglePlayerControllable(playerid,0);KillTimer(timer[playerid]);}return true;}

    Einmal editiert, zuletzt von ScyFox () aus folgendem Grund: hab was hinzugefügt

  • also als erstes hab ich ganz oben unter den ganzen anderen news das hier reingepackt



    new timer[MAX_PLAYERS];


    dann hab ich unter on gamemodeinit nix rein getant aber bei on player command


    das hier eingefügt beim heal und das andere auskommentiert

    if(strcmp(cmd, "/heal", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new location = PlayerInfo[playerid][pLocal];
    if(!strlen(tmp))
    {
    if(location != 255)
    {
    if(location < 99)
    {
    if(HouseInfo[location][hArm] == 1)
    {
    format(string, sizeof(string), "* %s legt die Schutzweste an.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    FreezePlayer(playerid);
    GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
    Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
    Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
    SetPlayerPos(playerid,1527.5,-12.1,1002.0);
    PlayerInfo[playerid][pLocal] = 255;
    SetPlayerInterior(playerid,99);
    Spectate[playerid] = 257;
    }
    else
    {
    format(string, sizeof(string), "Dieser Ort hat keine Upgrades.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    if(HouseInfo[location][hHel] == 1)
    {
    new Float:tempheal;
    GetPlayerHealth(playerid,tempheal);
    if ( tempheal < 100.0)
    {
    SetPlayerHealth(playerid,100.0);
    PlayerInfo[playerid][pHunger] = 0;
    PlayerInfo[playerid][pDurst] = 0;
    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "Du wurdest wieder zu 100% geheilt.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    else
    {
    SendClientMessage(playerid, TEAM_GREEN_COLOR,"Du wurdest wieder zu 100% geheilt.");
    }
    }
    else
    {
    format(string, sizeof(string), "Dieser Ort ist nicht zum Healing Upgrade.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    return 1;
    }
    else if(location == 101)//Restaurant
    {
    new Float:tempheal;
    GetPlayerHealth(playerid,tempheal);
    if ( tempheal < 100.0)
    {
    SetPlayerHealth(playerid,100.0);
    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "Du wurdest wieder zu 100% geheilt.");
    SendClientMessage(playerid, TEAM_GREEN_COLOR,string);
    }
    else
    {
    SendClientMessage(playerid, TEAM_GREEN_COLOR,"You are already healed to 100.");
    }
    }
    else if(location == 102 && IsACop(playerid))//Police Armoury
    {
    SetPlayerHealth(playerid,100.0);
    SetPlayerArmour(playerid,100.0);
    format(string, sizeof(string), "* %s legt die Schutzweste an.", sendername);
    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
    FreezePlayer(playerid);
    GetPlayerPos(playerid, Unspec[playerid][sPx], Unspec[playerid][sPy], Unspec[playerid][sPz]);
    Unspec[playerid][sPint] = PlayerInfo[playerid][pInt];
    Unspec[playerid][sLocal] = PlayerInfo[playerid][pLocal];
    SetPlayerPos(playerid,1527.5,-12.1,1002.0);
    PlayerInfo[playerid][pLocal] = 255;
    SetPlayerInterior(playerid,99);
    Spectate[playerid] = 257;
    // ----------- Medic teil anfang -- Glaub ich zumindest
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /heal [Playerid/PartOfName] [Preis]");
    return 1;
    }
    }
    giveplayerid = ReturnUser(tmp);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /heal [Playerid/PartOfName] [Preis]");
    return 1;
    }
    moneys = strval(tmp);
    if(moneys < 1 || moneys > 1000) { SendClientMessage(playerid, COLOR_GREY, " Behandlungspreis nicht weniger als: 1$ und höher als 1000$ !"); return 1; }
    if (giveplayerid == playerid)
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Du kannst dich leider nicht selber Heilen!");
    return 1;
    }
    if (IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new giveambu = GetPlayerVehicleID(giveplayerid);
    new playambu = GetPlayerVehicleID(playerid);
    if(gTeam[playerid] == TEAM_CYAN||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)//model
    {
    if (IsAnAmbulance(playambu) && playambu == giveambu)
    {
    new Float:tempheal;
    GetPlayerHealth(giveplayerid,tempheal);
    if(tempheal >= 99.0)
    {
    SendClientMessage(playerid, TEAM_GREEN_COLOR," Diese Person ist schon Geheilt.");
    return 1;
    }
    format(string, sizeof(string), "~y~Du heilst: ~n~~w~%s~n~~g~$%d", giveplayer,moneys);
    GameTextForPlayer(playerid, string, 5000, 1);
    GivePlayerMoney(playerid,moneys);
    PlayerDrunk[playerid] = 0;
    PlayerInfo[giveplayerid][pHunger] = 0;
    PlayerInfo[giveplayerid][pDurst] = 0;
    GivePlayerMoney(giveplayerid,-moneys);
    //SetPlayerHealth(giveplayerid, 100);
    TogglePlayerControllable(giveplayerid,1);
    timer[giveplayerid] = SetTimerEx("FillHP", 1000, true, "d", playerid);
    PlayerPlaySound(playerid, 1150, 0.0, 0.0, 0.0);
    PlayerPlaySound(giveplayerid, 1150, 0.0, 0.0, 0.0);
    format(string, sizeof(string), "Die behandlung kostet dich $%d geld.",moneys);
    SendClientMessage(giveplayerid, TEAM_GREEN_COLOR,string);
    PlayerInfo[playerid][pDabhaengig] = 0;
    if(STDPlayer[giveplayerid] > 0)
    {
    STDPlayer[giveplayerid] = 0;
    SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, "* Du bist nun nicht mehr an STD erkrankt. Die Ärzte konnten dich retten! !");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Nicht im Rettungswagen / Rettungshelikopter!");
    return 1;
    }
    // ------------------------ Medic Teil ende
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD1, " Du darfst diesen Befehl nicht benutzen !");
    return 1;
    }
    }
    }
    else
    {
    format(string, sizeof(string), " %d ist kein aktiver Spieler.", giveplayerid);
    SendClientMessage(playerid, COLOR_GRAD1, string);
    }
    }
    return 1;
    }


    Dann ganz unten der Public




    public FillHP(playerid)
    {
    new Float: HP;
    GetPlayerHealth(playerid, HP);
    if(HP < 100.0)
    {
    SetPlayerHealth(playerid, HP+10);
    }
    else
    {
    //Text
    TogglePlayerControllable(playerid,0);
    KillTimer(timer[playerid]);
    }
    return true;
    }


    Was stimmt da nicht :(