Chat Bugg :(

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
  • habe ein Porblem im GF naja ein Fehler hier ist es...



    if(strcmp(cmd, "/departments", true) == 0 || strcmp(cmd, "/d", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))
    {
    idx++;
    }
    new offset = idx;
    new result[64];
    while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
    {
    result[idx - offset] = cmdtext[idx];
    idx++;
    }
    result[idx - offset] = EOS;
    result[0] = toupper(result[0]);
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "USAGE: (/d)epartments [department chat]");
    return 1;
    }
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Chief %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Cadet %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result);
    }
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Director %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Assistant Director in Charge %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Special Agent in Charge %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Special Agent %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Special Agent Trainee %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Professional Staff %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Intern %s: %s, over. **", sendername, result);
    }
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** General %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Lieutenant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Major %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Private %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Private %s: %s, over. **", sendername, result);
    }
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 16 || PlayerInfo[playerid][pLeader] == 16)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Commander %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Lietenant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Detective %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result);
    }
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 17 || PlayerInfo[playerid][pLeader] == 17)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Commander %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Captain %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Lietenant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Sergeant %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Detective %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Officer %s: %s, over. **", sendername, result);
    }
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else if(PlayerInfo[playerid][pMember] == 19 || PlayerInfo[playerid][pLeader] == 19)
    {
    if(PlayerInfo[playerid][pRank] == 6) { format(string, sizeof(string), "** Hauptbrandmeister %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 5) { format(string, sizeof(string), "** Dispatcher %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 4) { format(string, sizeof(string), "** Brandmeister %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 3) { format(string, sizeof(string), "** Feuerwehrmann %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 2) { format(string, sizeof(string), "** Feuerwehranwärter %s: %s, over. **", sendername, result); }
    else if(PlayerInfo[playerid][pRank] == 1) { format(string, sizeof(string), "** Praktikant %s: %s, over. **", sendername, result); }
    else
    {
    format(string, sizeof(string), "** Praktikant %s: %s, over. **", sendername, result);
    }
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else if(gTeam[playerid] == 1||PlayerInfo[playerid][pMember]==4||PlayerInfo[playerid][pLeader]==4)
    {
    format(string, sizeof(string), "** Paramedic %s: %s, over. **", sendername, result);
    SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);
    printf("%s", string);
    return 1;
    }
    else
    {
    SendClientMessage(playerid, COLOR_GRAD2, " You are not part of a Team !");
    return 1;
    }
    }
    return 1;
    }


    und hier mein problem wenn ich was schreibe...


    Chief ExtremeFighter: Test
    Chief ExtremeFighter: Test
    Chief ExtremeFighter: Test
    Chief ExtremeFighter: Test
    Chief ExtremeFighter: Test


    Es wiederholt sich immer..

    Einmal editiert, zuletzt von [Markus] ()

  • Dein Fehler liegt denke ich mal hierdran: SendTeamMessage(1, COLOR_ALLDEPT, string);
    SendTeamMessage(2, COLOR_ALLDEPT, string);
    SendTeamMessage(3, COLOR_ALLDEPT, string);
    SendTeamMessage(16, COLOR_ALLDEPT, string);
    SendTeamMessage(17, COLOR_ALLDEPT, string);


    Such mal im Script nach public SendTeamMessage und guck dir die Funktion mal an :)

  • und jetzt?



    public SendTeamMessage(team, color, string[])
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerInfo[i][pMember] == 1 || PlayerInfo[i][pLeader] == 1 || PlayerInfo[i][pMember] == 2 || PlayerInfo[i][pLeader] == 2 || PlayerInfo[i][pMember] == 3 || PlayerInfo[i][pLeader] == 3 || PlayerInfo[i][pMember] == 4 || PlayerInfo[i][pLeader] == 4)
    {
    SendClientMessage(i, color, string);
    }
    }
    }
    }

  • Da sieht man ja schon das "team" nicht benutzt wird.
    Desweiteren sender er wenn du einmal SendTeamMessage ausführst die Nachricht an Fraktion 1, Fraktion 2, Fraktion 3 und Fraktion 4..
    Wenn du nun SendTeamMessage(1, farbe, string); machst und dann SendTeamMessage(2, farbe, string); usw, sendet er egal welche Zahl am anfang steht die nachricht nur an die 4 fraktionen.


    Deshalb würde ich dir vorschlagen die funktion so umzuändern.


    public SendTeamMessage(team, color, string[])
    {
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
    if(IsPlayerConnected(i))
    {
    if(PlayerInfo[i][pMember] == team || PlayerInfo[i][pLeader] == team)
    {
    SendClientMessage(i, color, string);
    }
    }
    }
    }


    LG
    Zunno