Arrest CMD Bug
#2

pawn Код:
if(strcmp(cmd, "/arrest", true) == 0 || strcmp(cmd, "/ar", true) == 0)
    {
    new string[128];
    new ID;
    sscanf(cmdtext, "i", ID);
    if(IsSpawned[playerid] == 0)
    {
    SendClientMessage(playerid, COLOR_ERROR, "You are dead. You cannot use this command");
    return 1;
    }
    if(IsCuffed[ID] == 0)
    {
        format(string,sizeof(string),"%s(%d) is not cuffed. You have to place the suspect in cuffs before attempted to arrest them.",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != ARMY && gTeam[playerid] != FBI)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You are not a Law Enforcement officer ");
        return 1;
    }
    tmp = strtok(cmdtext, idx);
    if(!strlen(tmp))
    {
        SendClientMessage(playerid, COLOR_ERROR, "USAGE: /(ar)rrest(id)");
        return 1;
    }
    giveplayerid = strval(tmp);
    if(!IsNumeric(tmp))
    {
        SendClientMessage(playerid, COLOR_ERROR, "USAGE: /(ar)rrest (id)");
        return 1;
    }
    if(!IsPlayerConnected(giveplayerid))
    {
        format(string, sizeof(string), "ID (%d) is not an active player", giveplayerid);
        SendClientMessage(playerid, COLOR_ERROR, string);
        return 1;
    }

    new oname[24];
    new pname[24];
    GetPlayerName(playerid,oname, 24);
    GetPlayerName(giveplayerid, pname, 24);

    if(GetPlayerWantedLevel(giveplayerid) <= 3)
    {
        format(string, sizeof(string), "%s(%d) does not have a warrant. You cannot arrest a player without a warrant",pname,giveplayerid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(IsPlayerInAnyVehicle(playerid))
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect if you are in a car");
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 10)
    {
    format(string, sizeof(string), "%s(%d) is too far away. You cannot arrest that player",pname,giveplayerid);
    SendClientMessage(playerid,COLOR_ERROR,string);
    return 1;
    }
    if(IsSpawned[giveplayerid] == 0)
    {
    format(string, sizeof(string), "%s(%d) is dead. You cannot arrest a dead body",pname,giveplayerid);
    SendClientMessage(playerid,COLOR_ERROR,string);
    return 1;
    }
    SetPlayerVirtualWorld(giveplayerid,0);
    if(GetPlayerWantedLevel(playerid) >=1)
    {
    SendClientMessage(playerid,COLOR_ERROR,"You cannot use this command if you are wanted by the police");
    return 1;
    }
    if(giveplayerid == playerid)
    {
    SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself");
    return 1;
    }
    new spawn = random(sizeof(PrisonSpawn)), string2[250], Float:health, copname[MAX_PLAYER_NAME], arrested[MAX_PLAYER_NAME];
    GetPlayerName(playerid, copname, sizeof(copname));
    GetPlayerName(strval(tmp), arrested, sizeof(arrested));
    GetPlayerHealth(strval(tmp), health);
    SendClientMessage(strval(tmp), GREY, "|_| San Andreas Police Dept. |_|");
    format(string, sizeof(string), "You have been arrested by Law Enforcement Officer %s (%d).", copname);
    SendClientMessage(strval(tmp), WHITE, string);
    ResetPlayerWeapons(strval(tmp));
    SetPlayerPos(strval(tmp), PrisonSpawn[spawn][0], PrisonSpawn[spawn][1], PrisonSpawn[spawn][2]);
    SetPlayerFacingAngle(strval(tmp), PrisonSpawn[spawn][3]);
    SetCameraBehindPlayer(strval(tmp));
    if(GetPlayerWantedLevel(strval(tmp)) >= 4 && GetPlayerWantedLevel(strval(tmp)) <= 5)
    {
    PrisonTime[strval(tmp)] = 60;
    GivePlayerMoney(playerid,25000);
    GivePlayerScore(playerid,1);
    }
    else if(GetPlayerWantedLevel(strval(tmp)) >= 6 && GetPlayerWantedLevel(strval(tmp)) <= 8)
    {
    PrisonTime[strval(tmp)] = 120;
    GivePlayerMoney(playerid,35000);
    GivePlayerScore(playerid,1);
    }
    else if(GetPlayerWantedLevel(strval(tmp)) >= 9 && GetPlayerWantedLevel(playerid) <= 11)
    {
    PrisonTime[strval(tmp)] = 180;
    GivePlayerMoney(playerid,45000);
    GivePlayerScore(playerid,2);
    }
    else if(GetPlayerWantedLevel(strval(tmp)) >= 12 && GetPlayerWantedLevel(strval(tmp)) <= 14)
    {
    PrisonTime[strval(tmp)] = 240;
    GivePlayerMoney(playerid,55000);
    GivePlayerScore(playerid,2);
    }
    else if(GetPlayerWantedLevel(strval(tmp)) >= 15)
    {
    PrisonTime[strval(tmp)] = 300;
    GivePlayerMoney(playerid,65000);
    GivePlayerScore(playerid,3);
    }
    SetPlayerWantedLevel(strval(tmp), 0);
    SetPlayerInterior(strval(tmp),3);
    SetPlayerHealth(strval(tmp),99999);
    TogglePlayerControllable(strval(tmp), true);
    SetPlayerJailed(strval(tmp), true);
    format(string2, sizeof(string2), "Law Enforcement Officer %s (%d) has arrested Wanted Suspect %s (%d).", copname, playerid, arrested, strval(tmp));
    Announce(string2);
    if(health <= 90)
 {
    SendClientMessage(strval(tmp), GREY, "|_| San Andreas Police Dept. |_|");
    SendClientMessage(strval(tmp), WHITE, "SAPD has given you some food.");
    SetPlayerHealth(strval(tmp), health+10);
    IsCuffed[playerid] =0;
    ApplyAnimation(strval(tmp), "FOOD", "EAT_Burger", 4.0, 0, 0, 0, 0, 0);
    }
       return 1;
    }
Reply


Messages In This Thread
Arrest CMD Bug - by Uberanwar - 25.08.2013, 06:05
Re: Arrest CMD Bug - by ProjectMan - 25.08.2013, 07:54

Forum Jump:


Users browsing this thread: 1 Guest(s)