Cuffing Commands
#1

I am aware of the new SPECIAL_ACTION_CUFFED, but could someone show me a way in which I can cuff another player, and freeze him? I have searched everywhere and cant find a way.

This is what I had: ((Yeh i'm new, and strcmp is all i know how to use.))

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cuff", cmdtext, true, 10) == 0)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
return 1;
}
return 0;
}

So basically, how can I apply this to another player like: /cuff PLAYERID and /uncuff PLAYERID. An how might I freeze them so they can't move their camera or player whilst cuffed.
Reply
#2

Try this?
--> http://pastebin.com/dHk3LTNe
Reply
#3

Using sscanf. Below is my cuff command, I added freezing and unfreezing to it for you.

pawn Код:
new pCop[MAX_PLAYERS];
new pCuffed[MAX_PLAYERS];

CMD:cuff(playerid, params[])
{
    new tid, string[64], name[MAX_PLAYER_NAME];

    if(sscanf(params, "u", tid)) return SendClientMessage(playerid, -1, "/cuff [ID]");
    if(!IsPlayerConnected(tid)) return SendClientMessage(playerid, -1, "The ID you entered isn't connected to the server.");

    if(pCop[playerid] == 1)
    {
        if(pCuffed[tid] == 0)
        {
            pCuffed[tid] = 1; // set var
            TogglePlayerControllable(playerid, 0); // freeze

            format(string, sizeof(string), "You have cuffed %s.", GetPlayerName(tid, name, sizeof(name)) );
            SendClientMessage(playerid, -1, string);

            SetPlayerSpecialAction(tid, SPECIAL_ACTION_CUFFED);
            SetPlayerAttachedObject(tid, 7, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);

            format(string, sizeof(string), "Officer %s has just cuffed you.", GetPlayerName(playerid, name, sizeof(name)) );
            SendClientMessage(tid, -1, string);
        }
        else if(pCuffed[tid] == 1)
        {
            pCuffed[tid] = 0; // set var
            TogglePlayerControllable(playerid, 1); // unfreeze

            format(string, sizeof(string), "You have uncuffed %s.", GetPlayerName(tid, name, sizeof(name)) );
            SendClientMessage(playerid, -1, string);

            RemovePlayerAttachedObject(playerid, 7); // remove their attached object
            SetPlayerSpecialAction(playerid, SPECIAL_ACTION_NONE);

            format(string, sizeof(string), "Officer %s has just uncuffed you.", GetPlayerName(playerid, name, sizeof(name)) );
            SendClientMessage(tid, -1, string);
        }
        return 1;
    }
    else SendClientMessage(playerid, -1, "You are not a police officer.");
    return 1;
}
Reply
#4

Quote:
Originally Posted by Ciarannn
Посмотреть сообщение
I am aware of the new SPECIAL_ACTION_CUFFED, but could someone show me a way in which I can cuff another player, and freeze him? I have searched everywhere and cant find a way.

This is what I had: ((Yeh i'm new, and strcmp is all i know how to use.))

public OnPlayerCommandText(playerid, cmdtext[])
{
if (strcmp("/cuff", cmdtext, true, 10) == 0)
{
SetPlayerSpecialAction(playerid, SPECIAL_ACTION_CUFFED);
return 1;
}
return 0;
}

So basically, how can I apply this to another player like: /cuff PLAYERID and /uncuff PLAYERID. An how might I freeze them so they can't move their camera or player whilst cuffed.
You need sscanf ( https://sampforum.blast.hk/showthread.php?tid=120356 )
After that, do this ( i guess ):
pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cuff", cmdtext, true, 10) == 0)
    {
        new id;
        if(sscanf(params, "u", id)) return SendClientMessage(playerid, -1, "* USAGE - /cuff [ID]"); //sends message

    SetPlayerSpecialAction(id, SPECIAL_ACTION_CUFFED); //sets TARGETS animation/specialactiom
        TogglePlayerControllable(id,0); //freezes target
    return 1;
    }
    return 0;
}
not tested ;d
Reply
#5

ShaneOVSina, I used that but im not sure how to activate it? Whats the command? Is it just /cuff because thats not working?
Reply
#6

C:\Users\Ciaran\Desktop\cuff2.pwn(1) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Ciaran\Desktop\cuff2.pwn(2) : error 017: undefined symbol "MAX_PLAYERS"
C:\Users\Ciaran\Desktop\cuff2.pwn(46) : warning 203: symbol is never used: "cuff"
C:\Users\Ciaran\Desktop\cuff2.pwn(46) : error 013: no entry point (no public functions)
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


3 Errors.

I got this error when i used your command?
Reply
#7

Kyance, im getting an error when using that code?

C:\Users\Ciaran\Desktop\cuff3.pwn(95) : error 017: undefined symbol "params"
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#8

#include <a_samp> as your FIRST include, then sscanf/any other includes.
Reply
#9

Mionne, do I use that code as a filterscript or do I put it into my gamemode, because when I put #include sscanf2 in my gamemode, it won't run the server, it compiles grand, but when I start my server, I get a Runtime Error 19.
Reply
#10

Replied to your PM. (:
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)