Schadensanzeige

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,
    Ich habe eine Anzeige:
    if(kmhCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else
    {
    kd[playerid] = TextDrawCreate(356,392,"~w~km/h");
    TextDrawFont(kd[playerid],2);
    TextDrawSetShadow(kd[playerid],1);
    TextDrawShowForPlayer(playerid, kd[playerid]);
    kmhCREATED[playerid] =true;
    kdSHOWN[playerid]=true;
    }
    }
    if(speedCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else
    {
    sd[playerid] = TextDrawCreate(320,392,"kmh");
    TextDrawFont(sd[playerid],2);
    TextDrawSetShadow(sd[playerid],1);
    TextDrawShowForPlayer(playerid, sd[playerid]);
    speedCREATED[playerid] =true;
    sdSHOWN[playerid]=true;
    }
    }
    if(fuelCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else if(IsAnEventCar(newcar)) { }
    else
    {
    format(string, sizeof(string), "~g~Tank: ~w~%1.f/%d", spawncar_gas[newcar],spawncar_maxgas[newcar]);
    fd[playerid] = TextDrawCreate(294,372,string);
    TextDrawFont(fd[playerid],2);
    TextDrawSetShadow(fd[playerid],1);
    TextDrawShowForPlayer(playerid, fd[playerid]);
    fuelCREATED[playerid] = true;
    fdSHOWN[playerid]=true;
    }
    }
    if(fueltypeCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else if(IsAnEventCar(newcar)) { }
    else
    {
    new kraftstoff[256], string2[128];
    kraftstoff = GetPlayerVehicleType(GetPlayerVehicleID(playerid));
    format(string2, sizeof(string2), "~g~Kraftstoff: ~w~%s", kraftstoff);
    ftd[playerid] = TextDrawCreate(220,382,string2);
    TextDrawFont(ftd[playerid],2);
    TextDrawSetShadow(ftd[playerid],1);
    TextDrawShowForPlayer(playerid, ftd[playerid]);
    fueltypeCREATED[playerid]=true;
    ftdSHOWN[playerid]=true;
    }
    }
    Die ich gerne mit einer Schadensanzeige erweitern würde doch ich weiß nicht wie.
    Hoffe ihr klönnt mir helfen. :)


    MfG
    Xilent

  • Hier noch ein paar infos
    new bool:kmhCREATED[MAX_PLAYERS],
    Text:kd[MAX_PLAYERS];
    new bool:speedCREATED[MAX_PLAYERS],
    Text:sd[MAX_PLAYERS];
    new bool: fuelCREATED[MAX_PLAYERS],
    Text: fd[MAX_PLAYERS];
    new bool: fueltypeCREATED[MAX_PLAYERS],
    Text: ftd[MAX_PLAYERS];
    robCREATED[playerid] = false;
    speedCREATED[playerid] = false;
    fuelCREATED[playerid] = false;
    kmhCREATED[playerid] = false;
    sdSHOWN[playerid]=false;
    fdSHOWN[playerid]=false;
    kdSHOWN[playerid]=false;
    if(kmhCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else
    {
    kd[playerid] = TextDrawCreate(356,392,"~w~km/h");
    TextDrawFont(kd[playerid],2);
    TextDrawSetShadow(kd[playerid],1);
    TextDrawShowForPlayer(playerid, kd[playerid]);
    kmhCREATED[playerid] =true;
    kdSHOWN[playerid]=true;
    }
    }
    if(speedCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else
    {
    sd[playerid] = TextDrawCreate(320,392,"kmh");
    TextDrawFont(sd[playerid],2);
    TextDrawSetShadow(sd[playerid],1);
    TextDrawShowForPlayer(playerid, sd[playerid]);
    speedCREATED[playerid] =true;
    sdSHOWN[playerid]=true;
    }
    }
    if(fuelCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else if(IsAnEventCar(newcar)) { }
    else
    {
    format(string, sizeof(string), "~g~Tank: ~w~%1.f/%d", spawncar_gas[newcar],spawncar_maxgas[newcar]);
    fd[playerid] = TextDrawCreate(294,372,string);
    TextDrawFont(fd[playerid],2);
    TextDrawSetShadow(fd[playerid],1);
    TextDrawShowForPlayer(playerid, fd[playerid]);
    fuelCREATED[playerid] = true;
    fdSHOWN[playerid]=true;
    }
    }
    if(fueltypeCREATED[playerid] == false)
    {
    if(IsANeewbieBike(newcar)) { }
    else if(IsAnEventCar(newcar)) { }
    else
    {
    new kraftstoff[256], string2[128];
    kraftstoff = GetPlayerVehicleType(GetPlayerVehicleID(playerid));
    format(string2, sizeof(string2), "~g~Kraftstoff: ~w~%s", kraftstoff);
    ftd[playerid] = TextDrawCreate(220,382,string2);
    TextDrawFont(ftd[playerid],2);
    TextDrawSetShadow(ftd[playerid],1);
    TextDrawShowForPlayer(playerid, ftd[playerid]);
    fueltypeCREATED[playerid]=true;
    ftdSHOWN[playerid]=true;
    }
    }
    if(IsAAdminCar(newcar))
    public OnPlayerExitVehicle(playerid, vehicleid)
    {


    if(GetPlayerState(playerid) == 1)
    {
    return 1;
    }
    if(gGas[playerid] == 1)
    {
    GameTextForPlayer(playerid, "~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~~n~Left car", 500, 3);
    }
    if(sdSHOWN[playerid]==true){TextDrawDestroy(sd[playerid]); sdSHOWN[playerid]=false; speedCREATED[playerid]=false;}
    if(fdSHOWN[playerid]==true){TextDrawDestroy(fd[playerid]);fuelCREATED[playerid]=false;fdSHOWN[playerid]=false;}
    if(ftdSHOWN[playerid]==true){TextDrawDestroy(ftd[playerid]);ftdSHOWN[playerid]=false;fueltypeCREATED[playerid]=false;}
    if(kdSHOWN[playerid]==true){TextDrawDestroy(kd[playerid]);kdSHOWN[playerid]=false;kmhCREATED[playerid]=false;}
    if(speedcount[playerid] > 0)
    {
    speedcount[playerid] = 0;
    }
    return 1;
    }

    }

    new w = GetPlayerWeatherCity(i);
    if(w==2){SetPlayerWeather(i, wLS); }
    else if(w==3){SetPlayerWeather(i, wLV);}
    else if(w==4){SetPlayerWeather(i, wSF);}
    else {SetPlayerWeather(i, 1); }
    if(!IsPlayerInAnyVehicle(i))
    {
    if(sdSHOWN[i]==true){TextDrawDestroy(sd[i]); sdSHOWN[i]=false; speedCREATED[i]=false;}
    if(fdSHOWN[i]==true){TextDrawDestroy(fd[i]);fuelCREATED[i]=false;fdSHOWN[i]=false;}
    if(ftdSHOWN[i]==true){TextDrawDestroy(ftd[i]);ftdSHOWN[i]=false;fueltypeCREATED[i]=false;}
    if(kdSHOWN[i]==true){TextDrawDestroy(kd[i]);kdSHOWN[i]=false;kmhCREATED[i]=false;}
    if(speedcount[i] > 0)
    {
    speedcount[i] = 0;
    }
    }
    Ich hoffe das hilft ^^


    MfG
    Xilent

  • Ich habe alles so ergänzt:
    new Float:schaden = (carhp < 250.0) ? 100.0 : ((100.0 - (carhp / 10.0)) * (4.0 / 3.0));
    //---------------------------------------------------------------------------------------
    new bool:schadenCREATED[MAX_PLAYERS],
    Text:sa[MAX_PLAYERS];
    //---------------------------------------------------------------------------------------
    schadenCREATED[playerid] = false;
    saSHOWN[playerid]=false;
    //------------------------------------------------------------------------------------------
    if(schadenCREATED[playerid] == false)
    {
    if(IsAnEventCar(newcar)) { }
    else
    {
    sa[playerid] = TextDrawCreate(270,392,"schaden");
    TextDrawFont(sa[playerid],2);
    TextDrawSetShadow(sa[playerid],1);
    TextDrawShowForPlayer(playerid, sa[playerid]);
    schadenCREATED[playerid] =true;
    saSHOWN[playerid]=true;
    }
    }
    //---------------------------------------------------------------------------------------
    if(saSHOWN[playerid]==true){TextDrawDestroy(sa[playerid]); saSHOWN[playerid]=false; schadenCREATED[playerid]=false;}
    //--------------------------------------------------------------------------------------
    if(saSHOWN[i]==true){TextDrawDestroy(sa[i]); saSHOWN[i]=false; schadenCREATED[i]=false;}
    //----------------------------------------------------------------------------------------


    Doch bekomme ich diese Error
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(2382) : error 017: undefined symbol "saSHOWN"
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(2382) : warning 215: expression has no effect
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(2382) : error 001: expected token: ";", but found "]"
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(2382) : error 029: invalid expression, assumed zero
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(2382) : fatal error 107: too many error messages on one line


    Compilation aborted.Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase



    4 Errors.

    ?(

  • Ja sry ^^


    Leider bekomme ich jetzt 3 Warnings :(
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(11588) : warning 213: tag mismatch
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(11940) : warning 213: tag mismatch
    F:\Programme\Spiele\GTA San Andreas\Role Play City#\gamemodes\rpc.pwn(41180) : warning 203: symbol is never used: "schaden"
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase


    Header size: 9392 bytes
    Code size: 1701976 bytes
    Data size: 45657016 bytes
    Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
    Total requirements:47384768 bytes


    3 Warnings.

  • 11588:
    //-------------------------------------------------------------------------------------------------------------------Schadensanzeige
    if(saSHOWN[playerid]==true){TextDrawDestroy(sa[playerid]); saSHOWN[playerid]=false; schadenCREATED[playerid]=false;}
    //-------------------------------------------------------------------------------------------------------------------
    11940:
    //--------------------------------------------------------------------------------------------------------Schadensanzeige
    if(saSHOWN[i]==true){TextDrawDestroy(sa[i]); saSHOWN[i]=false; schadenCREATED[i]=false;}
    //--------------------------------------------------------------------------------------------------------


    Sry hatte das voll vergessen xD


    MfG
    Xilent ^^


    //Edith: Aussehen tut das Ingame so:

    Einmal editiert, zuletzt von Xilent ()