Textdraw nur einzelne für Spieler[ Problem]

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
  • Guten Abend


    Ich plage mich nun seit 2 Tagen mit einem Problem herrum: Textdraws, die nur für den einzelnen Spieler Angezeigt werden sollen (Nur wenn im Dm),
    und für jeden Spieler die eigenen Statistiken darstellen


    forward Textdrawkilldm(playerid);
    forward ResetTextdraw(playerid);
    forward ResetDmStats(playerid);
    new dm1[MAX_PLAYERS]=0,dm2[MAX_PLAYERS]=0,dm3[MAX_PLAYERS]=0,dm4[MAX_PLAYERS]=0,dm5[MAX_PLAYERS]=0,dm6[MAX_PLAYERS]=0,dm7[MAX_PLAYERS]=0,dm8[MAX_PLAYERS]=0,dm9[MAX_PLAYERS]=0,dm10[MAX_PLAYERS]=0,snipdm[MAX_PLAYERS]=0;
    //Dm1 Stats
    new dm1kills[MAX_PLAYERS],dm1death[MAX_PLAYERS],Float: dm1ratio[MAX_PLAYERS];
    new dm2kills[MAX_PLAYERS],dm2death[MAX_PLAYERS],Float: dm2ratio[MAX_PLAYERS];
    new dm3kills[MAX_PLAYERS],dm3death[MAX_PLAYERS],Float: dm3ratio[MAX_PLAYERS];
    new dm4kills[MAX_PLAYERS],dm4death[MAX_PLAYERS],Float: dm4ratio[MAX_PLAYERS];
    new dm5kills[MAX_PLAYERS],dm5death[MAX_PLAYERS],Float: dm5ratio[MAX_PLAYERS];
    new dm6kills[MAX_PLAYERS],dm6death[MAX_PLAYERS],Float: dm6ratio[MAX_PLAYERS];
    new dm7kills[MAX_PLAYERS],dm7death[MAX_PLAYERS],Float: dm7ratio[MAX_PLAYERS];
    new dm8kills[MAX_PLAYERS],dm8death[MAX_PLAYERS],Float: dm8ratio[MAX_PLAYERS];
    new dm9kills[MAX_PLAYERS],dm9death[MAX_PLAYERS],Float: dm9ratio[MAX_PLAYERS];
    new dm10kills[MAX_PLAYERS],dm10death[MAX_PLAYERS],Float: dm10ratio[MAX_PLAYERS];
    new snipkills[MAX_PLAYERS],snipdeath[MAX_PLAYERS],Float: snipratio[MAX_PLAYERS];
    new Text:Textdraw0[MAX_PLAYERS];
    new Text:Textdraw1[MAX_PLAYERS];
    new Text:Textdraw2[MAX_PLAYERS];
    new Text:Textdraw3[MAX_PLAYERS];
    new Text:Textdraw4[MAX_PLAYERS];
    SetTimer("DmStats",3000,1);


    public Textdrawkilldm(playerid)
    {
    ResetDmStats(playerid);
    Textdraw0 [playerid]= TextDrawCreate(507.000000, 346.000000, "Dm X Stats");
    TextDrawBackgroundColor(Textdraw0[playerid], 255);
    TextDrawFont(Textdraw0[playerid], 1);
    TextDrawLetterSize(Textdraw0[playerid], 0.500000, 1.500000);
    TextDrawColor(Textdraw0[playerid], 255);
    TextDrawSetOutline(Textdraw0[playerid], 0);
    TextDrawSetProportional(Textdraw0[playerid], 0);
    TextDrawSetShadow(Textdraw0[playerid], 1);
    TextDrawUseBox(Textdraw0[playerid], 1);
    TextDrawBoxColor(Textdraw0[playerid], -1);
    TextDrawTextSize(Textdraw0[playerid], 639.000000, -7.000000);


    Textdraw2[playerid]= TextDrawCreate(507.000000, 365.000000, "-------------");
    TextDrawBackgroundColor(Textdraw2[playerid], 255);
    TextDrawFont(Textdraw2[playerid], 1);
    TextDrawLetterSize(Textdraw2[playerid], 0.500000, 1.500000);
    TextDrawColor(Textdraw2[playerid], -1);
    TextDrawSetOutline(Textdraw2[playerid], 0);
    TextDrawSetProportional(Textdraw2[playerid], 0);
    TextDrawSetShadow(Textdraw2[playerid], 1);
    TextDrawUseBox(Textdraw2[playerid], 1);
    TextDrawBoxColor(Textdraw2[playerid], 255);
    TextDrawTextSize(Textdraw2[playerid], 656.000000, 0.000000);


    Textdraw1[playerid] = TextDrawCreate(507.000000, 378.000000, "Kills: 0");
    TextDrawBackgroundColor(Textdraw1[playerid], 255);
    TextDrawFont(Textdraw1[playerid], 1);
    TextDrawLetterSize(Textdraw1[playerid], 0.500000, 1.500000);
    TextDrawColor(Textdraw1[playerid], -1);
    TextDrawSetOutline(Textdraw1[playerid], 0);
    TextDrawSetProportional(Textdraw1[playerid], 1);
    TextDrawSetShadow(Textdraw1[playerid], 1);
    TextDrawUseBox(Textdraw1[playerid], 1);
    TextDrawBoxColor(Textdraw1[playerid], 255);
    TextDrawTextSize(Textdraw1[playerid], 656.000000, 0.000000);


    Textdraw3[playerid] = TextDrawCreate(507.000000, 393.000000, "Deaths: 0");
    TextDrawBackgroundColor(Textdraw3[playerid], 255);
    TextDrawFont(Textdraw3[playerid], 1);
    TextDrawLetterSize(Textdraw3[playerid], 0.500000, 1.500000);
    TextDrawColor(Textdraw3[playerid], -1);
    TextDrawSetOutline(Textdraw3[playerid], 0);
    TextDrawSetProportional(Textdraw3[playerid], 1);
    TextDrawSetShadow(Textdraw3[playerid], 1);
    TextDrawUseBox(Textdraw3[playerid], 1);
    TextDrawBoxColor(Textdraw3[playerid], 255);
    TextDrawTextSize(Textdraw3[playerid], 656.000000, 0.000000);


    Textdraw4[playerid] = TextDrawCreate(507.000000, 408.000000, "Ratio: 0.00");
    TextDrawBackgroundColor(Textdraw4[playerid], 255);
    TextDrawFont(Textdraw4[playerid], 1);
    TextDrawLetterSize(Textdraw4[playerid], 0.500000, 1.500000);
    TextDrawColor(Textdraw4[playerid], -1);
    TextDrawSetOutline(Textdraw4[playerid], 0);
    TextDrawSetProportional(Textdraw4[playerid], 1);
    TextDrawSetShadow(Textdraw4[playerid], 1);
    TextDrawUseBox(Textdraw4[playerid], 1);
    TextDrawBoxColor(Textdraw4[playerid], 255);
    TextDrawTextSize(Textdraw4[playerid], 656.000000, 0.000000);



    }
    public pdm1(playerid)
    {
    //Anker
    //Join Nachricht
    if(dm1 [playerid] == 0){
    new pname[MAX_PLAYERS],string[268];
    GetPlayerName(playerid,pname,sizeof pname);
    format(string, sizeof(string), " %s hat das Dm1 betreten", pname);
    SendClientMessageToAll(FARBE_ORANGE,string);
    ResetTextdraw(playerid);
    Textdrawkilldm(playerid);
    new strdmb[64];
    format(strdmb, 64, "Dm 1 Stats");
    TextDrawSetString(Textdraw0[playerid],strdmb);
    dm1[playerid]=1;
    }
    if(dm1[playerid] == 1){
    //Textdraw Stats Veränderungen
    new strdmk[64],strdmd[64],strdmr[64];
    format(strdmk, 64, "Kills: %d",dm1kills[playerid]);
    TextDrawSetString(Textdraw1[playerid],strdmk);
    format(strdmd, 64, "Deaths: %d",dm1death[playerid]);
    TextDrawSetString(Textdraw3[playerid],strdmd);
    if(dm1death[playerid] == 0)dm1ratio[playerid] = float(dm1kills[playerid]);
    else dm1ratio[playerid] = floatdiv(dm1kills[playerid], dm1death[playerid]);
    //format(dms,sizeof(dms),"~g~Kills: ~r~%d~n~~y~Deaths: ~r~%d~n~~p~Ratio: ~r~%.2f",kills[playerid],deaths[playerid],ratio[playerid]);
    //TextDrawSetString(dmstats[playerid],dms);
    format(strdmr, 64, "Ratio: %.2f",dm1ratio[playerid]);
    TextDrawSetString(Textdraw4[playerid],strdmr);
    }
    TextDrawShowForPlayer(playerid,Textdraw0[playerid]);
    TextDrawShowForPlayer(playerid,Textdraw1[playerid]);
    TextDrawShowForPlayer(playerid,Textdraw2[playerid]);
    TextDrawShowForPlayer(playerid,Textdraw3[playerid]);
    TextDrawShowForPlayer(playerid,Textdraw4[playerid]);
    }
    public pdm2(playerid)
    {
    if(dm2 [playerid] == 0){
    new pname[MAX_PLAYERS],string[268];
    GetPlayerName(playerid,pname,sizeof pname);
    format(string, sizeof(string), " %s hat das Dm2 betreten", pname);
    SendClientMessageToAll(FARBE_ORANGE,string);
    ResetTextdraw(playerid);
    Textdrawkilldm(playerid);
    new strdmb[64];
    format(strdmb, 64, "Dm 2 Stats");
    TextDrawSetString(Textdraw0[playerid],strdmb);
    dm2[playerid]=1;
    }
    if(dm2[playerid] == 1){
    new strdmk[64],strdmd[64],strdmr[64];
    format(strdmk, 64, "Kills: %d",dm2kills[playerid]);
    TextDrawSetString(Textdraw1[playerid],strdmk);
    format(strdmd, 64, "Deaths: %d",dm2death[playerid]);
    TextDrawSetString(Textdraw3[playerid],strdmd);
    if(dm2death[playerid] == 0)dm2ratio[playerid] = float(dm2kills[playerid]);
    else dm2ratio[playerid] = floatdiv(dm2kills[playerid], dm2death[playerid]);
    format(strdmr, 64, "Ratio: %.2f",dm2ratio[playerid]);
    TextDrawSetString(Textdraw4[playerid],strdmr);
    }
    public ResetDmStats(playerid)
    {
    dm1kills[playerid] = 0;
    dm1death[playerid] = 0;
    dm1ratio[playerid] = 0;
    dm2kills[playerid] = 0;
    dm2death[playerid] = 0;
    dm2ratio[playerid] = 0;
    dm3kills[playerid] = 0;
    dm3death[playerid] = 0;
    dm3ratio[playerid] = 0;
    dm4kills[playerid] = 0;
    dm4death[playerid] = 0;
    dm4ratio[playerid] = 0;
    dm5kills[playerid] = 0;
    dm5death[playerid] = 0;
    dm5ratio[playerid] = 0;
    dm6kills[playerid] = 0;
    dm6death[playerid] = 0;
    dm6ratio[playerid] = 0;
    dm7kills[playerid] = 0;
    dm7death[playerid] = 0;
    dm7ratio[playerid] = 0;
    dm8kills[playerid] = 0;
    dm8death[playerid] = 0;
    dm8ratio[playerid] = 0;
    dm9kills[playerid] = 0;
    dm9death[playerid] = 0;
    dm9ratio[playerid] = 0;
    dm10kills[playerid] = 0;
    dm10death[playerid] = 0;
    dm10ratio[playerid] = 0;
    snipkills[playerid] = 0;
    snipdeath[playerid] = 0;
    snipratio[playerid] = 0;
    }
    public ResetTextdraw(playerid)
    {
    TextDrawDestroy(Textdraw0[playerid]);
    TextDrawDestroy(Textdraw1[playerid]);
    TextDrawDestroy(Textdraw2[playerid]);
    TextDrawDestroy(Textdraw3[playerid]);
    TextDrawDestroy(Textdraw4[playerid]);
    }
    public DmStats(playerid){
    for (new i = 0; i < MAX_PLAYERS; i++){


    if(dm1[playerid] == 1 || dm2[playerid] == 1 || dm3[playerid] == 1 || dm4[playerid] == 1 || dm5[playerid] == 1 || dm6[playerid] == 1 || dm7[playerid] == 1 || dm8[playerid] == 1 || dm9[playerid] == 1 || snipdm[playerid] ==1){
    TextDrawShowForPlayer(i,Textdraw0[i]);
    TextDrawShowForPlayer(i,Textdraw1[i]);
    TextDrawShowForPlayer(i,Textdraw2[i]);
    TextDrawShowForPlayer(i,Textdraw3[i]);
    TextDrawShowForPlayer(i,Textdraw4[i]);
    }
    }
    }


    Das ist der Code der für die Textdraws zuständig ist,( Es könnten klammern etc fehlen)
    Der Code lässt sich ohne Probleme kompilieren und ist bis auf den Obersten Textraw(Der den Namen des Dm's anzeigt) voll Funktions tüchtig.


    Abgesehen davon, dass dies kein "sauberer" Code ist (Ich hätte die dm's auch in einer Variable speichern können etc.(Code kürzer))
    Aber Wenn ich mich nun aus einem Dm zu einem anderen porte wird einem anderen Spieler der noch im alten Dm ist die neue "Überschrift" in den Stats
    angezeigt, obwohl er noch im alten Dm ist.


    Bitte helft mir


    Mit freundlichen Grüßen
    Holdont