Tanksystem

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
  • Hi Leute ich habe ein Tanksystem und Folgendes Problem:
    Ich habe einmal gescriptet das Jedes Auto verschiedene Tankmengen haben kann..
    und einmal das jedes Auto verschiedene Tanksorten hat nur diese beiden sachen Vertragen sich i.wie nicht im Speedometer.
    Da steht immer Tanksorte 100 Liter es wird auch weiniger nur das Problem ist das das Auto garkeine 100 Tank hat O.o
    habe schon alles Versucht zu Fixxen aber geht i.wie net.... Falls ihr Codeschnipsel braucht bitte sagen !!

  • kk dann hier mein ganzes Tanksystem:
    new GasMax[] = {
    60,50,70,120,50,50,120,100,100,60,40,80,60,70,70,80,100,150,60,50,
    70,60,50,80,40,150,50,120,150,120,70,150,70,120,80,90,70,150,80,120,
    70,150,80,120,120,70,150,150,40,150,150,80,150,150,150,120,100,40,80,90,
    150,40,20,40,150,150,70,70,30,150,120,40,150,150,70,80,150,80,80,60,
    80,150,90,90,150,20,120,150,150,80,120,50,70,150,100,120,50,150,100,100,
    80,150,100,100,100,90,80,70,100,150,150,150,150,150,120,120,60,60,70,150,
    150,30,40,60,100,80,60,50,100,50,15,40,120,90,90,90,80,150,150,150,
    80,100,80,80,120,70,60,60,150,80,60,60,100,150,100,80,120,120,70,80,
    90,90,90,150,150,70,80,80,40,150,150,20,20,120,30,70,80,150,100,100,
    80,30,80,20,150,60,30,70,100,80,150,150,150,150,150,150,100,100,100,100,0
    70,120,90,90,150,150,150,150,150,120,150,150
    };
    Ongamemodeinit
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
    Gas[v] = GetGasMax(GetVehicleModel(v));
    }
    OnPlayerupdate
    if(IsPlayerConnected(playerid))
    {
    new string[256];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    new SpritName[30];
    new vehicle = GetPlayerVehicleID(i);
    new MID = GetVehicleModel(vehicle);
    new Spritart = GetFuel(MID);
    if(Spritart == 1) { SpritName = "Kerosin"; }
    if(Spritart == 1) { SpritName = "Super Bleifrei"; }
    if(Spritart == 2) { SpritName = "Diesel"; }
    if(Spritart == 3) { SpritName = "E10"; }
    if(Spritart == 4) { SpritName = "Bioethanol"; }
    if(IsPlayerInAnyVehicle(i) == 1)
    {
    if(Gas[vehicle] == 0)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~y~Leer",SpritName);
    GameTextForPlayer(i,string,1000,3);
    TogglePlayerControllable(i,0);
    }
    if(Gas[vehicle] >= 0 && Gas[vehicle] <= 10)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 10 && Gas[vehicle] <= 20)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 20 && Gas[vehicle] <= 30)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 30 && Gas[vehicle] <= 40)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 40 && Gas[vehicle] <= 50)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 50 && Gas[vehicle] <= 60)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 60 && Gas[vehicle] <= 70)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    else if(Gas[vehicle] >= 70 && Gas[vehicle] <= 80)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 80 && Gas[vehicle] <= 90)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    if(Gas[vehicle] >= 90 && Gas[vehicle] <= 100)
    {
    format(string, sizeof(string), "~b~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~%s:~w~%d Liter",SpritName,Gas[vehicle]);
    GameTextForPlayer(i,string,1000,3);
    }
    }
    }
    }
    }
    stock GetGasMax(vehmodel)
    {
    if(vehmodel >= 400 && vehmodel <= 611)
    {
    return GasMax[(vehmodel-400)];
    }
    return 100;
    }
    Bei einem Timerpublic
    Counter ++;
    if(Counter >= TANK_ABZIEHEN)
    {
    Counter = 0;
    for(new v = 0; v < MAX_VEHICLES; v++)
    {
    if(motor[v] == true)
    {
    if(GetFuel(GetVehicleModel(v)) > 0)
    {
    if(Gas[v] >= 1)
    {
    Gas[v] --;
    }
    else
    {
    for(new playerid = 0; playerid < MAX_PLAYERS; playerid++)
    {
    if(IsPlayerInVehicle(playerid,v))
    {
    TogglePlayerControllable(playerid,0);
    }
    }
    }
    }
    }
    }
    }
    Das wars
    wenn nochetwas bitte sagen ;)

  • C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(59) : error 001: expected token: "}", but found "-integer value-"
    C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(60) : error 010: invalid function or declaration
    C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(78) : error 017: undefined symbol "Gas"
    C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(78) : warning 215: expression has no effect
    C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(78) : error 001: expected token: ";", but found "]"
    C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(78) : error 029: invalid expression, assumed zero
    C:\Users\Andreas\Desktop\Seelfmade\gamemodes\Untitled.pwn(78) : fatal error 107: too many error messages on one line
    pls help ^^

  • do.de - Domain-Offensive - Domains für alle und zu super Preisen
  • do.de - Domain-Offensive - Domains für alle und zu super Preisen