SA-MP Forums Archive
Jail timer.. - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Jail timer.. (/showthread.php?tid=376862)



Jail timer.. - _Khaled_ - 11.09.2012

I need to make a jail timer so when sentence is done they set back out..
my /arrest command..

pawn Код:
dcmd_arrest(playerid,params[])
{
    #pragma unused params
    new pname[MAX_PLAYER_NAME];
    new Spname[MAX_PLAYER_NAME];
    new string[128];
    new id;
    if(sscanf(params, "u", id))
    {
        SendClientMessage(playerid,COLOR_ERROR,"Usage: /ar(rest) (Player Name/ID)");
        return 1;
    }
    if(IsFrozen[playerid] == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You cannot use this command while frozen.");
        return 1;
    }
    if(gTeam[playerid] != TEAM_COP && gTeam[playerid] != TEAM_ARMY && gTeam[playerid] != TEAM_CIA)
    {
        SendClientMessage(playerid,COLOR_RED,"Only law enforement officers could use this command.");
        return 1;
    }
    if(!IsPlayerConnected(id))
    {
        SendClientMessage(playerid, COLOR_RED, "The player is not connected to the server");
        return 1;
    }
    if(id == playerid)
    {
        SendClientMessage(playerid,COLOR_RED,"You cannot arrest yourself.");
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,id) > 6)
    {
        GetPlayerName(id,pname,MAX_PLAYER_NAME);
        format(string,sizeof(string),"%s(%d) is not close enough to arrest them.",pname, id);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_RED,"You cannot arrest a suspect while in a vehicle, exit the vehicle first.");
        return 1;
    }
    if(GetPlayerState(id) == PLAYER_STATE_DRIVER || GetPlayerState(id) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_RED,"You cannot arrest a suspect they are in a vehicle.");
        return 1;
    }
    if(InAdminMode[id] == 1)
    {
        SendClientMessage(playerid,COLOR_RED,"You cannot use this command on this player because they are in Administration mode.");
        return 1;
    }
    if(GetPlayerWantedLevel(id) == 3)
    {
        format(string,sizeof(string),"%s(%d)'s wanted level is only ticket-able., use /ticket (Player Name/ID).",pname,id);
        SendClientMessage(playerid,COLOR_RED,string);
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,id) <= 6)
    {
        if(GetPlayerWantedLevel(id) == 6)
        {
            GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
            GetPlayerName(id,Spname,MAX_PLAYER_NAME);
            format(string,sizeof(string),"[LAW ENFORCEMENT RADIO] Law Enforcement Officer %s(%d) has arrested %s(%d).",pname,playerid,Spname,id);
            SendCopMessage(COLOR_BLUE,string);
            SendCIAMessage(COLOR_BLUE,string);
            SendArmyMessage(COLOR_GREEN,string);
           
            IncreasePlayerScore(playerid,2);
            ResetPlayerWeapons(id);
            SetPlayerToTeamColour(id);
            SetPlayerWantedLevel(id, 0);
            SetPlayerColor(id, COLOR_WHITE);
            SetPlayerHealth(id, 9999999999);
           
            GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
            format(string,sizeof(string),"{0000FF}[ARREST] {FFFFFF}You have been arrested by {0000FF}law enforcement officer %s(%d)",pname,playerid);
            SendClientMessage(id,COLOR_BLUE,string);

           
            GetPlayerName(playerid,pname,MAX_PLAYER_NAME);
            GetPlayerName(id,Spname,MAX_PLAYER_NAME);
            format(string,sizeof(string),"{0000FF}[ARREST] {FFFFFF}Law enforcement officer %s(%d){0000FF} has arrested {FFFFFF}%s(%d).",pname,playerid,Spname,id);
            SendClientMessageToAll(COLOR_BLUE,string);
            format(string,sizeof(string),"7Law enforcement officer %s(%d) has arrested %s(%d).",pname,playerid,Spname,id);
            IRC_GroupSay(groupID,IRC_CHANNEL,string);
            IRC_GroupSay(groupID,ADMIN_CHANNEL,string);

            format(string,sizeof(string),"You have recieved $6000 for sending the wanted suspect %s(%d) to prison.",Spname,id);
            SendClientMessage(playerid,COLOR_BLUE,string);
            GivePlayerMoney(playerid,6000);

            new rnd = random(sizeof(JailSpawnPoints));
            SetPlayerInterior(id,3);
            SetPlayerPos(id,JailSpawnPoints[rnd][0],JailSpawnPoints[rnd][1],JailSpawnPoints[rnd][2]);
            SetPlayerFacingAngle(id,JailSpawnPoints[rnd][3]);
            SetPlayerHealth(id, 9999999999.0);
            TogglePlayerControllable(id,1);
            return 1;
         }
      }
      return 1;
}
Someone? :/


Re: Jail timer.. - _Khaled_ - 12.09.2012

Done.