Converting to the 0.3e cuff system
#1

pawn Код:
if(strcmp(cmd, "/cuff", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
   if(IsACop(playerid) || IsAUSAF(playerid) || IsASWAT(playerid) || IsAnAgent(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, WHITE, "** [Usage]: /cuff [playerid/name]");
                    return 1;
                }
                if(IsPlayerInAnyVehicle(playerid))
                {
                    SendClientMessage(playerid, GREY, "Cannot use this while in a Car.");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(PlayerTied[giveplayerid] > 0)
                    {
                        SendClientMessage(playerid, GREY, "    That player is Tied up.");
                        return 1;
                    }
                    if(PlayerCuffed[giveplayerid] > 1)
                    {
                        SendClientMessage(playerid, GREY, "    That player is already Cuffed.");
                        return 1;
                    }
                    if(IsPlayerInAnyVehicle(giveplayerid))
                    {
                        SendClientMessage(playerid, GREY, "Suspect is in a car, get him out first.");
                        return 1;
                    }
                    if(PlayerCuffed[giveplayerid] == 1 || GetPlayerSpecialAction(giveplayerid) == SPECIAL_ACTION_HANDSUP)
                    {
                            if(ProxDetectorS(8.0, playerid, giveplayerid))
                            {
                                if(giveplayerid == playerid) { SendClientMessage(playerid, GREY, "    You can't Cuff yourself."); return 1; }
                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                format(string, sizeof(string), "* You were cuffed by Officer %s.", sendername);
                                SendClientMessage(giveplayerid, LIGHTBLUE, string);
                                if(PlayerInfo[giveplayerid][pMask] == 1)
                                {
                                    format(string, sizeof(string), "* You Cuffed A Stranger.");
                                    SendClientMessage(playerid, LIGHTBLUE, string);
                                    format(string, sizeof(string), "* %s hand cuffs A Stranger, so he wont go anywhere.", PlayerName(playerid));
                                    ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
                                }
                                else
                                {
                                    format(string, sizeof(string), "* You cuffed %s.", giveplayer);
                                    SendClientMessage(playerid, LIGHTBLUE, string);
                                    format(string, sizeof(string), "* %s hand cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
                                    ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
                                }
                                GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
                                TogglePlayerControllable(giveplayerid, 0);
                                ClearAnimations(giveplayerid);
                                ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
                                ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0);
                                PlayerCuffed[giveplayerid] = 2;
                                PlayerCuffedTime[giveplayerid] = 300;
                            }
                            else
                            {
                                SendClientMessage(playerid, GREY, "    That player is not near you.");
                                return 1;
                            }
                    }
                    else
                    {
                        SendClientMessage(playerid, GREY, "    That player needs to be restrained first.");
                        return 1;
                    }
                }
                else
                {
                   SendClientMessage(playerid, GREY, "    That player is Offline.");
                   return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, GREY, "    You're not a Cop / FBI / RCSD / USAF.");
            }
        }
        return 1;
    }
    if(strcmp(cmd, "/uncuff", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
   if(IsACop(playerid) || IsAUSAF(playerid) || IsASWAT(playerid) || IsAnAgent(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp))
                {
                    SendClientMessage(playerid, WHITE, "** [Usage]: /uncuff [playerid/name]");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(ProxDetectorS(8.0, playerid, giveplayerid))
                        {
                            if(giveplayerid == playerid) { SendClientMessage(playerid, GREY, "    You can't Uncuff yourself."); return 1; }
                            if(PlayerCuffed[giveplayerid])
                            {
                                GetPlayerName(playerid, sendername, sizeof(sendername));
                                GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                                format(string, sizeof(string), "* You were Uncuffed by %s.", sendername);
                                SendClientMessage(giveplayerid, LIGHTBLUE, string);
                                if(PlayerInfo[giveplayerid][pMask] == 1)
                                {
                                    format(string, sizeof(string), "* You uncuffed A Stranger.");
                                    SendClientMessage(playerid, LIGHTBLUE, string);
                                    format(string, sizeof(string), "* %s has uncuffed A Stranger.", PlayerName(playerid));
                                    ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
                                }
                                else
                                {
                                    format(string, sizeof(string), "* You uncuffed %s.", giveplayer);
                                    SendClientMessage(playerid, LIGHTBLUE, string);
                                    format(string, sizeof(string), "* %s has uncuffed %s.", sendername ,giveplayer);
                                    ProxDetector(30.0, playerid, string, PURPLE,PURPLE,PURPLE,PURPLE,PURPLE);
                                }
                                GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
                                TogglePlayerControllable(giveplayerid, 1);
                                ClearAnimations(giveplayerid);
                                PlayerCuffed[giveplayerid] = 0;
                                PlayerCuffedTime[giveplayerid] = 0;
                            }
                            else
                            {
                                SendClientMessage(playerid, GREY, "    That player isn't Cuffed.");
                                return 1;
                            }
                        }
                        else
                        {
                            SendClientMessage(playerid, GREY, "    That player is not near you.");
                            return 1;
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, GREY, "    That player is Offline.");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, GREY, "    You're not a Cop / FBI / RCSD / USAF.");
            }
        }
        return 1;
    }
Hi guys, I don't know where to start from converting this to 0.3e cuffs, a lil help please?
Reply
#2

What you mean for converting 0.3e cuff system?It's nothing more than
pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
...
Reply
#3

Not exactly there broski..... I've got remove the freeze shit, have no idea where to add special_action_cuffed. and I have no idea how to create the cuff object lol Im a noob..
Reply
#4

You don't need to create the cuff object,like i said,it's a simple SetPlayerSpecialAction.

Just paste

pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
After TogglePlayerControllable. (/cuff command).

And on the /uncuff command just set TogglePlayerControllable to 1 and you're done.

You don't need any timer or other.
Reply
#5

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
You don't need to create the cuff object,like i said,it's a simple SetPlayerSpecialAction.

Just paste

pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
After TogglePlayerControllable. (/cuff command).

And on the /uncuff command just set TogglePlayerControllable to 1 and you're done.

You don't need any timer or other.
Alright I want the cuff object though, it looks retarded without the cuff object and just the animation.
PLUS My cuff system currently freezes the players, which I don't want.
Reply
#6

Does the SPECIAL_ACTION_CUFFED shows the object you're requesting?I tried on my server and it shows the cuff animation + the object.

To not freeze the player,remove TogglePlayerControllable.
Reply
#7

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
You don't need to create the cuff object,like i said,it's a simple SetPlayerSpecialAction.

Just paste

pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
After TogglePlayerControllable. (/cuff command).

And on the /uncuff command just set TogglePlayerControllable to 1 and you're done.

You don't need any timer or other.
It didnt show up for me, but ill try again. Thanks broski. Rep +
Reply
#8

That cuffed me whenever i added it to the code, not the person LOL
Reply
#9

of course it will cuff you because you set it to playerid not to giveplayerid

change

pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
to

pawn Код:
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
Reply
#10

Quote:
Originally Posted by Romel
Посмотреть сообщение
of course it will cuff you because you set it to playerid not to giveplayerid

change

pawn Код:
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
to

pawn Код:
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
when i do this i get this error 017: undefined symbol "SPECIAL_ACTION_CUFFED"
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)