Uncuff - not working
#10

Please, stop bumping your topic. I'm gonna help you, so don't worry, okey?

Try this code, I re-write it a little bit, if it's not gonna work then, I have some other idea.

pawn Код:
#include    <a_samp>
#include    <zcmd>
#include    <sscanf2>

CMD:cuff(playerid, params[])
{
    if(!(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2)))
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
        return true;
    }
    new string[128], giveplayerid;
    if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /cuff [playerid]");
    {
        if(GetPVarInt(playerid, "Injured") == 1)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
            return 1;
        }
   
        if(!IsPlayerConnected(giveplayerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
            return true;
        }
       
        if(!ProxDetectorS(8.0, playerid, giveplayerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
            return true;
        }
       
        if(giveplayerid == playerid)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!");
            return true;
        }
       
        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, 1);
            SetPlayerAttachedObject(giveplayerid, 2, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
            SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_CUFFED);
           
            PlayerCuffed[giveplayerid] = 2;
            SetPVarInt(giveplayerid, "PlayerCuffed", 2);
            SetPVarInt(giveplayerid, "IsFrozen", 1);
            PlayerCuffedTime[giveplayerid] = 300;
           
        }
       
        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "That player isn't restrained!");
        }
    }
    return true;
}


CMD:uncuff(playerid, params[])
{
    if(!(IsACop(playerid) || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pDivision] == 2 || PlayerInfo[playerid][pMember] == 4 && PlayerInfo[playerid][pRank] >= 5 || (PlayerInfo[playerid][pMember] == 12 && PlayerInfo[playerid][pDivision] == 2)))
    {
        SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
        return true;
    }
   
    new string[128], giveplayerid;
    if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_WHITE, "USAGE: /uncuff [playerid]");
    {
   
        if(!IsPlayerConnected(giveplayerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
            return true;
        }

        if(!ProxDetectorS(8.0, playerid, giveplayerid))
        {
            SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
            return true;
        }

        if(PlayerInfo[giveplayerid][pJailed] >= 1)
        {
            SendClientMessageEx(playerid, COLOR_WHITE, "You can't uncuff a jailed player.");
            return 1;
        }

        if(giveplayerid == playerid)
        {
            SendClientMessageEx(playerid, COLOR_GREY, "You can't uncuff yourself.");
            return true;
        }

        if(PlayerCuffed[giveplayerid] > 1)
        {
            if(IsPlayerAttachedObjectSlotUsed(giveplayerid, 2))
            {
                RemovePlayerAttachedObject(giveplayerid);
            }

            DeletePVar(giveplayerid, "IsFrozen");
            format(string, sizeof(string), "* You have been uncuffed by %s.", GetPlayerNameEx(playerid));
            SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);

            format(string, sizeof(string), "* You uncuffed %s.", GetPlayerNameEx(giveplayerid));
            SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);

            format(string, sizeof(string), "* %s has uncuffed %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
            ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);

            GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
            TogglePlayerControllable(giveplayerid, 1);

            SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_NONE);
            PlayerCuffed[giveplayerid] = 0;
            PlayerCuffedTime[playerid] = 0;
            DeletePVar(giveplayerid, "PlayerCuffed");
        }

        else
        {
            SendClientMessageEx(playerid, COLOR_GREY, "That player isn't cuffed.");
            return 1;
        }
    }
    return 1;
}
Reply


Messages In This Thread
Uncuff - not working - by firemanjv - 29.03.2013, 15:23
Re: Uncuff - not working - by Riddick94 - 29.03.2013, 15:49
Re: Uncuff - not working - by firemanjv - 29.03.2013, 18:35
Re: Uncuff - not working - by firemanjv - 30.03.2013, 10:22
Re: Uncuff - not working - by firemanjv - 30.03.2013, 12:14
Re: Uncuff - not working - by Riddick94 - 30.03.2013, 12:33
Re: Uncuff - not working - by firemanjv - 30.03.2013, 15:36
Re: Uncuff - not working - by firemanjv - 30.03.2013, 18:14
Re: Uncuff - not working - by firemanjv - 30.03.2013, 20:02
Re: Uncuff - not working - by Riddick94 - 30.03.2013, 21:56
Re: Uncuff - not working - by firemanjv - 31.03.2013, 06:14
Re: Uncuff - not working - by firemanjv - 01.04.2013, 18:50
Re: Uncuff - not working - by Kestro - 01.04.2013, 19:08
Re: Uncuff - not working - by firemanjv - 01.04.2013, 19:09
Re: Uncuff - not working - by Red_Dragon. - 01.04.2013, 19:30
Re: Uncuff - not working - by Riddick94 - 01.04.2013, 21:49

Forum Jump:


Users browsing this thread: 1 Guest(s)