TextdrawStats

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,


    wenn ich und Fabi.StaR auf meinen DM-Server joinen,
    werden bei ihm die Stats angezeigt und bei mir nicht.
    Bei mir steht immer nur "Stats" aber die Box und so
    weiter nicht.. Die Stats sind als Textdraw angezeigt.
    Hier ist mal mein Code.
    Ich hoffe mir kann einer helfen.


    Definitionen:

    Spoiler anzeigen
    new Text:StatGeld[MP];
    new Text:StatKills[MP];
    new Text:StatTode[MP];
    new Text:StatName[MP];
    new Text:StatStats[MP];
    new Text:StatKD[MP];
    new Text:StatScore[MP];


    Erstellung der Textdraws:

    Spoiler anzeigen
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    StatGeld[i] = TextDrawCreate(506.000000, 180.000000, "");
    TextDrawBackgroundColor(StatGeld[i], 255);
    TextDrawFont(StatGeld[i], 2);
    TextDrawLetterSize(StatGeld[i], 0.270000, 1.000000);
    TextDrawColor(StatGeld[i], -10066177);
    TextDrawSetOutline(StatGeld[i], 0);
    TextDrawSetProportional(StatGeld[i], 1);
    TextDrawSetShadow(StatGeld[i], 1);
    TextDrawUseBox(StatGeld[i], 1);
    TextDrawBoxColor(StatGeld[i], 255);
    TextDrawTextSize(StatGeld[i], 607.000000, 0.000000);

    StatKills[i] = TextDrawCreate(506.000000, 190.000000, "");
    TextDrawBackgroundColor(StatKills[i], 255);
    TextDrawFont(StatKills[i], 2);
    TextDrawLetterSize(StatKills[i], 0.260000, 1.000000);
    TextDrawColor(StatKills[i], -10066177);
    TextDrawSetOutline(StatKills[i], 0);
    TextDrawSetProportional(StatKills[i], 1);
    TextDrawSetShadow(StatKills[i], 1);
    TextDrawUseBox(StatKills[i], 1);
    TextDrawBoxColor(StatKills[i], 255);
    TextDrawTextSize(StatKills[i], 607.000000, 0.000000);

    Spoiler anzeigen
    StatTode[i] = TextDrawCreate(506.000000, 200.000000, "");
    TextDrawBackgroundColor(StatTode[i], 255);
    TextDrawFont(StatTode[i], 2);
    TextDrawLetterSize(StatTode[i], 0.270000, 1.000000);
    TextDrawColor(StatTode[i], -10066177);
    TextDrawSetOutline(StatTode[i], 0);
    TextDrawSetProportional(StatTode[i], 1);
    TextDrawSetShadow(StatTode[i], 1);
    TextDrawUseBox(StatTode[i], 1);
    TextDrawBoxColor(StatTode[i], 255);
    TextDrawTextSize(StatTode[i], 607.000000, 0.000000);

    StatName[i] = TextDrawCreate(508.000000, 168.000000, "");
    TextDrawBackgroundColor(StatName[i], 255);
    TextDrawFont(StatName[i], 2);
    TextDrawLetterSize(StatName[i], 0.200000, 1.000000);
    TextDrawColor(StatName[i], -993737473);
    TextDrawSetOutline(StatName[i], 0);
    TextDrawSetProportional(StatName[i], 1);
    TextDrawSetShadow(StatName[i], 1);

    StatStats[i] = TextDrawCreate(502.000000, 158.000000, "[ ] Stats");
    TextDrawBackgroundColor(StatStats[i], 255);
    TextDrawFont(StatStats[i], 0);
    TextDrawLetterSize(StatStats[i], 0.500000, 1.000000);
    TextDrawColor(StatStats[i], -1);
    TextDrawSetOutline(StatStats[i], 0);
    TextDrawSetProportional(StatStats[i], 1);
    TextDrawSetShadow(StatStats[i], 1);

    StatKD[i] = TextDrawCreate(530.000000, 222.000000, "");
    TextDrawBackgroundColor(StatKD[i], 255);
    TextDrawFont(StatKD[i], 2);
    TextDrawLetterSize(StatKD[i], 0.160000, 0.799999);
    TextDrawColor(StatKD[i], -993737473);
    TextDrawSetOutline(StatKD[i], 0);
    TextDrawSetProportional(StatKD[i], 1);
    TextDrawSetShadow(StatKD[i], 1);

    StatScore[i] = TextDrawCreate(506.000000, 210.000000, "");
    TextDrawBackgroundColor(StatScore[i], 255);
    TextDrawFont(StatScore[i], 2);
    TextDrawLetterSize(StatScore[i], 0.230000, 1.100000);
    TextDrawColor(StatScore[i], -10066177);
    TextDrawSetOutline(StatScore[i], 0);
    TextDrawSetProportional(StatScore[i], 1);
    TextDrawSetShadow(StatScore[i], 1);
    TextDrawUseBox(StatScore[i], 1);
    TextDrawBoxColor(StatScore[i], 255);
    TextDrawTextSize(StatScore[i], 607.000000, 0.000000);
    }


    Anzeige der Textdraws per Befehl:

    Spoiler anzeigen
    ocmd:stats(playerid,params[])
    {
    if(Statistik[playerid] == false)
    {
    TextDrawShowForPlayer(playerid, StatStats[playerid]);
    TextDrawShowForPlayer(playerid, StatName[playerid]);
    TextDrawShowForPlayer(playerid, StatGeld[playerid]);
    TextDrawShowForPlayer(playerid, StatKills[playerid]);
    TextDrawShowForPlayer(playerid, StatTode[playerid]);
    TextDrawShowForPlayer(playerid, StatKD[playerid]);
    TextDrawShowForPlayer(playerid, StatScore[playerid]);
    Statistik[playerid] = true;
    return 1;
    }
    if(Statistik[playerid] == true)
    {
    TextDrawHideForPlayer(playerid, StatStats[playerid]);
    TextDrawHideForPlayer(playerid, StatName[playerid]);
    TextDrawHideForPlayer(playerid, StatGeld[playerid]);
    TextDrawHideForPlayer(playerid, StatKills[playerid]);
    TextDrawHideForPlayer(playerid, StatTode[playerid]);
    TextDrawHideForPlayer(playerid, StatKD[playerid]);
    TextDrawHideForPlayer(playerid, StatScore[playerid]);
    return 1;
    }
    return 1;
    }


    Aktualisierung der Textdraws per Sekundentimer:

    Spoiler anzeigen
    public UpdateStats()
    {
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    if(Statistik[i] == true)
    {
    //NAME
    new name[MAX_PLAYER_NAME], namestr[64];
    GetPlayerName(i,name,sizeof(name));
    format(namestr,sizeof(namestr),"Name: %s",name);
    TextDrawSetString(StatName[i],namestr);
    //GELD
    new money, moneystr[64];
    money = GetPlayerMoney(i);
    format(moneystr,sizeof(moneystr),"Geld: %i",money);
    TextDrawSetString(StatGeld[i],moneystr);
    //KILLS
    new kills, killstr[64];
    kills = PlayerInfo[i][pKills];
    format(killstr,sizeof(killstr),"Kills: %i",kills);
    TextDrawSetString(StatKills[i],killstr);
    //DEATHS
    new tode, todstr[64];
    tode = PlayerInfo[i][pDeaths];
    format(todstr,sizeof(todstr),"Tode: %i",tode);
    TextDrawSetString(StatTode[i],todstr);
    //SCORE
    new pscore, scorestr[64];
    pscore = GetPlayerScore(i);
    format(scorestr,sizeof(scorestr),"Score: %i",pscore);
    TextDrawSetString(StatScore[i],scorestr);
    //K/D
    new kdstr[128];
    new Float:kd = floatdiv(kills,tode);
    format(kdstr,sizeof(kdstr),"K/D-Rate: %.2f",kd);
    TextDrawSetString(StatKD[i],kdstr);
    //ANZEIGEN LASSEN
    TextDrawShowForPlayer(i, StatStats[i]);
    TextDrawShowForPlayer(i, StatName[i]);
    TextDrawShowForPlayer(i, StatGeld[i]);
    TextDrawShowForPlayer(i, StatKills[i]);
    TextDrawShowForPlayer(i, StatTode[i]);
    TextDrawShowForPlayer(i, StatKD[i]);
    TextDrawShowForPlayer(i, StatScore[i]);
    return 1;
    }
    else return 1;
    }
    return 1;
    }

  • Jetzt bekomme ich Errors..


    Warnings:

    Spoiler anzeigen
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(165) : warning 213: tag mismatch
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(177) : warning 213: tag mismatch
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(189) : warning 213: tag mismatch
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(201) : warning 213: tag mismatch
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(210) : warning 213: tag mismatch
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(219) : warning 213: tag mismatch
    C:\Users\Narushi\Desktop\samp\New-Evolution-Reallife\gamemodes\DeathMatch.pwn(228) : warning 213: tag mismatch
    Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase

    Spoiler anzeigen
    7 Warnings.


    Script:

    Spoiler anzeigen
    for(new i=0; i<MAX_PLAYERS; i++)
    {
    StatGeld[i] = CreatePlayerTextDraw(i,506.000000, 180.000000, ""); //ERROR
    TextDrawBackgroundColor(StatGeld[i], 255);
    TextDrawFont(StatGeld[i], 2);
    TextDrawLetterSize(StatGeld[i], 0.270000, 1.000000);
    TextDrawColor(StatGeld[i], -10066177);
    TextDrawSetOutline(StatGeld[i], 0);
    TextDrawSetProportional(StatGeld[i], 1);
    TextDrawSetShadow(StatGeld[i], 1);
    TextDrawUseBox(StatGeld[i], 1);
    TextDrawBoxColor(StatGeld[i], 255);
    TextDrawTextSize(StatGeld[i], 607.000000, 0.000000);

    StatKills[i] = CreatePlayerTextDraw(i,506.000000, 190.000000, ""); //ERROR
    TextDrawBackgroundColor(StatKills[i], 255);
    TextDrawFont(StatKills[i], 2);
    TextDrawLetterSize(StatKills[i], 0.260000, 1.000000);
    TextDrawColor(StatKills[i], -10066177);
    TextDrawSetOutline(StatKills[i], 0);
    TextDrawSetProportional(StatKills[i], 1);
    TextDrawSetShadow(StatKills[i], 1);
    TextDrawUseBox(StatKills[i], 1);
    TextDrawBoxColor(StatKills[i], 255);
    TextDrawTextSize(StatKills[i], 607.000000, 0.000000);

    Spoiler anzeigen
    StatTode[i] = CreatePlayerTextDraw(i,506.000000, 200.000000, ""); //ERROR
    TextDrawBackgroundColor(StatTode[i], 255);
    TextDrawFont(StatTode[i], 2);
    TextDrawLetterSize(StatTode[i], 0.270000, 1.000000);
    TextDrawColor(StatTode[i], -10066177);
    TextDrawSetOutline(StatTode[i], 0);
    TextDrawSetProportional(StatTode[i], 1);
    TextDrawSetShadow(StatTode[i], 1);
    TextDrawUseBox(StatTode[i], 1);
    TextDrawBoxColor(StatTode[i], 255);
    TextDrawTextSize(StatTode[i], 607.000000, 0.000000);

    StatName[i] = CreatePlayerTextDraw(i,508.000000, 168.000000, ""); //ERROR
    TextDrawBackgroundColor(StatName[i], 255);
    TextDrawFont(StatName[i], 2);
    TextDrawLetterSize(StatName[i], 0.200000, 1.000000);
    TextDrawColor(StatName[i], -993737473);
    TextDrawSetOutline(StatName[i], 0);
    TextDrawSetProportional(StatName[i], 1);
    TextDrawSetShadow(StatName[i], 1);

    StatStats[i] = CreatePlayerTextDraw(i,502.000000, 158.000000, "[ ] Stats"); //ERROR
    TextDrawBackgroundColor(StatStats[i], 255);
    TextDrawFont(StatStats[i], 0);
    TextDrawLetterSize(StatStats[i], 0.500000, 1.000000);
    TextDrawColor(StatStats[i], -1);
    TextDrawSetOutline(StatStats[i], 0);
    TextDrawSetProportional(StatStats[i], 1);
    TextDrawSetShadow(StatStats[i], 1);

    StatKD[i] = CreatePlayerTextDraw(i,530.000000, 222.000000, ""); //ERROR
    TextDrawBackgroundColor(StatKD[i], 255);
    TextDrawFont(StatKD[i], 2);
    TextDrawLetterSize(StatKD[i], 0.160000, 0.799999);
    TextDrawColor(StatKD[i], -993737473);
    TextDrawSetOutline(StatKD[i], 0);
    TextDrawSetProportional(StatKD[i], 1);
    TextDrawSetShadow(StatKD[i], 1);

    StatScore[i] = CreatePlayerTextDraw(i,506.000000, 210.000000, ""); //ERROR
    TextDrawBackgroundColor(StatScore[i], 255);
    TextDrawFont(StatScore[i], 2);
    TextDrawLetterSize(StatScore[i], 0.230000, 1.100000);
    TextDrawColor(StatScore[i], -10066177);
    TextDrawSetOutline(StatScore[i], 0);
    TextDrawSetProportional(StatScore[i], 1);
    TextDrawSetShadow(StatScore[i], 1);
    TextDrawUseBox(StatScore[i], 1);
    TextDrawBoxColor(StatScore[i], 255);
    TextDrawTextSize(StatScore[i], 607.000000, 0.000000);
    }

  • Für mich sieht alles richtig aus also normaler weisse müssten keine errors kommen zeig mal denn befehl :)

    /stats

    Spoiler anzeigen
    ocmd:stats(playerid,params[])
    {
    if(Statistik[playerid] == false)
    {
    TextDrawShowForPlayer(playerid, StatStats[playerid]);
    TextDrawShowForPlayer(playerid, StatName[playerid]);
    TextDrawShowForPlayer(playerid, StatGeld[playerid]);
    TextDrawShowForPlayer(playerid, StatKills[playerid]);
    TextDrawShowForPlayer(playerid, StatTode[playerid]);
    TextDrawShowForPlayer(playerid, StatKD[playerid]);
    TextDrawShowForPlayer(playerid, StatScore[playerid]);
    Statistik[playerid] = true;
    return 1;
    }
    if(Statistik[playerid] == true)
    {
    TextDrawHideForPlayer(playerid, StatStats[playerid]);
    TextDrawHideForPlayer(playerid, StatName[playerid]);
    TextDrawHideForPlayer(playerid, StatGeld[playerid]);
    TextDrawHideForPlayer(playerid, StatKills[playerid]);
    TextDrawHideForPlayer(playerid, StatTode[playerid]);
    TextDrawHideForPlayer(playerid, StatKD[playerid]);
    TextDrawHideForPlayer(playerid, StatScore[playerid]);
    Statistik[playerid] = false;
    return 1;
    }
    return 1;
    }


  • Was ist denn mit dir los?
    Schläfst du noch?


    Es gibt da überhaupt keine Probleme.
    Von dem was du da schreibst, stimmt absolut nichts.


    @TE
    Dein Fehler sind die beiden returns in der aktuallisierungs Schleife.
    Entferne sie einfach und dein Problem sollte gelöst sein ;)

    "Bevor ich mir Informationen aus der "Bild" hole,
    werde ich anfangen, Wahlergebnisse danach vorauszusagen,
    neben welchen Busch unsere Katze gepinkelt hat."

    Margarete Stokowski

  • Also soll ich alles so lassen wie im ersten post, bloß die 2 returns weglassen?