Fehler beim Duty gehen

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
  • Moin,


    Habe ein Problem bei meinem /duty cmd. Die Positionsabfrage geht und die Fraktionsabfrage klappt ebenfalls. Wenn ich aber beides einhalte gehts nicht weiter.



    dcmd_duty(playerid,params[])
    {
    #pragma unused params
    if(PlayerInfo[playerid][Duty] == 0)
    {
    if(PlayerInfo[playerid][Leader] == 1)
    {
    if(IsPlayerInRangeOfPoint(playerid,8.0,327.2312,307.6949,999.1484))
    {
    if(PlayerInfo[playerid][Rank] == 1)
    {
    SetPlayerSkin(playerid,170);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 2)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 3)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 4)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 5)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 6)
    {
    SetPlayerSkin(playerid,283);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 7)
    {
    SetPlayerSkin(playerid,288);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_GRAD2,"Du bist nicht am Spinnt.");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid,COLOR_GRAD2,"Du bist kein Polizist.");
    return 1;
    }
    }
    else if(PlayerInfo[playerid][Duty] == 1)
    {
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,0);
    ResetPlayerWeapons(playerid);
    PlayerInfo[playerid][Duty] = 0;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun nichtmehr im Dients.");
    return 1;
    }
    return 1;
    }

    Glaub keinem, der Dir sagt, dass Du nichts verändern kannst.
    Die, die das behaupten, haben nur vor der Veränderung Angst.
    Es sind dieselben, die erklären, es sei gut so, wie es ist.
    Und wenn Du etwas ändern willst, dann bist Du automatisch Terrorist (Die Ärzte - Deine Schuld)


  • if(PlayerInfo[playerid][Duty] == 0)
    {
    if(PlayerInfo[playerid][Leader] == 1)
    {
    if(IsPlayerInRangeOfPoint(playerid,8.0,327.2312,307.6949,999.1484))
    {


    Entweder du rucks das nach IsPlayerInRangeOfPoint versetzt, oder du haust da sin eine Abfrage:


    [pwn]if(Player[playerid][Duty] == 0 && PlayerInfo[playerid][Leader] == 1 && IsPlayerInRangeOfPoint blabla))
    {
    [pwn]

  • Habe es nun so und keine Ahnung warum aber es klappt.



    dcmd_duty(playerid,params[])
    {
    #pragma unused params
    if(PlayerInfo[playerid][Leader] == 0 || PlayerInfo[playerid][Leader] > 1)
    {
    return SendClientMessage(playerid,COLOR_GRAD2,"Du bist kein Polizist");
    }
    if(!IsPlayerInRangeOfPoint(playerid,8.0,327.2312,307.6949,999.1484))
    {
    return SendClientMessage(playerid,COLOR_GRAD2,"Du bist nicht am Spinnt");
    }
    if(PlayerInfo[playerid][Duty] == 0)
    {
    if(PlayerInfo[playerid][Rank] == 1)
    {
    SetPlayerSkin(playerid,170);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 2)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 3)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 4)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 5)
    {
    SetPlayerSkin(playerid,282);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 6)
    {
    SetPlayerSkin(playerid,283);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    else if(PlayerInfo[playerid][Rank] == 7)
    {
    SetPlayerSkin(playerid,288);
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,100);
    GivePlayerWeapon(playerid,24,500);
    GivePlayerWeapon(playerid,25,200);
    GivePlayerWeapon(playerid,29,600);
    GivePlayerWeapon(playerid,33,150);
    GivePlayerWeapon(playerid,41,500);
    PlayerInfo[playerid][Duty] = 1;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun im Dienst.");
    return 1;
    }
    }
    else if(PlayerInfo[playerid][Duty] == 1)
    {
    SetPlayerHealth(playerid,100);
    SetPlayerArmour(playerid,0);
    ResetPlayerWeapons(playerid);
    PlayerInfo[playerid][Duty] = 0;
    SendClientMessage(playerid,COLOR_LIGHTBLUE,"Du bist nun nichtmehr im Dients.");
    return 1;
    }
    return 1;
    }

    Glaub keinem, der Dir sagt, dass Du nichts verändern kannst.
    Die, die das behaupten, haben nur vor der Veränderung Angst.
    Es sind dieselben, die erklären, es sei gut so, wie es ist.
    Und wenn Du etwas ändern willst, dann bist Du automatisch Terrorist (Die Ärzte - Deine Schuld)

  • Weil du das so hattest:

    IsPlayerInRangeOfPoint blabla
    {
    if(Player[playerid][Rank] == 1)
    {


    Du hast es quasi "gleichwertig" gesetzt! ;)
    Abfragen immer vor den eigentlichen Kram setzen. :D
    Kann halt keine Fachbegriffe. :D

  • Okay, danke trotzdem ;) Jetzt klappt es ja

    Glaub keinem, der Dir sagt, dass Du nichts verändern kannst.
    Die, die das behaupten, haben nur vor der Veränderung Angst.
    Es sind dieselben, die erklären, es sei gut so, wie es ist.
    Und wenn Du etwas ändern willst, dann bist Du automatisch Terrorist (Die Ärzte - Deine Schuld)

  • naja du wirst spätestens bei einer beförderung probleme haben da der fefehl nur mit Rang 1 funktioniert ;)
    if(Player[playerid][Rank] == 1)



    tipp mach es so


    if(Player[playerid][Rank] >= 1)



    MfG Paddy


    /edit verdammt mal sollte fertig das ding durchlesen^^ vergiss das oben :D

    Zitat

    naja aufm homeserver mit kumpel getestet und nix laggt von daher sollte nen richtiger server mit sowas keine probs haben

    *an Kopf schlag
    sowas kommt Raus wenn man erst absendet ohne nachzudenken. Bitte Leute Hirn einschalten beim Posten...