drag command
#3

try Playerid in there,as that player would be draging them. Also, your code is A LOT longer than it needs to be, let me clean it up for you at the same time.

pawn Код:
new Dragging[MAX_PLAYERS], DraggingID[MAX_PLAYERS] = -1, DraggedBy[MAX_PLAYERS] = -1, GettingDragged[MAX_PLAYERS], dragtimer[MAX_PLAYERS];

CMD:drag(playerid, params[])
{
    if(IsACop(playerid) || IsANG(playerid) || IsAFBI(playerid))
    {
        new target, Float:X, Float:Y, Float:Z;
        if(sscanf(params, "u", target)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /drag [playerid/PartOfName]");

        if(IsPlayerInAnyVehicle(target)) return SendClientMessage(playerid, COLOR_GREY, "   Suspect is in a car, get him out first !");

        if(GettingDragged[target] == 1)
        {
            format(string, sizeof(string), "* %s looks into %s's eyes and then slowly releases them.", PlayerRPName(playerid), PlayerRPName(target));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
            KillTimer(dragtimer[DraggedBy[target]]);
            DraggingID[DraggedBy[target]] = -1;
            Dragging[playerid] = 0; //error line
            DraggedBy[target] = -1;
            GettingDragged[target] = 0;
        }
        else if(PlayerCuffed[target] > 1)
        {
            GettingDragged[target] = 1;
            DraggedBy[target] = playerid;
            DraggingID[playerid] = target;
            Dragging[playerid] = 1;
            format(string, sizeof(string), "* %s quickly grabs %s by the right arm, restraining them.", PlayerRPName(playerid), PlayerRPName(target));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE, COLOR_PURPLE);
            GetPlayerPos(playerid, X Y, Z);
            SetPlayerPos(target, X,Y,Z);
            dragtimer[playerid] = SetTimerEx("Dragging", 1000,0,"ii",playerid, target);
        }
        else
        {
            SendClientMessage(playerid, COLOR_GREY, "That player is not cuffed.");
        }
    }
    else
    {
        SendClientMessage(playerid, COLOR_GRAD2, "   You are not authorized to use that command !");
    }
    return 1;
}
Reply


Messages In This Thread
drag command - by iBots - 21.07.2014, 23:08
Respuesta: drag command - by Alex_Obando - 21.07.2014, 23:09
Re: drag command - by TakeiT - 22.07.2014, 00:51

Forum Jump:


Users browsing this thread: 1 Guest(s)