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;
}
|
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. |
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;
}