13.01.2018, 08:59
This is the cuff CMD in my script
What do I need to change here in order to allow a player to move while cuffed?
PHP код:
CMD:cuff(playerid, params[])
{
if(IsACop(playerid))
{
if(GetPVarInt(playerid, "Injured") == 1 || PlayerCuffed[ playerid ] >= 1 || PlayerInfo[ playerid ][ pJailTime ] > 0 || PlayerInfo[playerid][pHospital] > 0)
{
SendClientMessageEx(playerid, COLOR_GREY, "You can't do this right now.");
return 1;
}
if(PlayerInfo[playerid][pHasCuff] < 1)
{
SendClientMessageEx(playerid, COLOR_WHITE, "You do not have any pair of cuffs on you!");
return 1;
}
new string[128], giveplayerid, Float:health, Float:armor;
if(sscanf(params, "u", giveplayerid)) return SendClientMessageEx(playerid, COLOR_GREY, "USAGE: /cuff [player]");
if(IsPlayerConnected(giveplayerid))
{
if (ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessageEx(playerid, COLOR_GREY, "You cannot cuff yourself!"); return 1; }
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, 0);
ClearAnimations(giveplayerid);
GetPlayerHealth(giveplayerid, health);
GetPlayerArmour(giveplayerid, armor);
SetPVarFloat(giveplayerid, "cuffhealth",health);
SetPVarFloat(giveplayerid, "cuffarmor",armor);
SetPlayerSpecialAction(giveplayerid, SPECIAL_ACTION_CUFFED);
ApplyAnimation(giveplayerid,"ped","cower",1,1,0,0,0,0,1);
PlayerCuffed[giveplayerid] = 2;
SetPVarInt(giveplayerid, "PlayerCuffed", 2);
SetPVarInt(giveplayerid, "IsFrozen", 1);
//Frozen[giveplayerid] = 1;
PlayerCuffedTime[giveplayerid] = 300;
}
else if(GetPVarType(giveplayerid, "IsTackled"))
{
format(string, sizeof(string), "* %s removes a set of cuffs from his belt and attempts to cuff %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
SetTimerEx("CuffTackled", 4000, 0, "ii", playerid, giveplayerid);
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That person isn't restrained!");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "That person isn't near you.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
}
else
{
SendClientMessageEx(playerid, COLOR_GREY, "You're not a law enforcement officer.");
}
return 1;
}