CMD Not Working
#1

/drag cmd not working help me please







Код:
CMD:grab(playerid, params[]) return cmd_restrain(playerid, params);
CMD:drag(playerid, params[]) return cmd_restrain(playerid, params);
CMD:unrestrain(playerid, params[]) return cmd_restrain(playerid, params);
CMD:restrain(playerid, params[])
{
	if(IsACop(playerid) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5 || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2) {
		new id, string[ 128 ];
		if( sscanf( params, "u", id ) )
			return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid/partofname]");

		if(!IsPlayerConnected(id))
			return SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");

		if(GetDistanceBetweenPlayers(id, playerid) > 4)
			return SendClientMessage(playerid, COLOR_GREY, "You're not close enough to the player!");

		if(PlayerCuffed[id] == 0)
			return SendClientMessage(playerid, COLOR_GREY, "That person isn't cuffed.");

		if(PlayerCuffed[id] == 1)
			return SendClientMessage(playerid, COLOR_GREY, "You can't drag a tazed player.");

		if(id == playerid)
			return SendClientMessage(playerid, COLOR_GREY, "You can't restrain yourself!");

		if(GetPlayerState(id) != PLAYER_STATE_ONFOOT)
			return SendClientMessage(playerid, COLOR_GREY, "That person is in a car - get them out first.");

		if(GetPlayerState(playerid) != PLAYER_STATE_ONFOOT)
			return SendClientMessage(playerid, COLOR_GREY, "You're in a car - get out first.");

		if(GetPVarInt(playerid, "PBM") > 0)
			return SendClientMessage(playerid, COLOR_WHITE, "You're not able to do this while in a paintball game.");

		if(PlayerCuffedTime[playerid] > 0)
			return SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");

		if(GetPVarInt(playerid, "Injured") == 1)
			return SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");

		if(PlayerInfo[playerid][pJailed] > 0)
			return SendClientMessage(playerid, COLOR_WHITE, "You can't use this in jail/prison.");

		if(PlayerCuffed[playerid] >= 1)
			return SendClientMessage(playerid, COLOR_WHITE, "You can't use this while tazed/cuffed.");

		if(GetPVarInt(id, "Injured") == 1)
			return SendClientMessage(playerid, COLOR_GREY, "You can't cuff injured people.");

		if(PlayerDragged[id] == 1) {
			format(string, sizeof(string), "* %s looks into %s's eyes and then slowly releases them.", GetPlayerNameEx(playerid), GetPlayerNameEx(id));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GameTextForPlayer(id, "~r~Released!", 2500, 3);
			IsCopDragging[PlayerDraggedBy[id]] = INVALID_PLAYER_ID;
			PlayerDragged[id] = 0;
			PlayerDraggedBy[id] = INVALID_PLAYER_ID;
			DeletePVar(playerid, "Dragging");
		} else {
			if(IsCopDragging[playerid] != INVALID_PLAYER_ID)
				return SendClientMessage(playerid, COLOR_GREY, "You can't drag more than one person.");

			format(string, sizeof(string), "* %s quickly grabs %s by the right arm, restraining them.", GetPlayerNameEx(playerid), GetPlayerNameEx(id));
			ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
			GameTextForPlayer(id, "~r~Restrained!", 2500, 3);
			ApplyAnimation(id, "CARRY", "crry_prtial", 4.0, 0, 0, 0, 0, 0, 1);
			SetPlayerSpecialAction(id, SPECIAL_ACTION_CUFFED);
			PlayerDragged[id] = 1;
			PlayerDraggedBy[id] = playerid;
			IsCopDragging[playerid] = id;
			SetPVarInt(playerid, "Dragging", id);
		}
	}
	else SendClientMessage(playerid, COLOR_GREY, "   You're not a Cop / FBI!");
	return true;
}
Reply
#2

What error are you getting? If you don't become explanatory, you wont get help. For the next time FGS please mention what error you get.

And, shouldn't this be like that?
pawn Код:
if(IsACop(playerid) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5 || PlayerInfo[playerid][pDivision] == 2)
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)