Cuff release timer
#4

pawn Код:
//in top of script
new t = 20;
new Timer;
forward UnCuff(ID);


public OnFilterScriptInit()
{
 
    return 1;
}
//your command
CMD:cuff(playerid, params[])
{
    new ID; new pname[24]; new opname[24]; new string[200];
    if(!IsPlayerACop(playerid)) return SendClientMessage(playerid, COLOR_RED,"You are not a law enforcement.");
    if(IsPlayerInAnyVehicle(playerid)) return SendClientMessage(playerid, COLOR_RED, "You cannot use this command in a vehicle.");
    if(sscanf(params, "u", ID)) return SendClientMessage(playerid, COLOR_RED, "Usage: /cuff (ID)");
    if(!IsPlayerConnected(ID)) return SendClientMessage(playerid, COLOR_RED, "Invalid ID.");
    GetPlayerName(ID, opname, 24); GetPlayerName(playerid, pname, 24);
    if(GetDistanceBetweenPlayers(playerid, ID) > 3) return SendClientMessage(playerid, COLOR_RED, "That player is too far away to be cuffed.");
    if(IsPlayerInAnyVehicle(ID)) return SendClientMessage(playerid, COLOR_RED, "That player is in a vehicle. You cannot cuff him.");
    if(IsPlayerACop(playerid)) return SendClientMessage(playerid, COLOR_RED, "You cannot cuff other Law Enforcements.");
    TogglePlayerControllable(ID, 0);
    GameTextForPlayer(ID, "~b~HANDCUFFED!", 5000, 1);
    format(string, sizeof(string), "[POLICE] Officer %s(%d) has put hand cuffs on you. You cannot move.", pname, playerid);
    SendClientMessage(ID, COLOR_LIGHTBLUE, string);
    format(string, 200, "[DISPATCH] Officer %s(%d) has cuffed player %s(%d)", pname, playerid, opname, ID);
   
         Timer =  SetTimerEx("UnCuff", 1000, true,"d",ID);
    SendClientMessage(playerid, COLOR_LIGHTBLUE, "[POLICE] You have cuffed a suspect. You have 30 seconds before they get uncuffed.");
}

//where you want but not in a callback
public UnCuff(ID)
{
       for(new i; i != MAX_PLAYERS;i++)
         {
              d--;
               if(d == 0)
               {
                         TogglePlayerControllable(i,true);
                         KillTimer(Timer);
                           d = 0;
                }
         }
}
Reply


Messages In This Thread
Cuff release timer - by Captain_Mani - 09.08.2012, 06:45
Re: Cuff release timer - by Devilxz97 - 09.08.2012, 06:56
Re: Cuff release timer - by Devilxz97 - 09.08.2012, 07:17
Re: Cuff release timer - by XStormiest - 09.08.2012, 07:28
Re: Cuff release timer - by Captain_Mani - 09.08.2012, 08:20
Re: Cuff release timer - by leonardo1434 - 09.08.2012, 08:37
Re: Cuff release timer - by Captain_Mani - 09.08.2012, 08:59

Forum Jump:


Users browsing this thread: 1 Guest(s)