Ein bestimmtes Car ..

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,


    also ich habe hier nen GM, bin dabei es auszuprobieren, und bin jetzt beim Beruf Trucker angekommen, okay. Soweit, so gut. Jetzt möchte ich /load bzw. /buyprods machen, und bei /buyprods steht immer 'This Vehicle does not deliver Products' und bei /load 'Your are not in a delivery Truck'. So, ich habe es jetzt mit jedem Truck ausprobiert, bei allen solchen steht die meldung. So, jetzt meine Frage: Kann man das Scripten, dass das nur mit einem bestimmen Truck geht? [TruckID: 403]
    Ich bedanke mich schonmal im Vorraus. Die Scriptzeilen: 1) /buyprods | 2) /load


    if(strcmp(cmd, "/buyprods", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    new tmpcar = GetPlayerVehicleID(playerid);
    new compcost = 50;
    if(PlayerToPoint(60.0, playerid, 2787.8,-2436.3,13.7))
    {
    if(IsATruck(tmpcar))
    {
    if(PlayerHaul[tmpcar][pLoad] < PlayerHaul[tmpcar][pCapasity])
    {
    new amount;
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /buyprods [amount]");
    return 1;
    }
    amount = strval(tmp);
    if(amount < 1 || amount > 500) { SendClientMessage(playerid, COLOR_GREY, " Can't buy less then 1 Product or more then 500 !"); return 1; }
    new check= PlayerHaul[tmpcar][pLoad] + amount;
    if(check > PlayerHaul[tmpcar][pCapasity])
    {
    format(string, sizeof(string), " You went over the Truck Products Carry Limit of %d, you currently carry %d.",PlayerHaul[tmpcar][pCapasity],PlayerHaul[tmpcar][pLoad]);
    SendClientMessage(playerid, COLOR_GREY, string);
    return 1;
    }
    new cost = amount*compcost;
    if(GetPlayerMoney(playerid) >= cost)
    {
    PlayerHaul[tmpcar][pLoad] += amount;
    format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    format(string, sizeof(string), "You bought %d Products for $%d.", amount,cost);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    GivePlayerMoney(playerid,-cost);
    PlayerPlaySound(playerid, 1052, 0.0, 0.0, 0.0);
    return 1;
    }
    else
    {
    format(string, sizeof(string), "You cant afford %d Products at $%d !", amount,cost);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    return 1;
    }
    }
    else
    {
    format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, TEAM_GROVE_COLOR, "This Vehicle does not deliver Products.");
    return 1;
    }
    }
    }
    return 1;
    }


    if(strcmp(cmd, "/load", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    new tmpcar = GetPlayerVehicleID(playerid);
    if(tmpcar < 403 || tmpcar > 403)
    {
    GameTextForPlayer(playerid, "~r~You are not in a delivery truck", 5000, 1);
    return 1;
    }
    format(string, sizeof(string), "Products: %d/%d.", PlayerHaul[tmpcar][pLoad],PlayerHaul[tmpcar][pCapasity]);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    }
    return 1;
    }


    --
    Danke schonmal im Vorraus <3 :love:

  • Mh, falls noch mehr fragen kommen, alles was bei IsATruck gefunden wurde:


    forward IsATruck(carid);


    public IsATruck(carid)
    {
    if(carid >= 0 && carid <= 0)
    {
    return 1;
    }
    return 0;
    }


    if(IsATruck(newcar))
    {
    format(string, sizeof(string), "Products: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    SendClientMessage(playerid, COLOR_WHITE, "INFO: Du kannst Produkte für das Unternehmen liefern .");
    SendClientMessage(playerid, COLOR_WHITE, "INFO: Die Befehle sind /load /buyprods /sellprods");
    }


    if(IsATruck(newcar))
    {
    format(string, sizeof(string), "Products: %d/%d", PlayerHaul[newcar][pLoad],PlayerHaul[newcar][pCapasity]);
    SendClientMessage(playerid, TEAM_GROVE_COLOR, string);
    SendClientMessage(playerid, COLOR_WHITE, "INFO: Du kannst Produkte für das Unternehmen liefern .");
    SendClientMessage(playerid, COLOR_WHITE, "INFO: Die Befehle sind /load /buyprods /sellprods");
    }


    Edit: eine PWN-Box bearbeitet.

  • Lol Besteva:


    public IsATruck(carid)
    {
    if(carid >= 0 && carid <= 0)
    {
    return 1;
    }
    return 0;
    }


    Sorry ich weiss das das Script nicht von dir ist und es ein gf edit ist aber mit diesem Callback kann der Trucker job nicht Funktionieren. Da es Keine Trucks laut Callback gibt welche Produkte Liefern können.

  • Ouh -.- .. Und wie mache ich das jetzt, dass ein Truck [ID: 403] Producte liefern kann? Äh, ich hab au ned gesagt, dass das Script von mir ist. Willst du auf irgendwas hinaus?
    Edit: Wäre es möglich, wenn ich bei if(carid >= 0 && carid <= 0) die beiden Nullen durch eine 403 ersetze?
    Edit: Nein, geht leider ned. Hat noch jemand ne Lösung/Vorschlag?

  • Ähm vllt so?
    public IsATruck(carid)
    {
    if(carid == 403 || carid == 514 || carid == 515)
    {
    return 1;
    }
    return 0;
    }
    Also 403 514 und 515 sind die 3 Truck Modelle nur mal so am Rande :P
    So müssts eigentlich gehn.


  • nicht ganz schlecht. jedoch nicht richtig da du die vehicleid und nicht die Modelid hast. etwas umschreiben und dann gehts:


    public IsATruck(carid)
    {
    new model = GetVehicleModel(car);
    if(model == 403 || model == 514 || model == 515)
    {
    return 1;
    }
    return 0;
    }



  • FALSCH xDD


    So:
    public IsATruck(carid)
    {
    new model = GetVehicleModel(carid); // nicht car sondern carid :D
    if(model == 403 || model == 514 || model == 515)
    {
    return 1;
    }
    return 0;
    }


    So jetzt passts aber^^

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • Libi wenn die Trucks nach den Moddelids erkannt werden ist dies für die Trucks nicht nötig. Klar für alle anderen Autos wäre dies zum Vorteil.