Problem mit Perso

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
  • Hallo Leute,
    wollte mal meinen Befehl /showperso in ein Dialog umändern, jodoch funzt es nicht ganz. Wenn man /showperso ID macht, zeigt man sich selbst den perso -.- und es sind keine Daten vorhanden.


    if(strcmp(cmd,"/showperso",true)==0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "FEHLER: /showperso [playerid]");
    return 1;
    }
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    if(PlayerInfo[playerid][pOwnPerso] == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, "**Du besitzt keinen PersonalAusweis**");
    return 1;
    }
    if (ProxDetectorS(8.0, playerid, giveplayerid))
    {
    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Um deine Stats zu betrachten Tipp /stats!"); return 1; }
    new jtext[20];
    if(PlayerInfo[giveplayerid][pJob] == 1) { jtext = "Dedektiv"; }
    else if(PlayerInfo[giveplayerid][pJob] == 2) { jtext = "Anwalt"; }
    else if(PlayerInfo[giveplayerid][pJob] == 3) { jtext = "Hure"; }
    else if(PlayerInfo[giveplayerid][pJob] == 4) { jtext = "Drogen Dealer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 5) { jtext = "Autodieb"; }
    else if(PlayerInfo[giveplayerid][pJob] == 6) { jtext = "News Reporter"; }
    else if(PlayerInfo[giveplayerid][pJob] == 7) { jtext = "KFZ Mechaniker"; }
    else if(PlayerInfo[giveplayerid][pJob] == 8) { jtext = "Bodyguard"; }
    else if(PlayerInfo[giveplayerid][pJob] == 9) { jtext = "Waffendealer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 10) { jtext = "Autodealer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 12) { jtext = "Boxer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 14) { jtext = "Busfahrer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 15) { jtext = "Zeitungs Junge"; }
    else if(PlayerInfo[giveplayerid][pJob] == 16) { jtext = "ZugFahrer"; }
    else { jtext = "None"; }
    new drank[20];
    if(PlayerInfo[giveplayerid][pDonateRank] == 1) { drank = "Bürger von SA"; }
    else if(PlayerInfo[giveplayerid][pDonateRank] >= 2) { drank = "Ehrenbürger"; }
    else if(PlayerInfo[giveplayerid][pDonateRank] >= 2) { drank = "Special User"; }
    else { drank = "Einwanderer"; }
    new name[MAX_PLAYER_NAME];
    new age = PlayerInfo[playerid][pAge];
    new crimes = PlayerInfo[playerid][pCrimes];
    new level = PlayerInfo[playerid][pLevel];
    GetPlayerName(playerid, name, sizeof(name));

    new string1[128],string2[128],string3[128],string4[128],string5[128],string6[128],mstring[1280];

    format(string, sizeof(string1),"Name: %s",name);

    format(string, sizeof(string2),"Alter: %d",age);

    format(string, sizeof(string3),"Level: %d",level);

    format(string, sizeof(string4),"Beruf: %s",jtext);

    format(string, sizeof(string5),"Status: %s",drank);

    format(string, sizeof(string6),"Verbrechen: %d",crimes);

    format(mstring, sizeof (mstring), "%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s", string1,string2,string3,string4,string5,string6);
    ShowPlayerDialog(playerid,Perso,DIALOG_STYLE_MSGBOX,"Personalausweis",mstring,"Ok","Cancel");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Spieler ist nicht in deiner Nähe !");
    return 1;
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Dieser Spieler ist Offline !");
    return 1;
    }
    }
    return 1;
    }


    Wo ist der Fehler ?


    MfG Joga

  • Versuchs mal so^^:
    if(strcmp(cmd,"/showperso",true)==0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "FEHLER: /showperso [playerid]");
    return 1;
    }
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    if(PlayerInfo[playerid][pOwnPerso] == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, "**Du besitzt keinen PersonalAusweis**");
    return 1;
    }
    if (ProxDetectorS(8.0, playerid, giveplayerid))
    {
    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Um deine Stats zu betrachten Tipp /stats!"); return 1; }
    new jtext[20];
    if(PlayerInfo[giveplayerid][pJob] == 1) { jtext = "Dedektiv"; }
    else if(PlayerInfo[giveplayerid][pJob] == 2) { jtext = "Anwalt"; }
    else if(PlayerInfo[giveplayerid][pJob] == 3) { jtext = "Hure"; }
    else if(PlayerInfo[giveplayerid][pJob] == 4) { jtext = "Drogen Dealer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 5) { jtext = "Autodieb"; }
    else if(PlayerInfo[giveplayerid][pJob] == 6) { jtext = "News Reporter"; }
    else if(PlayerInfo[giveplayerid][pJob] == 7) { jtext = "KFZ Mechaniker"; }
    else if(PlayerInfo[giveplayerid][pJob] == 8) { jtext = "Bodyguard"; }
    else if(PlayerInfo[giveplayerid][pJob] == 9) { jtext = "Waffendealer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 10) { jtext = "Autodealer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 12) { jtext = "Boxer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 14) { jtext = "Busfahrer"; }
    else if(PlayerInfo[giveplayerid][pJob] == 15) { jtext = "Zeitungs Junge"; }
    else if(PlayerInfo[giveplayerid][pJob] == 16) { jtext = "ZugFahrer"; }
    else { jtext = "None"; }
    new drank[20];
    if(PlayerInfo[giveplayerid][pDonateRank] == 1) { drank = "Bürger von SA"; }
    else if(PlayerInfo[giveplayerid][pDonateRank] >= 2) { drank = "Ehrenbürger"; }
    else if(PlayerInfo[giveplayerid][pDonateRank] >= 2) { drank = "Special User"; }
    else { drank = "Einwanderer"; }
    new name[MAX_PLAYER_NAME];
    new age = PlayerInfo[playerid][pAge];
    new crimes = PlayerInfo[playerid][pCrimes];
    new level = PlayerInfo[playerid][pLevel];
    GetPlayerName(playerid, name, sizeof(name));


    new string1[128],string2[128],string3[128],string4[128],string5[128],string6[128],mstring[1280];


    format(string, sizeof(string1),"Name: %s",name);


    format(string, sizeof(string2),"Alter: %d",age);


    format(string, sizeof(string3),"Level: %d",level);


    format(string, sizeof(string4),"Beruf: %s",jtext);


    format(string, sizeof(string5),"Status: %s",drank);


    format(string, sizeof(string6),"Verbrechen: %d",crimes);


    format(mstring, sizeof (mstring), "%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s", string1,string2,string3,string4,string5,string6);
    ShowPlayerDialog(giveplayerid,Perso,DIALOG_STYLE_MSGBOX,"Personalausweis",mstring,"Ok","Cancel");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Spieler ist nicht in deiner Nähe !");
    return 1;
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Dieser Spieler ist Offline !");
    return 1;
    }
    }
    return 1;
    }

  • änder alle giveplayerids in nur playerid um außer das bei showplayeridalog.

  • änder alle giveplayerids in nur playerid um außer das bei showplayeridalog.

    Das kann ja nicht gehen. Dann hast du ja z.b. die Zeile :
    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Um deine Stats zu betrachten Tipp /stats!"); return 1; }

    in diese geändert:
    if(playerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Um deine Stats zu betrachten Tipp /stats!"); return 1; }

    Das gibt ja kein sinn.

  • if(strcmp(cmd,"/showperso",true)==0)
    {
    if(IsPlayerConnected(playerid))
    {
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_WHITE, "FEHLER: /showperso [playerid]");
    return 1;
    }
    giveplayerid = ReturnUser(tmp);
    if(IsPlayerConnected(giveplayerid))
    {
    if(giveplayerid != INVALID_PLAYER_ID)
    {
    if(PlayerInfo[playerid][pOwnPerso] == 0)
    {
    SendClientMessage(playerid, COLOR_GREY, "**Du besitzt keinen PersonalAusweis**");
    return 1;
    }
    if (ProxDetectorS(8.0, playerid, giveplayerid))
    {
    if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "Um deine Stats zu betrachten Tipp /stats!"); return 1; }
    new jtext[20];
    if(PlayerInfo[playerid][pJob] == 1) { jtext = "Dedektiv"; }
    else if(PlayerInfo[playerid][pJob] == 2) { jtext = "Anwalt"; }
    else if(PlayerInfo[playerid][pJob] == 3) { jtext = "Hure"; }
    else if(PlayerInfo[playerid][pJob] == 4) { jtext = "Drogen Dealer"; }
    else if(PlayerInfo[playerid][pJob] == 5) { jtext = "Autodieb"; }
    else if(PlayerInfo[playerid][pJob] == 6) { jtext = "News Reporter"; }
    else if(PlayerInfo[playerid][pJob] == 7) { jtext = "KFZ Mechaniker"; }
    else if(PlayerInfo[playerid][pJob] == 8) { jtext = "Bodyguard"; }
    else if(PlayerInfo[playerid][pJob] == 9) { jtext = "Waffendealer"; }
    else if(PlayerInfo[playerid][pJob] == 10) { jtext = "Autodealer"; }
    else if(PlayerInfo[playerid][pJob] == 12) { jtext = "Boxer"; }
    else if(PlayerInfo[playerid][pJob] == 14) { jtext = "Busfahrer"; }
    else if(PlayerInfo[playerid][pJob] == 15) { jtext = "Zeitungs Junge"; }
    else if(PlayerInfo[playerid][pJob] == 16) { jtext = "ZugFahrer"; }
    else { jtext = "None"; }
    new drank[20];
    if(PlayerInfo[playerid][pDonateRank] == 1) { drank = "Bürger von SA"; }
    else if(PlayerInfo[playerid][pDonateRank] >= 2) { drank = "Ehrenbürger"; }
    else if(PlayerInfo[playerid][pDonateRank] >= 2) { drank = "Special User"; }
    else { drank = "Einwanderer"; }
    new name[MAX_PLAYER_NAME];
    new age = PlayerInfo[playerid][pAge];
    new crimes = PlayerInfo[playerid][pCrimes];
    new level = PlayerInfo[playerid][pLevel];
    GetPlayerName(playerid, name, sizeof(name));


    new string1[128],string2[128],string3[128],string4[128],string5[128],string6[128],mstring[1280];


    format(string, sizeof(string1),"Name: %s",name);


    format(string, sizeof(string2),"Alter: %d",age);


    format(string, sizeof(string3),"Level: %d",level);


    format(string, sizeof(string4),"Beruf: %s",jtext);


    format(string, sizeof(string5),"Status: %s",drank);


    format(string, sizeof(string6),"Verbrechen: %d",crimes);


    format(mstring, sizeof (mstring), "%s\n\n%s\n\n%s\n\n%s\n\n%s\n\n%s", string1,string2,string3,string4,string5,string6);
    ShowPlayerDialog(giveplayerid,Perso,DIALOG_STYLE_MSGBOX,"Personalausweis",mstring,"Ok","Cancel");
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Spieler ist nicht in deiner Nähe !");
    return 1;
    }
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Dieser Spieler ist Offline !");
    return 1;
    }
    }
    return 1;
    }



    so müsste es gehn

  • format(string, sizeof(string1),"Name: %s",name);


    format([color=#ff6600]string[/color], sizeof(string2),"Alter: %d",age);


    format([color=#ff6600]string[/color], sizeof(string3),"Level: %d",level);


    format([color=#ff6600]string[/color], sizeof(string4),"Beruf: %s",jtext);


    format([color=#ff6600]string[/color], sizeof(string5),"Status: %s",drank);


    format([color=#ff6600]string[/color], sizeof(string6),"Verbrechen: %d",crimes);


    Fällt dir da was auf?


    Machs so:


    format([color=#ff6600]string1[/color], sizeof(string1),"Name: %s",name);


    format([color=#ff6600]string2[/color], sizeof(string2),"Alter: %d",age);


    format([color=#ff6600]string3[/color], sizeof(string3),"Level: %d",level);


    format([color=#ff6600]string4[/color], sizeof(string4),"Beruf: %s",jtext);


    format([color=#ff6600]string5[/color], sizeof(string5),"Status: %s",drank);


    format([color=#ff6600]string6[/color], sizeof(string6),"Verbrechen: %d",crimes);