Problem mit /arrest

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 habe ein Problem wen ich ein Spieler einsperre wird er nicht n die Zelle Arrestet und zugleich werde ich auch Aresstet und zudem ist das Interior dann weg bzw sieht der Spieler dann nichts mehr!



    if(strcmp(cmd, "/arrest", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
    {
    if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist nicht im Dienst!");
    return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,6.0,-1589.8398,715.9842,-5.2422) || IsPlayerInRangeOfPoint(playerid,3.0,215.6246,113.8847,999.0156) || IsPlayerInRangeOfPoint(playerid,3.0,1564.6660,-1694.4382,5.8906))
    {// Jail spot
    new suspect = GetClosestPlayer(playerid);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /arrest (ID / Name)");
    return 1;
    }
    if(IsACop(suspect))
    {
    SendClientMessage(playerid, COLOR_GRAD2, " Du kannst keinen Beamten einsperren!");
    return 1;
    }
    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 ist nicht gesucht!");
    return 1;
    }
    GivePlayerMoney(suspect,-WantedLevel[suspect]*750);
    GivePlayerMoney(playerid,WantedLevel[suspect]*750);
    PlayerInfo[playerid][pGehalt] += WantedLevel[suspect]*2000;
    ResetPlayerWeapons(suspect);
    if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)
    {
    format(string, sizeof(string), "INFO: Officer %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)
    {
    format(string, sizeof(string), "INFO: Agent %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
    {
    format(string, sizeof(string), "INFO: Soldat %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    else if(PlayerInfo[playerid][pMember]==22||PlayerInfo[playerid][pLeader]==22)
    {
    format(string, sizeof(string), "INFO: SWAT Agent %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    if(LSPDZellen == 0)//zelle1
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,227.3844,111.5490,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 1)//zelle2
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,223.5090,111.4179,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 2)//zelle3
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,219.5361,111.3571,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 3)//Zelle4
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,215.5814,111.1412,999);
    LSPDZellen += 1;
    }
    PlayerInfo[suspect][pJailTime] = WantedLevel[suspect] * 240;
    new spr[100];
    format(spr,sizeof(spr),"Du wurdest für %d Minuten und einer Geldstrafe von %d$ eingesperrt",WantedLevel[suspect] * 4,WantedLevel[suspect] * 2000);
    SendClientMessage(playerid,COLOR_LIGHTBLUE,spr);
    PlayerInfo[suspect][pJailed] = 1;
    PlayerInfo[suspect][pArrested] += 1;
    SetPlayerInterior(suspect, 6);
    SetPlayerFree(suspect,playerid, "Verhaftet");
    WantedPoints[suspect] = 0;
    WantedLevel[suspect] = 0;
    SetPlayerWantedLevel(suspect,0);
    }//distance
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Niemand zum Verhaften in deiner Nähe.");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist kein Beamter !");
    return 1;
    }
    }//not connected
    return 1;
    }

  • Wenn ich dein Problem richtig verstanden habe, dann müsstest du bei den LSPDZellen-Abfragen einfach playerid -> suspect ersetzen.

  • Nein, hier, so:
    if(PlayerInfo[playerid][pMember]==FBI_MEMBER)
    {

    }
    else
    {
    if(LSPDZellen == 0)//zelle1
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,227.3844,111.5490,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 1)//zelle2
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,223.5090,111.4179,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 2)//zelle3
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,219.5361,111.3571,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 3)//Zelle4
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,215.5814,111.1412,999);
    LSPDZellen += 1;
    }
    }


  • Darunter einbaun den code

  • Spoiler anzeigen
    if(strcmp(cmd, "/arrest", true) == 0)
    {
    if(IsPlayerConnected(playerid))
    {
    if(gTeam[playerid] == 2 || IsACop(playerid) || PlayerInfo[playerid][pMember] == 12 || PlayerInfo[playerid][pLeader] == 12 || PlayerInfo[playerid][pMember] == 2 || PlayerInfo[playerid][pLeader] == 2 || PlayerInfo[playerid][pMember] == 3 || PlayerInfo[playerid][pLeader] == 3)
    {
    if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist nicht im Dienst!");
    return 1;
    }
    if(IsPlayerInRangeOfPoint(playerid,6.0,-1589.8398,715.9842,-5.2422) || IsPlayerInRangeOfPoint(playerid,3.0,215.6246,113.8847,999.0156) || IsPlayerInRangeOfPoint(playerid,3.0,1564.6660,-1694.4382,5.8906))
    {
    // Jail spot
    new suspect = GetClosestPlayer(playerid);
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
    SendClientMessage(playerid, COLOR_GRAD2, "Benutze: /arrest (ID / Name)");
    return 1;
    }
    if(IsACop(suspect))
    {
    SendClientMessage(playerid, COLOR_GRAD2, " Du kannst keinen Beamten einsperren!");
    return 1;
    }
    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 ist nicht gesucht!");
    return 1;
    }
    GivePlayerMoney(suspect,-WantedLevel[suspect]*750);
    GivePlayerMoney(playerid,WantedLevel[suspect]*750);
    PlayerInfo[playerid][pGehalt] += WantedLevel[suspect]*2000;
    ResetPlayerWeapons(suspect);
    if(PlayerInfo[playerid][pMember]==1||PlayerInfo[playerid][pLeader]==1)
    {
    format(string, sizeof(string), "INFO: Officer %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    else if(PlayerInfo[playerid][pMember]==2||PlayerInfo[playerid][pLeader]==2)
    {
    format(string, sizeof(string), "INFO: Agent %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    else if(PlayerInfo[playerid][pMember]==3||PlayerInfo[playerid][pLeader]==3)
    {
    format(string, sizeof(string), "INFO: Soldat %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    else if(PlayerInfo[playerid][pMember]==22||PlayerInfo[playerid][pLeader]==22)
    {
    format(string, sizeof(string), "INFO: SWAT Agent %s hat den Verbrecher %s eingesperrt", SpielerName(playerid), SpielerName(suspect));
    OOCNews(COLOR_RED, string);
    }
    if(PlayerInfo[playerid][pMember]==FBI_MEMBER) //====== FBI_MEMBER mit der Member ID von FBI ersetzen, oder wie auch immer du abfragst, ob der Spieler FBI ist.
    {
    //Hier die Positionen für die Zelle(n) in SF eintragen, gleich wie unten bei den LSPDZellen.
    }
    else
    {
    if(LSPDZellen == 0)//zelle1
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,227.3844,111.5490,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 1)//zelle2
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,223.5090,111.4179,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 2)//zelle3
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,219.5361,111.3571,999);
    LSPDZellen += 1;
    }
    if(LSPDZellen == 3)//Zelle4
    {
    SetPlayerInterior(playerid, 0);
    UnFreezePlayer(playerid);
    PlayerCuffed[playerid] = 0;
    SetPlayerPos(playerid,215.5814,111.1412,999);
    LSPDZellen += 1;
    }
    }
    PlayerInfo[suspect][pJailTime] = WantedLevel[suspect] * 240;
    new spr[100];
    format(spr,sizeof(spr),"Du wurdest für %d Minuten und einer Geldstrafe von %d$ eingesperrt",WantedLevel[suspect] * 4,WantedLevel[suspect] * 2000);
    SendClientMessage(playerid,COLOR_LIGHTBLUE,spr);
    PlayerInfo[suspect][pJailed] = 1;
    PlayerInfo[suspect][pArrested] += 1;
    SetPlayerInterior(suspect, 6);
    SetPlayerFree(suspect,playerid, "Verhaftet");
    WantedPoints[suspect] = 0;
    WantedLevel[suspect] = 0;
    SetPlayerWantedLevel(suspect,0);
    }
    //distance
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Niemand zum Verhaften in deiner Nähe.");
    return 1;
    }
    }
    else
    {
    SendClientMessage(playerid, COLOR_GREY, " Du bist kein Beamter !");
    return 1;
    }
    }
    //not connected
    return 1;
    }


    Beachte Zeile 62 und 64.