/ar Command
#6

pawn Код:
@Release(playerid);
@Release(playerid)
{
    new Time = GetPVarInt(playerid, "JailTime");
    if(!IsPlayerConnected(playerid))
        return 0;

    if(Time < 1)
        return SpawnPlayer(playerid);

    new str[30];
    format(str, sizeof(str), "You will be released in: %d", Time);
    GameTextForPlayer(playerid, str, 2500, 3); // Change it if you want

    SetPVarInt(playerid, "JailTime", Time - 1); // Decrease the player's jail time
    SetTimerEx("@Release", 1000, false, "i", playerid);
    return 1;
}

CMD:ar(playerid,params[])
{
    new
        targetid;

    if(gTeam[playerid] != Team_Cop)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can arrest wanted suspects.");
        return 1;
    }
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect while in a vehicle. Exit the vehicle first.");
        return 1;
    }

    if(sscanf(params, "u", targetid))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /ar (Player Name/ID)");
        return 1;
    }
    new
        string[128];

    if(targetid == INVALID_PLAYER_ID || !IsPlayerConnected(targetid))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot arrest them.",targetid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(playerid == targetid)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest yourself, why would you do that anyway?");
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,targetid) > 4)
    {
        format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to arrest him.",GetName(targetid),targetid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetPlayerState(targetid) == PLAYER_STATE_DRIVER || GetPlayerState(targetid) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot arrest a suspect they are in a vehicle. Get them to exit the vehicle first.");
        return 1;
    }
    if(GetPlayerWantedLevel(targetid) < 3)
    {
        format(string,sizeof(string),"%s(%d)'s wanted level is too low. You cannot jail them. Use /ticket (Player ID).",GetName(targetid),targetid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetPVarInt(targetid, "Cuffed") == 0)
    {
        format(string,sizeof(string),"%s(%d) is not cuffed. You have to place the suspect in cuffs before attempted to arrest them.",GetName(targetid),targetid);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    GivePlayerMoney(playerid, 3000);
    IncreaseScore(playerid, 1);
    IncreaseCoprank(playerid, 1);
    SetPVarInt(targetid, "JailTime", 45);
    SetPlayerInterior(targetid, 10);
    new rnd = random(sizeof(PrisonSpawn));
    SetPlayerPos(targetid, PrisonSpawn[rnd][0], PrisonSpawn[rnd][1], PrisonSpawn[rnd][2]);
    SendClientMessage(targetid, COLOR_GREY, "**LOS SANTOS PRISON**");
    SendClientMessage(targetid, COLOR_LIGHTBLUE, "[PRISON] You have been sent to prison. You will be released soon.");
    TogglePlayerControllable(targetid, 1);
    SetPlayerWantedLevel(targetid, 0);
    @Release(targetid);
    return 1;
}
Reply


Messages In This Thread
/ar Command - by efrim123 - 08.10.2013, 23:04
Re: /ar Command - by efrim123 - 08.10.2013, 23:26
Re: /ar Command - by benjaminjones - 08.10.2013, 23:33
Re: /ar Command - by efrim123 - 08.10.2013, 23:56
Re: /ar Command - by efrim123 - 09.10.2013, 00:07
Re: /ar Command - by Jefff - 09.10.2013, 00:48
Re: /ar Command - by efrim123 - 09.10.2013, 01:01
Re: /ar Command - by Jankingston - 09.10.2013, 02:31
Re: /ar Command - by Mattakil - 09.10.2013, 03:01
Re: /ar Command - by efrim123 - 09.10.2013, 18:59

Forum Jump:


Users browsing this thread: 1 Guest(s)