If abfrage läuft schief

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 wenn ich ingame /ggov mache und ich frag ab oder der Leader ist wenn nein fehler meldung aber ich bin der Leader und bei mir kommt die Fehlermeldung hier


    if(!PlayerInfo[playerid][pLeader] == 5 ||PlayerInfo[playerid][pLeader] == 13 ||PlayerInfo[playerid][pLeader] == 14 ||PlayerInfo[playerid][pLeader] == 19 ||PlayerInfo[playerid][pLeader] == 16 ||PlayerInfo[playerid][pLeader] ==17 ||PlayerInfo[playerid][pLeader] == 18 ||PlayerInfo[playerid][pLeader] == 23 ||PlayerInfo[playerid][pLeader] == 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");

  • if(PlayerInfo[playerid][pLeader] != 5 ||PlayerInfo[playerid][pLeader] != 13 ||PlayerInfo[playerid][pLeader] != 14 ||PlayerInfo[playerid][pLeader] != 19 ||PlayerInfo[playerid][pLeader] != 16 ||PlayerInfo[playerid][pLeader] != 17 ||PlayerInfo[playerid][pLeader] != 18 ||PlayerInfo[playerid][pLeader] != 23 ||PlayerInfo[playerid][pLeader] != 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");


    Du hast es jetzt so - oder was?

    "Bevor ich mir Informationen aus der "Bild" hole,
    werde ich anfangen, Wahlergebnisse danach vorauszusagen,
    neben welchen Busch unsere Katze gepinkelt hat."

    Margarete Stokowski

  • if(PlayerInfo[playerid][pLeader] != 5 && PlayerInfo[playerid][pLeader] != 13 && PlayerInfo[playerid][pLeader] != 14 && PlayerInfo[playerid][pLeader] != 19 && PlayerInfo[playerid][pLeader] != 16 && PlayerInfo[playerid][pLeader] != 17 && PlayerInfo[playerid][pLeader] != 18 && PlayerInfo[playerid][pLeader] != 23 && layerInfo[playerid][pLeader] != 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");
    Wenn du es mit ODER || machst, musst du == machen (aber auch dann das ! am Anfang weglassen). Bei != brauchst du UND &&.
    Ansonsten wird die Nachricht immer wiedergegeben, wenn der Spieler nicht gleichzeitig Leader aller dieser ID's ist.

    Ich bin
    .. seit etwa 2007 in der Webentwicklung tätig, seit 2013 professionell
    .. Erfahrener Entwickler in PHP, Swift, Javascript, Typescript und Ruby. Zusätzlich habe ich Erfahrung in Python, Java, C#, C++, Prolog und einigen esoterischen Programmiersprachen
    .. Luftfahrtenthusiast und Segelflieger

  • //__________________________________[GangGov]______________________________________________
    if(strcmp(cmd, "/ganggov", true) == 0 || strcmp(cmd, "/ggov", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pLeader] != 5 && PlayerInfo[playerid][pLeader] != 13 && PlayerInfo[playerid][pLeader] != 14 && PlayerInfo[playerid][pLeader] != 19 && PlayerInfo[playerid][pLeader] != 16 && PlayerInfo[playerid][pLeader] != 17 && PlayerInfo[playerid][pLeader] != 18 && PlayerInfo[playerid][pLeader] != 23 && PlayerInfo[playerid][pLeader] != 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");



    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;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /ggov (Durchsage) [Nachricht]");
    return 1;
    }
    SendClientMessageToAll(COLOR_WHITE, "|================= {CDFF00}Gangnachricht {FFFFFF}=================|");
    if(PlayerInfo[playerid][pLeader] == 13)
    {
    format(string, sizeof(string), "{00FF28}Groove Leader {FFFFFF}%s:{00FF28} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 14 )
    {
    format(string, sizeof(string), "{E600FF}Ballas Leader {FFFFFF}%s:{E600FF} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader]==19)
    {
    format(string, sizeof(string), "{AA3333AA}Red Soliders Leader {FFFFFF}%s:{AA3333AA} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 5 )
    {
    format(string, sizeof(string), "{646464}DeVito Leader {FFFFFF}%s:{646464} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 6 )
    {
    format(string, sizeof(string), "{370000}Yakuza Leader {FFFFFF}%s:{370000} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 12 )
    {
    format(string, sizeof(string), "Fuegos Leader {FFFFFF}%s: %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 16 )
    {
    format(string, sizeof(string), "{EBFF00}Vagos Leader {FFFFFF}%s: {EBFF00}%s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 17 )
    {
    format(string, sizeof(string), "{004BFF}Aztecas Leader {FFFFFF}%s:{004BFF} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 18 )
    {
    format(string, sizeof(string), "{00E1FF}Sparazzi Leader {FFFFFF}%s: {00E1FF}%s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 23 )
    {
    format(string, sizeof(string), "{910000}Russen Leader {FFFFFF}%s: {910000}%s", sendername, result);
    }
    //else format(string, sizeof(string), "Staatsbeamter {FFFFFF}%s: %s", sendername, result);
    SendClientMessageToAll(COLOR_DBLUE, string);
    }
    return 1;
    }
    here

    Einmal editiert, zuletzt von Slime ()

  • if(strcmp(cmd, "/ganggov", true) == 0 || strcmp(cmd, "/ggov", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pLeader] != 5 && PlayerInfo[playerid][pLeader] != 13 && PlayerInfo[playerid][pLeader] != 14 && PlayerInfo[playerid][pLeader] != 19 && PlayerInfo[playerid][pLeader] != 16 && PlayerInfo[playerid][pLeader] != 17 && PlayerInfo[playerid][pLeader] != 18 && PlayerInfo[playerid][pLeader] != 23 && PlayerInfo[playerid][pLeader] != 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");



    GetPlayerName(playerid, sendername, sizeof(sendername));
    new length = strlen(cmdtext);
    while ((idx < length) && (cmdtext[idx] <= ' '))


    Ich könnte falsch liegen aber wie wäre es mit "{" und "}" ?



    if(PlayerInfo[playerid][pLeader] != 5 && PlayerInfo[playerid][pLeader] != 13 && PlayerInfo[playerid][pLeader] != 14 && PlayerInfo[playerid][pLeader] != 19 && PlayerInfo[playerid][pLeader] != 16 && PlayerInfo[playerid][pLeader] != 17 && PlayerInfo[playerid][pLeader] != 18 && PlayerInfo[playerid][pLeader] != 23 && PlayerInfo[playerid][pLeader] != 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");
    {
    //Hier ist dann der Code dazwischen etc.
    }


    //E: Code:


    //__________________________________[GangGov]______________________________________________
    if(strcmp(cmd, "/ganggov", true) == 0 || strcmp(cmd, "/ggov", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pLeader] != 5 && PlayerInfo[playerid][pLeader] != 13 && PlayerInfo[playerid][pLeader] != 14 && PlayerInfo[playerid][pLeader] != 19 && PlayerInfo[playerid][pLeader] != 16 && PlayerInfo[playerid][pLeader] != 17 && PlayerInfo[playerid][pLeader] != 18 && PlayerInfo[playerid][pLeader] != 23 && PlayerInfo[playerid][pLeader] != 19) return SendClientMessage(playerid,-1,"Du bist kein GangLeader!");
    {
    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;
    if(!strlen(result))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /ggov (Durchsage) [Nachricht]");
    return 1;
    }
    SendClientMessageToAll(COLOR_WHITE, "|================= {CDFF00}Gangnachricht {FFFFFF}=================|");
    if(PlayerInfo[playerid][pLeader] == 13)
    {
    format(string, sizeof(string), "{00FF28}Groove Leader {FFFFFF}%s:{00FF28} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 14 )
    {
    format(string, sizeof(string), "{E600FF}Ballas Leader {FFFFFF}%s:{E600FF} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader]==19)
    {
    format(string, sizeof(string), "{AA3333AA}Red Soliders Leader {FFFFFF}%s:{AA3333AA} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 5 )
    {
    format(string, sizeof(string), "{646464}DeVito Leader {FFFFFF}%s:{646464} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 6 )
    {
    format(string, sizeof(string), "{370000}Yakuza Leader {FFFFFF}%s:{370000} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 12 )
    {
    format(string, sizeof(string), "Fuegos Leader {FFFFFF}%s: %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 16 )
    {
    format(string, sizeof(string), "{EBFF00}Vagos Leader {FFFFFF}%s: {EBFF00}%s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 17 )
    {
    format(string, sizeof(string), "{004BFF}Aztecas Leader {FFFFFF}%s:{004BFF} %s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 18 )
    {
    format(string, sizeof(string), "{00E1FF}Sparazzi Leader {FFFFFF}%s: {00E1FF}%s", sendername, result);
    }
    else if(PlayerInfo[playerid][pLeader] == 23 )
    {
    format(string, sizeof(string), "{910000}Russen Leader {FFFFFF}%s: {910000}%s", sendername, result);
    }
    //else format(string, sizeof(string), "Staatsbeamter {FFFFFF}%s: %s", sendername, result);
    SendClientMessageToAll(COLOR_DBLUE, string);
    }
    }
    return 1;
    }