Textdraw Problm(Update)

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
  • Moinsen,


    folgnder Code:


    public OnPlayerDeath(playerid, killerid, reason)
    {
    new oldkills=mysql_GetInt("accounts","kills","name",SpielerName(killerid));
    mysql_SetInt("accounts","kills",oldkills+1,"name",SpielerName(killerid));

    new olddeaths=mysql_GetInt("accounts","deaths","name",SpielerName(playerid));
    mysql_SetInt("accounts","deaths",olddeaths+1,"name",SpielerName(playerid));

    new str1[1000];
    format(str1,sizeof(str1),"Kills: %i - Deaths: %i",mysql_GetInt("accounts","kills","name",SpielerName(killerid)),mysql_GetInt("accounts","deaths","name",SpielerName(killerid)));
    PlayerTextDrawSetString(killerid,stats[killerid],str1);

    new str2[1000];

    format(str2,sizeof(str2),"Kills: %i - Deaths: %i",mysql_GetInt("accounts","kills","name",SpielerName(playerid)),mysql_GetInt("accounts","deaths","name",SpielerName(playerid)));
    PlayerTextDrawSetString(playerid,stats[playerid],str2);
    return 1;
    }


    Beim ersten Kill und Death, aktualisiert es sich, doch beim zweiten überlappen sich alter und neuer Textdraw.


    Ich versuche nun seit knapp 3 Stunden den Fehler zu lokalisieren, doch ich finde ihn einfach nicht.


    Was mache ich falsch?


    Grüße

  • also muss ich den TextDraw beim Death löschen und wieder neu erstellen?


    Und jo ich setz den mal runter xD


    Ich hab's jetzt so gem.:
    stock kd(pID){
    new str[64];
    format(str,sizeof(str),"Kills: %i - Deaths: %i",mysql_GetInt("accounts","kills","name",SpielerName(pID)),mysql_GetInt("accounts","deaths","name",SpielerName(pID)));
    stats[pID]=CreatePlayerTextDraw(pID,390, 430,str);
    PlayerTextDrawUseBox(pID,stats[pID] , 1);
    PlayerTextDrawFont(pID,stats[pID] , 2);
    PlayerTextDrawBackgroundColor(pID,stats[pID] ,0x000021FF);
    PlayerTextDrawBoxColor(pID,stats[pID] ,0x000021FF);
    PlayerTextDrawShow(pID,stats[pID]);
    }


    und dann bei onplayerdeath:
    PlayerTextDrawDestroy(playerid,stats[playerid]);
    PlayerTextDrawDestroy(killerid,stats[killerid]);

    kd(playerid);
    kd(killerid);

  • Teste mal das


    public OnPlayerDeath(playerid, killerid, reason)
    {
    new oldkills=mysql_GetInt("accounts","kills","name",SpielerName(killerid));
    mysql_SetInt("accounts","kills",oldkills+1,"name",SpielerName(killerid));


    new olddeaths=mysql_GetInt("accounts","deaths","name",SpielerName(playerid));
    mysql_SetInt("accounts","deaths",olddeaths+1,"name",SpielerName(playerid));


    new str[64];
    format(str,64,"Kills: %i - Deaths: %i",mysql_GetInt("accounts","kills","name",SpielerName(killerid)),mysql_GetInt("accounts","deaths","name",SpielerName(killerid)));
    PlayerTextDrawSetString(killerid,stats[killerid],str);
    TextDrawHideForPlayer(killerid,stats[killerid]);
    TextDrawShowForPlayer(killerid,stats[killerid]);


    format(str,64,"Kills: %i - Deaths: %i",mysql_GetInt("accounts","kills","name",SpielerName(playerid)),mysql_GetInt("accounts","deaths","name",SpielerName(playerid)));
    PlayerTextDrawSetString(playerid,stats[playerid],str);
    TextDrawHideForPlayer(playerid,stats[playerid]);
    TextDrawShowForPlayer(playerid,stats[playerid]);
    return 1;
    }


    wenn er nicht alles anzeigt einfach den string etwas höher setzen abernicht auf 1000

    All in all it's just another brick in the wall