Tank anzeige geht net

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
  • public LuX_SpeedoMeterUp()
    {
    new Float:LPosX;
    new Float:LPosY;
    new Float:LPosZ;
    new Float:PlayerSpeedDistance;
    new value;
    new Float:L_VehHealth;
    new LVehicleStatus[15];


    for(new i=0; i<PLAYERS; i++)
    {
    if(VehicleStatus[GetPlayerVehicleID(i)] == 1)
    {
    LVehicleStatus = "~r~Locked";
    }
    else
    {
    LVehicleStatus = "~g~Unlocked";
    }
    if(IsPlayerConnected(i) && IsPlayerInAnyVehicle(i))
    {
    GetPlayerPos(i, LPosX, LPosY, LPosZ);
    GetPlayerVehicleID(i);
    GetVehicleHealth(GetPlayerVehicleID(i), L_VehHealth);
    PlayerSpeedDistance = floatsqroot(floatpower(floatabs(floatsub(LPosX,LuX_ReadPlayerPosition[i][ReadX])),2)+floatpower(floatabs(floatsub(LPosY,LuX_ReadPlayerPosition[i][ReadY])),2)+floatpower(floatabs(floatsub(LPosZ,LuX_ReadPlayerPosition[i][ReadZ])),2));
    value = floatround(PlayerSpeedDistance * 5000);
    new LuxZone[MAX_ZONE_NAME];
    GetPlayer2DZone(i, LuxZone, MAX_ZONE_NAME);
    if(LuX_SpeedoMeter[i] == 0){
    TextDrawShowForPlayer(i, LBox[i]);
    TextDrawShowForPlayer(i, LLine1[i]);
    TextDrawShowForPlayer(i, LLine2[i]);
    TextDrawShowForPlayer(i, LLine3[i]);
    TextDrawShowForPlayer(i, LLine4[i]);
    TextDrawShowForPlayer(i, LCredits[i]);
    TextDrawShowForPlayer(i, Lmph[i]);
    TextDrawShowForPlayer(i, LFunc[i]);
    LuX_SpeedoMeter[i] = 1; }


    new LKPH = floatround(value/1000);


    format(lstring,sizeof(lstring),"~b~Fahrzeug: ~w~%s~n~~b~Leben: ~w~%.2f~n~~b~Hoehe: ~w~%.1f~n~~b~Gps: ~w~%s~n~~b~Tank: %i",LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],L_VehHealth,LPosZ,LuxZone,CallRemoteFunction("Gas","i",GetPlayerVehicleID(i)));
    TextDrawSetString(LFunc[i], lstring);


    format(lstr,sizeof(lstr),"%sKM/H: ~w~%d",MPH_KPH_Color,LKPH);
    TextDrawSetString(Lmph[i], lstr);


    if(L_VehHealth <= 500){
    format(lstring,sizeof(lstring),"%sFahrzeug: ~w~%s~n~%sLeben: ~w~~r~%.2f~n~%sHoehe: ~w~%.1f~n~%sGps: ~w~%s",CategoriesColor,LVehiclesName[GetVehicleModel(GetPlayerVehicleID(i))-400],CategoriesColor,L_VehHealth,CategoriesColor,LPosZ,CategoriesColor,LuxZone);
    TextDrawSetString(LFunc[i], lstring);
    }
    /*if(LKPH >= VehicleMaxSpeed)
    {
    TogglePlayerControllable(i,0);
    format(lstr,sizeof(lstr),"~g~KM/H: ~r~%d",LKPH);
    TextDrawSetString(Lmph[i], lstr);
    }*/
    }
    LuX_ReadPlayerPosition[i][ReadX] = LPosX, LuX_ReadPlayerPosition[i][ReadY] = LPosY, LuX_ReadPlayerPosition[i][ReadZ] = LPosZ;}
    for(new i=0; i<PLAYERS; i++){
    if(!IsPlayerInAnyVehicle(i)){
    TextDrawHideForPlayer(i, LBox[i]);
    TextDrawHideForPlayer(i, LLine1[i]);
    TextDrawHideForPlayer(i, LLine2[i]);
    TextDrawHideForPlayer(i, LLine3[i]);
    TextDrawHideForPlayer(i, LLine4[i]);
    TextDrawHideForPlayer(i, LCredits[i]);
    TextDrawHideForPlayer(i, Lmph[i]);
    TextDrawHideForPlayer(i, LFunc[i]);
    LuX_SpeedoMeter[i] = 0;
    }
    }
    return 1;
    }


  • Integer stellen ganzzahlige werte da, float was man vermutlich in deinem fall bräuchte stellen dezimalbrüche da,


    poste mal pls deine getgas funktion

  • GasMax gibt es bei mir nicht,
    hier teste ich wie voll der tank ist, das müsste ich theoretisch jetzt irgendwie ins filterscript schreiben


    public CheckGas() {
    for(new i=0; i <= CAR_AMOUNT; i++) {
    for(new u=0; u <= MAX_PLAYERS; u++) {
    new c = 0;
    if(IsPlayerConnected(u)) {
    if(IsPlayerInVehicle(u, i) && GetPlayerVehicleSeat(u) == 0) {
    Gas[i]--;
    u = MAX_PLAYERS+1; // Schnelles Beenden um Lag zu vermeiden
    }
    c = 0;
    } else {
    c++;
    if(c > 50) { // Wenn 50 Ids hintereinander nicht existieren wird die Suche abgebrochen
    u = MAX_PLAYERS+1; // Schnelles Beenden um Lag zu vermeiden
    }
    }
    }
    if(Gas[i] <= 0) {
    new playerid = GetPlayerFromVehicle(i);
    if(playerid != -1) {
    TogglePlayerControllable(playerid, false);
    NoFuel[playerid] = 1;
    SendClientMessage(playerid, COLOR_RED, " Das Fahrzeug ist leer, benutze /exit um auszusteigen.");
    }
    }
    }
    }


    edit code eingefügt

  • ne gerade ist schlecht...
    hier mein code



    //Header
    new GasMax[] = {
    60, //"Landstalker",
    50,//"Bravura",
    50,//"Buffalo",
    110,//"Linerunner",
    45,//"Pereniel",
    50,//"Sentinel",
    200,//"Dumper",
    80,//"Firetruck",
    75,//"Trashmaster",
    60,//"Stretch",
    40,//"Manana",
    50,//"Infernus",
    50,//"Voodoo",
    90,//"Pony",
    90,//"Mule",
    48,//"Cheetah",
    70,//"Ambulance",
    60,//"Leviathan",
    60,//"Moonbeam",
    50,//"Esperanto",
    45,//"Taxi",
    40,//"Washington",
    60,//"Bobcat",
    64,//"Mr Whoopee",
    60,//"BF Injection",
    250,//"Hunter",
    50,//"Premier",
    80,//"Enforcer",
    70,//"Securicar",
    52,//"Banshee",
    50,//"Predator",
    80,//"Bus",
    100,//"Rhino",
    50,//"Barracks",
    55,//"Hotknife",
    100,//"Trailer",
    58,//"Previon",
    95,//"Coach",
    48,//"Cabbie",
    45,//"Stallion",
    70,//"Rumpo",
    100,//"RC Bandit",
    50,//"Romero",
    130,//"Packer",
    120,//"Monster Truck",
    45,//"Admiral",
    50,//"Squalo",
    80,//"Seasparrow",
    30,//"Pizzaboy",
    100,//"Tram",
    100,//"Trailer",
    55,//"Turismo",
    55,//"Speeder",
    60,//"Reefer",
    60,//"Tropic",
    160,//"Flatbed",
    80,//"Yankee",
    20,//"Caddy",
    48,//"Solair",
    75,//"Berkley's RC Van",
    100,//"Skimmer",
    50,//"PCJ-600",
    30,//"Roller",
    45,//"Freeway",
    100,//"RC Baron",
    100,//"RC Raider",
    60,//"Glendale",
    55,//"Oceanic",
    45,//"Sanchez",
    80,//"Sparrow",
    95,//"Patriot",
    25,//"Quad",
    50,//"Coastguard",
    50,//"Dinghy",
    50,//"Hermes",
    55,//"Sabre",
    90,//"Rustler",
    60,//"ZR-350",
    60,//"Walton",
    58,//"Regina",
    55,//"Comet",
    100,//"Fahrrad",
    100,//"Burrito",
    100,//"Camper",
    60,//"Marquis",
    35,//"Baggage",
    150,//"Dozer",
    100,//"Maverick",
    100,//"News Chopper",
    80,//"Rancher",
    80,//"FBI Rancher",
    50,//"Virgo",
    50,//"Greenwood",
    100,//"Jetmax",
    70,//"Hotring",
    80,//"Sandking",
    50,//"Blista Compact",
    80,//"Police Maverick",
    80,//"Boxville",
    58,//"Benson",
    80,//"Mesa",
    100,//"RC Goblin",
    75,//"Hotring Racer",
    75,//"Hotring Racer",
    75,//"Bloodring Banger",
    75,//"Rancher",
    60,//"Super GT",
    45,//"Elegant",
    110,//"Journey",
    100,//"Bike",
    100,//"Mountain Bike",
    50,//"Beagle",
    50,//"Cropdust",
    50,//"Stunt",
    140,//"Tanker",
    100,//"RoadTrain",
    50,//"Nebula",
    50,//"Majestic",
    48,//"Buccaneer",
    150,//"Shamal",
    175,//"Hydra",
    45,//"FCR-900",
    45,//"NRG-500",
    48,//"HPV1000",
    135,//"Cement Truck",
    75,//"Tow Truck",
    60,//"Fortune",
    60,//"Cadrona",
    65,//"FBI Truck",
    55,//"Willard",
    30,//"Forklift",
    35,//"Traktor",
    60,//"Combine",
    50,//"Feltzer",
    50,//"Remington",
    55,//"Slamvan",
    55,//"Blade",
    100,//"Freight",
    100,//"Streak",
    100,//"Vortex",
    48,//"Vincent",
    55,//"Bullet",
    58,//"Clover",
    60,//"Sadler",
    90,//"Firetruck",
    60,//"Hustler",
    50,//"Intruder",
    40,//"Primo",
    130,//"Cargobob",
    60,//"Tampa",
    60,//"Sunrise",
    60,//"Merit",
    100,//"Utility",
    50,//"Nevada",
    80,//"Yosemite",
    60,//"Windsor",
    100,//"Monster Truck",
    100,//"Monster Truck",
    55,//"Uranus",
    60,//"Jester",
    60,//"Sultan",
    60,//"Stratum",
    60,//"Elegy",
    150,//"Raindance",
    100,//"RC Tiger",
    50,//"Flash",
    50,//"Tahoma",
    55,//"Savanna",
    60,//"Bandito",
    100,//"Freight",
    100,//"Trailer",
    20,//"Kart",
    20,//"Mower",
    200,//"Duneride",
    35,//"Sweeper",
    50,//"Broadway",
    50,//"Tornado",
    200,//"AT-400",
    200,//"DFT-30",
    65,//"Huntley",
    60,//"Stafford",
    40,//"BF-400",
    70,//"Newsvan",
    30,//"Tug",
    100,//"Trailer",
    50,//"Emperor",
    40,//"Wayfarer",
    60,//"Euros",
    90,//"Hotdog",
    60,//"Club",
    100,//"Trailer",
    100,//"Trailer",
    200,//"Andromada",
    95,//"Dodo",
    100,//"RC Cam",
    50,//"Launch",
    60,//"Streifenwagen",
    60,//"Streifenwagen",
    60,//"Streifenwagen",
    75,//"Polizei Ranger",
    50,//"Picador",
    75,//"S.W.A.T. Van",
    55,//"Alpha",
    55,//"Phoenix",
    50,//"Glendale",
    50,//"Sadler",
    100,//"Luggage Trailer",
    100,//"Luggage Trailer",
    100,//"Stair Trailer",
    52,//"Boxville",
    100,//"Farm Plow",
    100//"Utility Trailer"
    };


    #define RunOutTime 30000
    #define RefuelWait 5000
    #define SPRITPREIS 2


    #define CAR_AMOUNT 700 //Change to Your Vehicle Amount
    new Gas[CAR_AMOUNT];


    //Bei anderen Stock's:
    stock GetGasMax(vehmodel)
    {
    if(vehmodel >= 400 && vehmodel <= 611)
    {
    return Gas[(vehmodel-400)];
    }
    return 100;
    }
    forward GetVehGas(veh);//Beispiel Godfather gibt den Speedo die Aktuelle Tankfüllung.
    public GetVehGas(veh)
    {
    return Gas[veh];
    }
    forward Fillup()
    public Fillup()
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    new VID;
    new FillUp,bizz=0;
    new string[256];
    VID = GetPlayerVehicleID(i);
    FillUp = GetGasMax(GetVehicleModel(VID)) - Gas[VID];
    if(Refueling[i] == 1)
    {
    if(GetPlayerMoney(i) >= FillUp+1)
    {
    if(PlayerToPoint(150, i, 1004.8455,-934.2491,41.884))
    {
    bizz = 10;
    }else
    {
    bizz = 11;
    }
    Gas[VID] += FillUp;
    FillUp = SBizzInfo[bizz][sbEntranceCost]* FillUp;
    format(string,sizeof(string),"* Fahrzeug für $%d aufgetankt. (Preis pro Liter: $%d)",FillUp,SBizzInfo[bizz][sbEntranceCost]);
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
    GivePlayerMoney(i, - FillUp);
    SBizzInfo[bizz][sbTill] += FillUp/1;
    ExtortionSBiz(bizz, FillUp);
    Refueling[i] = 0;
    UnFreezePlayer(i);
    }
    else
    {
    format(string,sizeof(string),"* Du hast nicht genug Geld zum Tanken, Kosten: $%d / Liter.",FillUp);
    SendClientMessage(i,COLOR_LIGHTBLUE,string);
    }
    }
    }
    }
    return 1;
    }


    for(new c=0;c<CAR_AMOUNT;c++)//OnGameModeInit
    {
    Gas[code=c] = GetGasMax(GetVehicleModel(c));
    }


    if(strcmp(cmd, "/fillcars", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pAdmin] >= 4 && AdminDuty[playerid] == 1)
    {
    for(new c=0;c<CAR_AMOUNT;c++)
    {
    Gas[code=c] = GetGasMax(GetVehicleModel(c));
    }
    SendClientMessage(playerid, COLOR_GREY, " Alle Autos wurden gefüllt ! ");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist nicht befugt ! ");
    return 1;
    }
    }
    return 1;
    }
    if(strcmp(cmd, "/fill", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    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....");
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_GREY," Du bist an keiner Tankstelle!");
    }
    }
    return 1;
    }


    //bei /accept
    else if(strcmp(x_job,"refill",true) == 0)
    {
    if(RefillOffer[playerid] < 999)
    {
    if(IsPlayerConnected(RefillOffer[playerid]))
    {
    if(GetPlayerMoney(playerid) > RefillPrice[playerid])
    {
    GetPlayerName(RefillOffer[playerid], giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new car = GetPlayerVehicleID(playerid);
    new fuel;
    PlayerInfo[RefillOffer[playerid]][pMechSkill] ++;
    if(PlayerInfo[RefillOffer[playerid]][pMechSkill] == 50)
    { SendClientMessage(RefillOffer[playerid], COLOR_YELLOW, "* Du hast jetzt Mechaniker Skill Level 2, Du kannst nun mehr Benzin in die Autos der Kunden füllen."); }
    else if(PlayerInfo[RefillOffer[playerid]][pMechSkill] == 100)
    { SendClientMessage(RefillOffer[playerid], COLOR_YELLOW, "* Du hast jetzt Mechaniker Skill Level 3, Du kannst nun mehr Benzin in die Autos der Kunden füllen."); }
    else if(PlayerInfo[RefillOffer[playerid]][pMechSkill] == 200)
    { SendClientMessage(RefillOffer[playerid], COLOR_YELLOW, "* Du hast jetzt Mechaniker Skill Level 4, Du kannst nun mehr Benzin in die Autos der Kunden füllen."); }
    else if(PlayerInfo[RefillOffer[playerid]][pMechSkill] == 400)
    { SendClientMessage(RefillOffer[playerid], COLOR_YELLOW, "* Du hast jetzt Mechaniker Skill Level 5, Du kannst nun mehr Benzin in die Autos der Kunden füllen."); }
    new level = PlayerInfo[RefillOffer[playerid]][pMechSkill];
    if(level >= 0 && level <= 50)
    { fuel = 15; }
    else if(level >= 51 && level <= 100)
    { fuel = 20; }
    else if(level >= 101 && level <= 200)
    { fuel = 30; }
    else if(level >= 201 && level <= 400)
    { fuel = 40; }
    else if(level >= 401)
    { fuel = 50; }
    format(string, sizeof(string), "* Du hast das Auto von %d mit %d Benzin für $%d auftanken lassen.",giveplayer,fuel,RefillPrice[playerid]);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
    format(string, sizeof(string), "* Du hast %s's Fahrzeug mit %d Benzin aufgefüllt. Die $%d wurden zum Zahltag gerechnet.",sendername,fuel,RefillPrice[playerid]);
    SendClientMessage(RefillOffer[playerid], COLOR_LIGHTBLUE, string);
    PlayerInfo[RefillOffer[playerid]][pPayCheck] += RefillPrice[playerid];
    GivePlayerMoney(playerid, -RefillPrice[playerid]);
    new maxgas = GetGasMax(GetVehicleModel(car));
    if((Gas[car]+15) > maxgas)
    {
    Gas[car] = maxgas;
    }
    else
    {
    Gas[car] += 15;
    }
    RefillOffer[playerid] = 999;
    RefillPrice[playerid] = 0;
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du kannst nicht Auffüllen !");
    return 1;
    }
    }
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du hast keinen gesagt das er dich betanken soll !");
    return 1;
    }
    }

    //edit: poste mal was limit ist erreicht

  • weiter im text:


    if(strcmp(cmd, "/fillcar", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(IsPlayerInAnyVehicle(playerid))
    {
    if(PlayerInfo[playerid][pFuel] > 0)
    {
    new veh = GetPlayerVehicleID(playerid);
    if(IsANoTachoVehicle(veh))
    {
    SendClientMessage(playerid,COLOR_YELLOW," Ein Fahrrad hat doch keinen Tank...");
    }
    else if( (Gas[veh] + 20) < GetGasMax(GetVehicleModel(veh)) )
    {
    SendClientMessage(playerid, COLOR_LIGHTBLUE, " ~w~~n~~n~~n~~n~~n~~n~~n~~n~~n~Fahrzeug tanken, bitte warten.");
    Gas[veh] += 20;
    PlayerInfo[playerid][pFuel] = 0;
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Dein Fahrzeug hat noch genug Benzin !");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Dein Benzinkanister ist leer !");
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist in keinem Fahrzeug !");
    }
    }
    return 1;
    }


    forward Rep(playerid,veh,Float:vehX,Float:vehY,Float:vehZ,Float:vehA);
    public Rep(playerid,veh,Float:vehX,Float:vehY,Float:vehZ,Float:vehA)
    {
    SetVehiclePos(veh,vehX,vehY,vehZ);
    SetVehicleZAngle(veh,vehA);
    PutPlayerInVehicle(playerid,veh,0);
    UnFreezePlayer(playerid);
    SendClientMessage(playerid,COLOR_GREEN," Du hast dein Fahrzeug auf Kosten des Staats tanken und reparieren lassen!");
    Gas[veh] = GetGasMax(GetVehicleModel(veh));
    LinkVehicleToInterior(veh,0);
    SetPlayerInterior(playerid,0);
    PlayerInfo[playerid][pInt] = 0;
    return 1;
    }


    Jetzt kannst du auch die Remotefunktion richtig nutzen,. aber ich geh jetzt schalfen mach ich dir moregn oder ein anderer brotfisch


    mfg


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