Warum bekommt man crash

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


    Ich wollte mal fragen warum man


    wenn man jemand mit /arrest einknastet die verbrechte einen crash bekommen


    hier ist der befehl


    if(strcmp(cmd, "/arrest", true) == 0 || strcmp(cmd, "/a1", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(PlayerInfo[playerid][pMember] == 1 || PlayerInfo[playerid][pLeader] == 1 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3 || PlayerInfo[playerid][pMember] == 21 || PlayerInfo[playerid][pLeader] == 21)
    {
    if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist nicht im Dienst!");
    return 1;
    }
    /*if(!PlayerToPoint(6.0, playerid, 268.3090,79.7730,1001.0391) || PlayerToPoint(6.0, playerid, 1530.1536,-1677.9229,5.8906) || PlayerToPoint(6.0, playerid, -1607.0941,674.9252,-5.2422))
    {// Jail spot
    SendClientMessage(playerid, COLOR_GREY, " Du bist nicht in der nähe des Gefängnisses | Garage!");
    return 1;
    }*/
    if(PlayerToPoint(6.0, playerid, 268.3327,77.8972,1001.0391) || PlayerToPoint(15.0, playerid,1537.2515,-1674.9572,13.3828) || PlayerToPoint(6.0, playerid, 1528.9080,-1678.0759,5.8906))
    {


    tmp = strtok(cmdtext, idx);
    }
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "* /a(rrest) [Kosten] [Minuten] [Kaution (0=nein 1=ya)] [Kautionspreis]");
    return 1;
    }
    moneys = strval(tmp);
    if(moneys < 1 || moneys > 50000) { SendClientMessage(playerid, COLOR_GREY, " Jail Price can't be below $1 or above $99999 !"); return 1; }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "* /a(rrest) [Kosten] [Minuten] [Kaution (0=nein 1=ya)] [Kautionspreis]");
    return 1;
    }
    new time = strval(tmp);
    if(time < 1 || time > 20) { SendClientMessage(playerid, COLOR_GREY, " Knastzeit muss zwischen 1 und 20 Minuten(Für mehr Minuten gibts Prison) !"); return 1; }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "* /a(rrest) [Kosten] [Minuten] [Kaution (0=nein 1=ya)] [Kautionspreis]");
    return 1;
    }
    new bail = strval(tmp);
    if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, " Kann nur zwischen 0 und 1 liegen !"); return 1; }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "* /a(rrest)1 [Kosten] [Minuten] [Kaution (0=nein 1=ya)] [Kautionspreis]");
    return 1;
    }
    new bailprice = strval(tmp);
    if(bailprice < 0 || bailprice > 100000) { SendClientMessage(playerid, COLOR_GREY, " Kaution kann nicht über 100.000$ liegen!"); return 1; }
    new suspect = GetClosestPlayer(playerid);
    if(IsPlayerConnected(suspect))
    {
    if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
    {
    GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
    GetPlayerName(playerid, sendername, sizeof(sendername));
    if(WantedLevel[suspect] < 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Der Spieler muss mindestens 2 Wanteds haben!");
    return 1;
    }
    format(string, sizeof(string), "* Du verhaftest %s !", giveplayer);
    SendClientMessage(playerid, COLOR_GRAD3, string);
    GivePlayerMoney(suspect, -moneys);
    format(string, sizeof(string), "Verhaftet %s ~n~ Für $%d", sendername, moneys);
    GameTextForPlayer(suspect, string, 5000, 5);
    ResetPlayerWeapons(suspect);
    if(PlayerInfo[playerid][pMember]== 1 || PlayerInfo[playerid][pLeader]== 1)
    {
    format(string, sizeof(string), "<< Officer %s verhaftet %s für %d Minuten >>", sendername, giveplayer, time);
    OOCNews(COLOR_LIGHTRED, string);
    }
    else if(PlayerInfo[playerid][pMember]== 2 || PlayerInfo[playerid][pLeader]== 2)
    {
    format(string, sizeof(string), "<< Officer %s %s verhaftet %s für %d Minuten >>", sendername, giveplayer, time);
    OOCNews(COLOR_LIGHTRED, string);
    }
    else if(PlayerInfo[playerid][pMember]== 21 || PlayerInfo[playerid][pLeader]== 21)
    {
    format(string, sizeof(string), "<< FBI Agent %s %s verhaftet %s für %d Minuten >>", sendername, giveplayer, time);
    OOCNews(COLOR_LIGHTRED, string);
    }
    else if(PlayerInfo[playerid][pMember]== 3 || PlayerInfo[playerid][pLeader]== 3)
    {
    format(string, sizeof(string), "<< Soldat %s %s verhaftet %s für %d Minuten >>", sendername, giveplayer, time);
    OOCNews(COLOR_LIGHTRED, string);
    }
    if(bail == 1)
    {
    JailPrice[suspect] = bailprice;
    format(string, sizeof(string), "Du wurdest eingesperrt für %d Sekunden. Kaution: $%d", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
    SendClientMessage(suspect, COLOR_GRAD3, string);
    }
    else
    {
    JailPrice[suspect] = 0;
    format(string, sizeof(string), "Du wurdest eingesperrt für %d Sekunden. Kaution: Unable", PlayerInfo[suspect][pJailTime]);
    SendClientMessage(suspect, COLOR_GRAD3, string);
    }
    SetPlayerInterior(suspect, 6);
    SetPlayerPos(suspect,264.6288,77.5742,1001.0391);
    PlayerInfo[suspect][pJailTime] = time * 60;
    PlayerInfo[suspect][pJailed] = 1;
    PlayerInfo[suspect][pArrested] += 1;
    SetPlayerFree(suspect,playerid, "Verhaftet");
    WantedPoints[giveplayerid] = 0;
    WantedLevel[giveplayerid] = 0;
    ClearCrime(giveplayerid);
    SetPlayerWantedLevel(giveplayerid,0);
    WantLawyer[suspect] = 1;
    }//distance
    }//not connected
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " No-one close enough to arrest.");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist kein Beamter!");
    return 1;
    }
    }//not connected
    return 1;
    }