/drag error: you cant drag more then one person
#1

When i Type /drag it says you cant drag more then one person.. please help

Код:
new PlayerDragged[MAX_PLAYERS];
new PlayerDraggedBy[MAX_PLAYERS];
new IsCopDragging[MAX_PLAYERS];
Код:
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)) {
		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(GetPVarInt(playerid, "EventToken") != 0)
			return SendClientMessage(playerid, COLOR_GREY, "You can't use the tazer while you're in an event.");

		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) {
		    if(PlayerInfo[playerid][pMask] == 1) { format(string, sizeof(string), "* Stranger looks into %s's eyes and slowly release them.", GetPlayerNameEx(id)); }
		    else { 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.");

			if(PlayerInfo[playerid][pMask] == 1) { format(string,sizeof(string), " Strangers quickly grabs %s by the right arm, restraining them.", GetPlayerNameEx(id)); }
			else { 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;
}
Thanks in Advance
Reply
#2

You simple had:
PHP код:
if(IsCopDragging[playerid] != INVALID_PLAYER_ID)
                return 
SendClientMessage(playeridCOLOR_GREY"You can't drag more than one person."); 
I've removed that now.

PHP код:
CMD:grab(playeridparams[]) return cmd_restrain(playeridparams);
CMD:drag(playeridparams[]) return cmd_restrain(playeridparams);
CMD:unrestrain(playeridparams[]) return cmd_restrain(playeridparams);
CMD:restrain(playeridparams[])
{
    if(
IsACop(playerid)) {
        new 
idstring128 ];
        if( 
sscanfparams"u"id ) )
            return 
SendClientMessage(playeridCOLOR_WHITE"USAGE: /drag [playerid/partofname]");

        if(!
IsPlayerConnected(id))
            return 
SendClientMessage(playeridCOLOR_GREY"Invalid player specified.");

        if(
GetDistanceBetweenPlayers(idplayerid) > 4)
            return 
SendClientMessage(playeridCOLOR_GREY"You're not close enough to the player!");

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

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

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

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

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

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

        if(
GetPVarInt(playerid"EventToken") != 0)
            return 
SendClientMessage(playeridCOLOR_GREY"You can't use the tazer while you're in an event.");

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

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

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

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

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

     if(
PlayerDragged[id] == 1) {
            if(
PlayerInfo[playerid][pMask] == 1) { format(stringsizeof(string), "* Stranger looks into %s's eyes and slowly release them."GetPlayerNameEx(id)); }
            else { 
format(stringsizeof(string), "* %s looks into %s's eyes and then slowly releases them."GetPlayerNameEx(playerid), GetPlayerNameEx(id)); }
            
ProxDetector(30.0playeridstringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
GameTextForPlayer(id"~r~Released!"25003);
            
IsCopDragging[PlayerDraggedBy[id]] = INVALID_PLAYER_ID;
            
PlayerDragged[id] = 0;
            
PlayerDraggedBy[id] = INVALID_PLAYER_ID;
            
DeletePVar(playerid"Dragging");
        } else {
            

            if(
PlayerInfo[playerid][pMask] == 1) { format(string,sizeof(string), " Strangers quickly grabs %s by the right arm, restraining them."GetPlayerNameEx(id)); }
            else { 
format(stringsizeof(string), "* %s quickly grabs %s by the right arm, restraining them."GetPlayerNameEx(playerid), GetPlayerNameEx(id)); }
            
ProxDetector(30.0playeridstringCOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLECOLOR_PURPLE);
            
GameTextForPlayer(id"~r~Restrained!"25003);
            
ApplyAnimation(id"CARRY""crry_prtial"4.0000001);
            
SetPlayerSpecialAction(idSPECIAL_ACTION_CUFFED);
            
PlayerDragged[id] = 1;
            
PlayerDraggedBy[id] = playerid;
            
IsCopDragging[playerid] = id;
            
SetPVarInt(playerid"Dragging"id);
        }
    }
    else 
SendClientMessage(playeridCOLOR_GREY"   You're not a Cop / FBI!");
    return 
true;

Reply
#3

@Meller It doesn't work like this too it says that you are dragging player bla bla bla but doesn't Drag the player the player stands still there
Reply
#4

Write /drag again to stop dragging
Reply
#5

yea but it dont even start dragging
Reply
#6

Quote:

PlayerDragged[id] = 1;

Quote:

PlayerDragged[id] = 2;

Try it but i'm not sure
Reply
#7

Quote:
Originally Posted by MicroKyrr
Посмотреть сообщение
Try it but i'm not sure
Wouldnt it be
PlayerDragged[id] = 0;
and

PlayerDragged[id] = 1;
if you were to try this? lol
Reply
#8

anyways thanks guys its working now
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)