Cuff command
#1

Hello guys, I am trying to make my /Cuff command able to use even if the suspect is not tazed. Here is my code, if you could re-make it for my request I will be very happy and give +rep

Код:
CMD:cuff(playerid, params[])
{
	if(IsACop(playerid) || Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] == 2 || Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
	{
		if(GetPVarInt(playerid, "Injured") == 1)
		{
			SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
			return 1;
		}

		new string[128], giveplayerid;
		if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /cuff [playerid]");

		if(IsPlayerConnected(giveplayerid))
		{
			if (ProxDetectorS(8.0, playerid, giveplayerid))
			{
				if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!"); return 1; }
				if(PlayerCuffed[giveplayerid] == 1 || GetPlayerSpecialAction(giveplayerid) == SPECIAL_ACTION_HANDSUP)
				{
					format(string, sizeof(string), "* You have been handcuffed by %s.", GetPlayerNameEx(playerid));
					SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
					format(string, sizeof(string), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid));
					SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
					format(string, sizeof(string), "* %s handcuffs %s, tightening the cuffs securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
					ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
					GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
					TogglePlayerControllable(giveplayerid, 0);
					ClearAnimations(giveplayerid);
					ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
					PlayerCuffed[giveplayerid] = 2;
					SetPVarInt(giveplayerid, "PlayerCuffed", 2);
					SetPVarInt(giveplayerid, "IsFrozen", 1);
					//Frozen[giveplayerid] = 1;
					PlayerCuffedTime[giveplayerid] = 300;
    }
				else
				{
					SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!");
					return 1;
				}
   }
			else
			{
				SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
				return 1;
			}
		}
		else
		{
			SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
			return 1;
		}
	}
	else
	{
		SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
	}
	return 1;
}
Reply
#2

bump
Reply
#3

pawn Код:
stock Float:GetDistanceBetweenPlayers(p1,p2)
{
    new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
    if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
    {
        return -1.00;
    }
    GetPlayerPos(p1,x1,y1,z1);
    GetPlayerPos(p2,x3,y3,z3);
    return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}

CMD:cuff(playerid, params[])
{
    new string[128], targetid;
    if(IsCop[playerid] == false) return SendClientMessage(playerid, COLOR_WHITE, "Error: Only Cops can use this command");
    if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_WHITE, "Usage: /cuff [playerid/name]");
    if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_WHITE, "Error: This player is not Connected!");
    if(targetid == playerid) return SendClientMessage(playerid,COLOR_WHITE,"Error: You cannot cuff yourself!");
    if(GetDistanceBetweenPlayers(playerid,targetid) > 3) return SendClientMessage(playerid, COLOR_WHITE, "Error: You are not close enough to this player!");
    if(Cuffed[targetid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Error: This Player Is Already Handcuffed.");
    SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
    ApplyAnimation(targetid,"ped","WEAPON_crouch",4.1,1,0,0,0,0,1);
    Cuffed[targetid] = 1;
    return 1;
}
Reply
#4

CMD:cuff(playerid, params[])
{
new string[128], giveplayerid;
new pFac = PlayerInfo[playerid][pMember];
if(pFac != 1) return SendClientMessage(playerid, COLOR_GREY, "You aren't part of a LEO faction.");
if(sscanf(params, "d", giveplayerid)) return SendClientMessage(playerid, -1, "USAGE: /cuff [playerid]");
if(!IsPlayerConnected(giveplayerid)) return SendClientMessage(playerid, -1, "Invalid player.");
/*if(!IsCuffable(giveplayerid)) return SendClientMessage(playerid, -1, "You cannot cuff them if they aren't restrained.");*/
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
pCuffed[giveplayerid] = 2;
format(string, sizeof(string), "You have been cuffed by %s.", GetName(playerid));
SendClientMessage(giveplayerid, -1, string);
SendClientMessage(playerid, COLOR_WHITE, "Done.");
return 1;
}



___________________________________>
From my own script and REP ME for this
Reply
#5

Not working guys.
Reply
#6

Delete this and the closing '}' ith the else:
pawn Код:
if(PlayerCuffed[giveplayerid] == 1 || GetPlayerSpecialAction(giveplayerid) == SPECIAL_ACTION_HANDSUP)
Reply
#7

Quote:
Originally Posted by Necip
Посмотреть сообщение
Delete this and the closing '}' ith the else:
pawn Код:
if(PlayerCuffed[giveplayerid] == 1 || GetPlayerSpecialAction(giveplayerid) == SPECIAL_ACTION_HANDSUP)
Then I get this error. :

Код:
 error 029: invalid expression, assumed zero
On the line there I get error:

Код:
		else
				{
					SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!");
					return 1;
			 }
   }
Reply
#8

bump
Reply
#9

pawn Код:
CMD:cuff(playerid, params[])
{
    if(IsACop(playerid) || Team_EDLS(playerid) && PlayerInfo[playerid][pDivision] == 2 || Team_EDLS(playerid) && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2))
    {
        if(GetPVarInt(playerid, "Injured") == 1)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }

        new string[128], giveplayerid;
        if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /cuff [playerid]");

        if(!IsPlayerConnected(giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
        if(!ProxDetectorS(8.0, playerid, giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
        if(giveplayerid == playerid) return SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!");
               
        format(string, sizeof(string), "* You have been handcuffed by %s.", GetPlayerNameEx(playerid));
        SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid));
        SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
        format(string, sizeof(string), "* %s handcuffs %s, tightening the cuffs securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
        GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
        TogglePlayerControllable(giveplayerid, 0);
        ClearAnimations(giveplayerid);
        ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
        PlayerCuffed[giveplayerid] = 2;
        SetPVarInt(giveplayerid, "PlayerCuffed", 2);
        SetPVarInt(giveplayerid, "IsFrozen", 1);
        //Frozen[giveplayerid] = 1;
        PlayerCuffedTime[giveplayerid] = 300;
    }
    else return SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
    return 1;
}
Reply
#10

pawn Код:
CMD:cuff(playerid, params[])
{
    if(IsACop(playerid))
    {
        if(GetPVarInt(playerid, "Injured") == 1)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }

        new string[128], giveplayerid;
        if(sscanf(params, "i", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /cuff [playerid]");

        if(IsPlayerConnected(giveplayerid))
        {
            if (ProxDetectorS(8.0, playerid, giveplayerid))
            {
                if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!"); return 1; }
                    format(string, sizeof(string), "* You have been handcuffed by %s.", GetPlayerNameEx(playerid));
                    SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid));
                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "* %s handcuffs %s, tightening the cuffs securely.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
                    TogglePlayerControllable(giveplayerid, 0);
                    ClearAnimations(giveplayerid);
                    SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
                    SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
                    PlayerCuffed[giveplayerid] = 2;
                    SetPVarInt(giveplayerid, "PlayerCuffed", 2);
                    SetPVarInt(giveplayerid, "IsFrozen", 1);
                    //Frozen[giveplayerid] = 1;
                    PlayerCuffedTime[giveplayerid] = 300;
                }
            //  else
            //  {
            //      SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!");
            //      return 1;
            //  }
        //  }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
                return 1;
            }
        }
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
            return 1;
        }
    }
    else
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
    }
    return 1;
}
That would make it.
Hope i helped
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)