how to make breakcuff command?
#1

Hi guys I'm just wondering how to make a breakcuff CMD. I wanna make it random, 50% success 50% fail. The suspect must wait 30 seconds before attempting to breakcuff again.

This is my cuff command
pawn Код:
dcmd_cuff(playerid,params[])
{
    new string[128];
    new ID;
    if(sscanf(params, "u", ID))
    {
        SendClientMessage(playerid,COLOR_ERROR,"USAGE: /cuff (Player Name/ID)");
        return 1;
    }
    if(IsSpawned[playerid] != 1)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You must be alive and spawned in order to be able to use this command.");
        return 1;
    }
    if(gTeam[playerid] != COP && gTeam[playerid] != SWAT && gTeam[playerid] != FBI && gTeam[playerid] != ARMY)
    {
        SendClientMessage(playerid,COLOR_ERROR,"Only law enforcement can place cuffs on suspects.");
        return 1;
    }
    if(!IsPlayerConnected(ID))
    {
        format(string,sizeof(string),"The player ID (%d) is not connected to the server. You cannot cuff them",ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetDistanceBetweenPlayers(playerid,ID) > 4)
    {
        format(string,sizeof(string),"%s(%d) is too far away. You cannot reach him to place cuffs on him.",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(gTeam[ID] == COP || gTeam[ID] == SWAT || gTeam[ID] == FBI || gTeam[ID] == ARMY)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot place other Law Enforcement officer in cuffs. You might lose your job for that ..");
        return 1;
    }
    if(IsCuffed[ID] == 1)
    {
        format(string,sizeof(string),"%s(%d) is already cuffed. You don't want to waste a second pair of cuffs on them.",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
    if(GetPlayerState(playerid) == PLAYER_STATE_DRIVER || GetPlayerState(playerid) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot place a suspect in cuffs while in a vehicle. Exit the vehicle first.");
        return 1;
    }
    if(GetPlayerState(ID) == PLAYER_STATE_DRIVER || GetPlayerState(ID) == PLAYER_STATE_PASSENGER)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot place a suspect in cuffs while they are in a vehicle. Get them to exit the vehicle first.");
        return 1;
    }
    if(playerid == ID)
    {
        SendClientMessage(playerid,COLOR_ERROR,"You cannot put cuffs on yourself, it wouldn't be a good idea with rapists around.");
        return 1;
    }
    if(IsSpawned[ID] != 1)
    {
        format(string,sizeof(string),"%s(%d) is not spawned. You cannot place cuffs on dead people ..",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_ERROR,string);
        return 1;
    }
     if(GetDistanceBetweenPlayers(playerid,ID) <= 4)
        {
        SendClientMessage(playerid,COLOR_WHITE,"[[_Suspect Cuffed_]]");
        format(string,sizeof(string),"You have placed cuffs on %s(%d)! They can no longer move.",PlayerName(ID),ID);
        SendClientMessage(playerid,COLOR_LIGHTBLUE,string);
        SendClientMessage(ID,COLOR_LIGHTBLUE,"[[_Placed in handcuffs_]]");
        format(string,sizeof(string),"Law enforcement officer %s(%d) has placed you in handcuffs!",PlayerName(playerid),playerid);
        SendClientMessage(ID,COLOR_LIGHTBLUE,string);
        TogglePlayerControllable(ID,0);
        ApplyAnimation(ID, "ped", "cower", 3.0, 1, 0, 0, 0, 0); // Taking Cover
        IsCuffed[ID] =1;
        return 1;
    }
    return 1;
}
Hope you guys can give me some tips, advices, etc.
Reply


Messages In This Thread
how to make breakcuff command? - by Uberanwar - 17.08.2013, 12:41
Re: how to make breakcuff command? - by JimmyCh - 17.08.2013, 12:54
Re: how to make breakcuff command? - by Uberanwar - 17.08.2013, 13:02
Re: how to make breakcuff command? - by JimmyCh - 17.08.2013, 13:07
Re: how to make breakcuff command? - by Uberanwar - 17.08.2013, 13:12
Re: how to make breakcuff command? - by Vanter - 17.08.2013, 13:18
Re: how to make breakcuff command? - by Kells - 17.08.2013, 13:24
Re: how to make breakcuff command? - by Vanter - 17.08.2013, 13:35
Re: how to make breakcuff command? - by Uberanwar - 17.08.2013, 16:00
Re: how to make breakcuff command? - by dominik523 - 17.08.2013, 17:16

Forum Jump:


Users browsing this thread: 1 Guest(s)