Was mache ich falsch

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
  • Ich möchte neue /tanken bereische erstellen dies habe ich auch getan doch wenn ich bei diesen bereich /tanken mache passiert nix


    else if(IsPlayerInRangeOfPoint(playerid,6.0,1449.6364,-1667.3773,13.3687) || IsPlayerInRangeOfPoint(playerid,6.0,1449.6364,-1667.3773,13.3687))
    {//LSPD Parkplatz Tanke
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,1446.6611,-1668.4176,13.3687) || IsPlayerInRangeOfPoint(playerid,6.0,1446.6611,-1668.4176,13.3687))
    {//LSPD Parkplatz Tanke
    return 1;
    }

  • hir die ganze funktion


    Function IsAtGasStation(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    if(IsPlayerInRangeOfPoint(playerid,6.0,1004.0070,-939.3102,42.1797) || IsPlayerInRangeOfPoint(playerid,6.0,1944.3260,-1772.9254,13.3906))
    {//LS
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,-90.5515,-1169.4578,2.4079) || IsPlayerInRangeOfPoint(playerid,6.0,-1609.7958,-2718.2048,48.5391))
    {//LS
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,-2029.4968,156.4366,28.9498) || IsPlayerInRangeOfPoint(playerid,6.0,-2408.7590,976.0934,45.4175))
    {//SF
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,-2243.9629,-2560.6477,31.8841) || IsPlayerInRangeOfPoint(playerid,6.0,-1676.6323,414.0262,6.9484))
    {//Between LS and SF
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,2202.2349,2474.3494,10.5258) || IsPlayerInRangeOfPoint(playerid,6.0,614.9333,1689.7418,6.6968))
    {//LV
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,-1328.8250,2677.2173,49.7665) || IsPlayerInRangeOfPoint(playerid,6.0,70.3882,1218.6783,18.5165))
    {//LV
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,2113.7390,920.1079,10.5255) || IsPlayerInRangeOfPoint(playerid,6.0,-1327.7218,2678.8723,50.0625))
    {//LV
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,1449.6364,-1667.3773,13.3687) || IsPlayerInRangeOfPoint(playerid,6.0,1449.6364,-1667.3773,13.3687))
    {//LSPD Parkplatz Tanke
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid,6.0,1446.6611,-1668.4176,13.3687) || IsPlayerInRangeOfPoint(playerid,6.0,1446.6611,-1668.4176,13.3687))
    {//LSPD Parkplatz Tanke
    return 1;
    }
    else if(IsPlayerInRangeOfPoint(playerid, 30.0, 2002.8409,-2382.0603,13.5469))
    {//LS Airport
    return 1;
    }
    }
    return 0;
    }

  • if(strcmp(cmd, "/tanken", true) == 0)
    {
    if(IsPlayerInRangeOfPoint(playerid,10,1004.0812,-939.4362,42.1797))
    {
    if(IsPlayerConnected(playerid))
    {
    if(IsAtGasStation(playerid))
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid,COLOR_YELLOW," Du kannst kein Fahrrad betanken!");
    }
    SetTimer("Fillup",RefuelWait,0);
    Refueling[playerid] = 1;
    FreezePlayer(playerid);
    SendClientMessage(playerid,COLOR_WHITE," Dein Fahrzeug wird betankt, Bitte warten....");
    }
    return 1;
    }
    }
    }

  • if(strcmp(cmd, "/tanken", true) == 0)
    {
    if(IsAtGasStation(playerid))
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid,COLOR_YELLOW," Du kannst kein Fahrrad betanken!");
    return 1;
    }
    SetTimer("Fillup",RefuelWait,0);
    Refueling[playerid] = 1;
    FreezePlayer(playerid);
    SendClientMessage(playerid,COLOR_WHITE," Dein Fahrzeug wird betankt, Bitte warten....");
    }
    return 1;
    }
    }


    Dürfte so gehen.

  • Ich würde dir empfehlen deine


    IsAtGasStation(playerid)


    so zu schreiben


    Function IsAtGasStation(playerid)
    {
    if(IsPlayerConnected(playerid))
    {
    if(IsPlayerInRangeOfPoint(playerid,6.0,1004.0070,-939.3102,42.1797) ||
    IsPlayerInRangeOfPoint(playerid,6.0,1944.3260,-1772.9254,13.3906)|| //ls
    IsPlayerInRangeOfPoint(playerid,6.0,-90.5515,-1169.4578,2.4079) ||
    IsPlayerInRangeOfPoint(playerid,6.0,-1609.7958,-2718.2048,48.5391) || //ls
    IsPlayerInRangeOfPoint(playerid,6.0,-2029.4968,156.4366,28.9498) ||
    IsPlayerInRangeOfPoint(playerid,6.0,-2408.7590,976.0934,45.4175) || //SF
    IsPlayerInRangeOfPoint(playerid,6.0,-2243.9629,-2560.6477,31.8841) ||
    IsPlayerInRangeOfPoint(playerid,6.0,-1676.6323,414.0262,6.9484) || //Betweem LS and SF
    IsPlayerInRangeOfPoint(playerid,6.0,2202.2349,2474.3494,10.5258) ||
    IsPlayerInRangeOfPoint(playerid,6.0,614.9333,1689.7418,6.6968) || //LV
    IsPlayerInRangeOfPoint(playerid,6.0,-1328.8250,2677.2173,49.7665) ||
    IsPlayerInRangeOfPoint(playerid,6.0,70.3882,1218.6783,18.5165) || //LV
    IsPlayerInRangeOfPoint(playerid,6.0,2113.7390,920.1079,10.5255) ||
    IsPlayerInRangeOfPoint(playerid,6.0,-1327.7218,2678.8723,50.0625) || //LV
    IsPlayerInRangeOfPoint(playerid,6.0,1449.6364,-1667.3773,13.3687) ||
    IsPlayerInRangeOfPoint(playerid,6.0,1449.6364,-1667.3773,13.3687) || //LSPD Parkplatz Tanke
    IsPlayerInRangeOfPoint(playerid,6.0,1446.6611,-1668.4176,13.3687) ||
    IsPlayerInRangeOfPoint(playerid,6.0,1446.6611,-1668.4176,13.3687) || //LSPD Parkplatz Tanke
    IsPlayerInRangeOfPoint(playerid, 30.0, 2002.8409,-2382.0603,13.5469)) //LS Airport
    {
    return 1;
    }
    else
    {
    return 0;
    }
    }
    }


    dann ist es auch mal übersichtlicher



    und so dein CMD


    if(strcmp(cmd, "/tanken", true) == 0)
    {
    if(IsAtGasStation(playerid))
    {
    if(IsANoTachoVehicle(GetPlayerVehicleID(playerid)))
    {
    SendClientMessage(playerid,COLOR_YELLOW," Du kannst kein Fahrrad betanken!");
    }
    else
    {
    SetTimer("Fillup",RefuelWait,0);
    Refueling[playerid] = 1;
    FreezePlayer(playerid);
    SendClientMessage(playerid,COLOR_WHITE," Dein Fahrzeug wird betankt, Bitte warten....");
    }
    }
    return 1;
    }


    We are Anonymous.


    We are Legion.


    We do not forgive.


    We do not forget.


    Expect us.


  • :facepalm:



    Was zur...


    Warum Function und warum..????????????? ARRRRRRRRRRRRG!




    public IsAtGasStation(playerid) {
    if(IsPlayerConnected(playerid) && GetPVarInt(playerid,"loggedin") == 1 && GetPlayerState(playerid) == PLAYER_STATE_DRIVER) {
    if(IsPlayerInRangeOfPoint(playerid,15.0,1004.0070,-939.3102,42.1797) || IsPlayerInRangeOfPoint(playerid,15.0,1944.3260,-1772.9254,13.3906)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,-90.5515,-1169.4578,2.4079) || IsPlayerInRangeOfPoint(playerid,15.0,-1609.7958,-2718.2048,48.5391)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,-2029.4968,156.4366,28.9498) || IsPlayerInRangeOfPoint(playerid,15.0,-2408.7590,976.0934,45.4175)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,-2243.9629,-2560.6477,31.8841) || IsPlayerInRangeOfPoint(playerid,6.0,-1676.6323,414.0262,6.9484)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,2202.2349,2474.3494,10.5258) || IsPlayerInRangeOfPoint(playerid,15.0,614.9333,1689.7418,6.6968)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,-1328.8250,2677.2173,49.7665) || IsPlayerInRangeOfPoint(playerid,15.0,70.3882,1218.6783,18.5165)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,2113.7390,920.1079,10.5255) || IsPlayerInRangeOfPoint(playerid,15.0,-1327.7218,2678.8723,50.0625)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,2146.6143,2748.4758,10.3852)||IsPlayerInRangeOfPoint(playerid,15.0,2639.0022,1108.0353,10.3852)) { return 1; }
    else if(IsPlayerInRangeOfPoint(playerid,15.0,1598.2035,2198.6448,10.3856)) { return 1; }
    }
    return 0;
    }



    if(!IsAtGasStation(playerid))return SendClientMesssage(playerid,FARBE,"Du bist nicht an der Tankstelle");


    ...



    MfG
    Gero

  • dankeeee dir klappt jetzt :)

  • Wieso Function, ganz einfach weil er es so drinnen stehen hat, ich wäre ja für stock.


    Und mann muss ja nicht für jeden Punkt eine neue else if abfrage machen, reicht doch wenn man eine macht und wenn er an einer Dieser Orte ist true returnt?


    Oder liege ich da Falsch?


    We are Anonymous.


    We are Legion.


    We do not forgive.


    We do not forget.


    Expect us.