[Help] Cuff command
#7

pawn Код:
if(strcmp(cmd, "/cuff", true) == 0)
    {
        tmp = strtok(cmdtext, idx);
        if(!strlen(tmp))
        {
            SendClientMessage(playerid, COLOR_GREY, "USAGE: /cuff [playerid]");
        }
        giveplayerid = strval(tmp);
        new Float:x, Float:y, Float:z;
        GetPlayerPos(playerid, x, y, z);
        if(gTeam[playerid] == TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] == TEAM_ARMY && PlayerInfo[playerid][pRank] == 2)
        {
            if(giveplayerid == playerid)
            {
              SendClientMessage(playerid, COLOR_RED, "You cannot cuff yourself!");
              return 1;
            }
            if (ProxDetectorS(7.5, playerid, giveplayerid))
            {
                if(gTeam[playerid] == TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] == TEAM_ARMY && PlayerInfo[playerid][pRank] == 2 && IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 104)
                {
                    format(string, sizeof(string), "Officer %s has cuffed (suspect) %s", PlayerName[playerid], PlayerName[giveplayerid]);
                    SendClientMessageToAll(COLOR_BLUE, string);
                    TogglePlayerControllable(giveplayerid, false);
                    return 1;
                }
                else
                {
                    SendClientMessage(playerid, COLOR_RED, "You could not cuff an officer that follows the law to.");
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_RED, "That playerid is not close (enough) to you!");
            }

        }
        else
        {
            SendClientMessage(playerid, COLOR_RED,"You are not a part of the cops team.");
        }
        return 1;
    }
If you dont have ProxDetectorS yet add:
pawn Код:
forward ProxDetectorS(Float:radi, playerid, targetid);
pawn Код:
public ProxDetectorS(Float:radi, playerid, targetid)
{
    if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
    {
        new Float:posx, Float:posy, Float:posz;
        new Float:oldposx, Float:oldposy, Float:oldposz;
        new Float:tempposx, Float:tempposy, Float:tempposz;
        GetPlayerPos(playerid, oldposx, oldposy, oldposz);
        GetPlayerPos(targetid, posx, posy, posz);
        tempposx = (oldposx -posx);
        tempposy = (oldposy -posy);
        tempposz = (oldposz -posz);
        if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
        {
            return 1;
        }
    }
    return 0;
}
Reply


Messages In This Thread
[Help] Cuff command - by [Aka]Dragonu - 01.12.2010, 19:13
Re: [Help] Cuff command - by Jochemd - 01.12.2010, 19:17
Re: [Help] Cuff command - by [Aka]Dragonu - 01.12.2010, 19:18
Re: [Help] Cuff command - by Jochemd - 01.12.2010, 19:35
Re: [Help] Cuff command - by [Aka]Dragonu - 01.12.2010, 19:39
Re: [Help] Cuff command - by 6d - 01.12.2010, 19:53
Re: [Help] Cuff command - by Mokerr - 01.12.2010, 19:54
Re: [Help] Cuff command - by [Aka]Dragonu - 02.12.2010, 05:43
Re: [Help] Cuff command - by Mokerr - 02.12.2010, 09:21
Re: [Help] Cuff command - by SkizzoTrick - 02.12.2010, 11:08

Forum Jump:


Users browsing this thread: 1 Guest(s)