SA-MP Forums Archive
toggleplayercontrollable() not working - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: toggleplayercontrollable() not working (/showthread.php?tid=242336)



toggleplayercontrollable() not working - Qeux - 19.03.2011

Maybe i just used it wrong but this is my /cuff command... after about 7 seconds i am able to run around but am still cuffed

pawn Код:
if(strcmp(cmd, "/cuff", true) == 0 || strcmp(cmd, "/cu", true) == 0)
    {
        if(IsPlayerConnected(playerid))
        {
            if(IsACop(playerid) || IsAFreecop(playerid))
            {
                tmp = strtok(cmdtext, idx);
                if(!strlen(tmp)) {
                    SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [Playerid/PartOfName]");
                    return 1;
                }
                if(PlayerInfo[playerid][pDBanned] == 1)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You are Banned From Cop Duty!");
                    return 1;
                }
                if(PlayerInfo[playerid][pDuty] == 0)
                {
                    SendClientMessage(playerid, COLOR_GREY, "* You aren't on Duty!");
                    return 1;
                }
                giveplayerid = ReturnUser(tmp);
                if(IsPlayerConnected(giveplayerid))
                {
                    if(giveplayerid != INVALID_PLAYER_ID)
                    {
                        if(IsACop(giveplayerid) || IsAFreecop(giveplayerid))
                        {
                            SendClientMessage(playerid, COLOR_GREY, "* You can't Cuff Cops !");
                            return 1;
                        }
                        if(GaveUp[giveplayerid] == 0)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "* Player hasn't given up! Taze HIM! (/tazer)");
                            return 1;
                        }
                        if(PlayerCuffed[giveplayerid] > 0)
                        {
                            SendClientMessage(playerid, COLOR_GREY, "* Player already Cuffed !");
                            return 1;
                        }
                        if (ProxDetectorS(8.0, playerid, giveplayerid))
                        {
                            if(giveplayerid == playerid) return SendClientMessage(playerid, COLOR_GREY, "You cannot cuff yourself!");
                            GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
                            format(string, sizeof(string), "* You were Cuffed by %s, till uncuff.", sendername);
                            SendClientMessage(giveplayerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* You Cuffed %s, till uncuff.", giveplayer);
                            SendClientMessage(playerid, COLOR_WHITE, string);
                            format(string, sizeof(string), "* %s Hand Cuffs %s, so he wont go anywhere.", sendername ,giveplayer);
                            ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
                            GameTextForPlayer(giveplayerid, "~r~Cuffed", 2500, 3);
                            PlayerCuffed[giveplayerid] = 1;
                            TogglePlayerControllable(giveplayerid, 0);
                        }
                        else
                        {
                            SendClientMessage(playerid, COLOR_GREY, "* That player is not near you !");
                            return 1;
                        }
                    }
                }
                else
                {
                    SendClientMessage(playerid, COLOR_GREY, "* That player is Offline !");
                    return 1;
                }
            }
            else
            {
                SendClientMessage(playerid, COLOR_GREY, "* You are not a Cop / FBI / National Guard !");
            }
        }
        return 1;
    }
please help me out


Re: toggleplayercontrollable() not working - Flyfishes - 19.03.2011

Change the:
pawn Код:
TogglePlayerControllable(giveplayerid, 0);
to
pawn Код:
TogglePlayerControllable(giveplayerid, 1);



Re: toggleplayercontrollable() not working - Mike Garber - 19.03.2011

Quote:
Originally Posted by Flyfishes
Посмотреть сообщение
Change the:
pawn Код:
TogglePlayerControllable(giveplayerid, 0);
to
pawn Код:
TogglePlayerControllable(giveplayerid, 1);
No... That will make him able to move. 1 = You can move 0 = you can't move.


Re: toggleplayercontrollable() not working - Flyfishes - 19.03.2011

Ohh damn. Missunderstood the question. Haha!

Maybe you've got a timer which unfreezes you efter some time? Search around in the script to see.