String wird nicht richtig ausgelesen?

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 Leute,


    wenn ich diesen Befehl nutze:


    ocmd:makeleader(playerid,params[])
    {
    new pID, fID;
    new fname[50];
    switch(fID)
    {
    case 0:{fname = "Zivi";}
    case 1:{fname = "LSPD";}
    case 2:{fname = "BND";}
    case 3:{fname = "Assasins";}
    case 4:{fname = "SAA";}
    case 5:{fname = "Regierung";}
    case 6:{fname = "LSMD";}
    case 7:{fname = "OAmt";}
    case 8:{fname = "LEER";}
    case 9:{fname = "SAM AG";}
    case 10:{fname = "Grove St.";}
    case 11:{fname = "Ballas";}
    case 12:{fname = "Al Quaida";}
    case 13:{fname = "LCN";}
    }
    if(!isPlayerAnAdmin(playerid,4))return SCM(playerid, COLOR_FADE3,"Du darfst diesen Befehl nicht nutzen!");
    if(sscanf(params,"ui",pID,fID))return SCM(playerid, COLOR_FADE3,"/makeleader [playerid] [fraktionsid]");
    SendClientMessagef(playerid, WHITE, "Du gibst %s Leaderrechte für: %s",SpielerName(pID),fname);
    SendClientMessagef(pID, ROT, "AdmMsg: %s gab dir Leaderrechte für: %s",SpielerName(playerid),fname);
    pInfo[pID][pFraktion] = fID;
    pInfo[pID][pLeader] = fID;
    if(fID == 0){pInfo[pID][pRank] = fID;}
    else{pInfo[pID][pRank] = 6;}
    medicduty[pID] = 0;
    armyduty[pID] = 0;
    lsduty[pID] = 0;
    oamtduty[pID] = 0;
    bndduty[pID] = 0;
    SetPlayerColor(playerid,WHITE);
    CHEAT_ResetPlayerWeapons(pID);
    s_SetPlayerSkinChange(pID,2);
    SavePlayer(pID,0);
    return 1;
    }


    Kommt, egal welche Fraktion (Nummer) ich auswähle, immer der Text: ,,Du gibst ... Leaderrechte für:Zivi""


    Wie kann ich es nun machen, dass dort auch der Fraktionsname steht? :)

  • dankeschön, und kannst du mir verraten, weswegen bei diesem Befehl:


    ocmd:leader(playerid,params[])
    {
    SendClientMessage(playerid, 0xCDB221FF, "**Fraktions - Leader Online**");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    new string[200];
    if(IsPlayerConnected(i))
    {
    if(pInfo[i][pFraktion] == 1)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *LSPD-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 2)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *BND-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 3)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Assasins-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 4)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *SAA-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 5)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Regierung-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 6)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *LSMD-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 7)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Ordnungsamt-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }

    if(pInfo[i][pFraktion] == 8)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *LEER-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 9)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *SAM AG-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 10)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Groove-Str.-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 11)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Ballas-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 12)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[32];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Al Quaida-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    }
    }
    return 1;
    }


    Die Leader nicht angezeigt werden? ._.

  • Hier, so müsste es gehen:


    ocmd:leader(playerid,params[])
    {
    SendClientMessage(playerid, 0xCDB221FF, "**Fraktions - Leader Online**");
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    new string[200];
    if(IsPlayerConnected(i))
    {
    if(pInfo[i][pFraktion] == 1)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *LSPD-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 2)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *BND-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 3)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Assasins-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 4)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *SAA-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 5)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Regierung-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 6)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *LSMD-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 7)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Ordnungsamt-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }


    if(pInfo[i][pFraktion] == 8)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *LEER-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 9)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *SAM AG-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 10)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Groove-Str.-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 11)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Ballas-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    if(pInfo[i][pFraktion] == 12)
    {
    if(pInfo[i][pRank] == 6)
    {
    new sendername[MAX_PLAYER_NAME];
    GetPlayerName(i, sendername, sizeof(sendername));
    format(string, 40, " *Al Quaida-Leader: %s", sendername);
    SCM(playerid, COLOR_GOLD, string);
    }
    }
    }
    }
    return 1;
    }



    Das:
    new sendername[32];


    Zu:
    new sendername[MAX_PLAYER_NAME];


    Weil eine Zeichenkette ist hierbei unnötig dafür ist dein String ganz oben da.
    MAX_PLAYER_NAME zeigt dir nun den Namen an.