12.03.2014, 21:23
pawn Код:
stock Float:GetDistanceBetweenPlayers(p1,p2)
{
new Float:x1,Float:y1,Float:z1,Float:x3,Float:y3,Float:z3;
if (!IsPlayerConnected(p1) || !IsPlayerConnected(p2))
{
return -1.00;
}
GetPlayerPos(p1,x1,y1,z1);
GetPlayerPos(p2,x3,y3,z3);
return floatsqroot(floatpower(floatabs(floatsub(x3,x1)),2)+floatpower(floatabs(floatsub(y3,y1)),2)+floatpower(floatabs(floatsub(z3,z1)),2));
}
CMD:cuff(playerid, params[])
{
new string[128], targetid;
if(IsCop[playerid] == false) return SendClientMessage(playerid, COLOR_WHITE, "Error: Only Cops can use this command");
if(sscanf(params, "u", targetid))return SendClientMessage(playerid, COLOR_WHITE, "Usage: /cuff [playerid/name]");
if(!IsPlayerConnected(targetid))return SendClientMessage(playerid, COLOR_WHITE, "Error: This player is not Connected!");
if(targetid == playerid) return SendClientMessage(playerid,COLOR_WHITE,"Error: You cannot cuff yourself!");
if(GetDistanceBetweenPlayers(playerid,targetid) > 3) return SendClientMessage(playerid, COLOR_WHITE, "Error: You are not close enough to this player!");
if(Cuffed[targetid] == 1) return SendClientMessage(playerid, COLOR_WHITE, "Error: This Player Is Already Handcuffed.");
SetPlayerSpecialAction(targetid, SPECIAL_ACTION_CUFFED);
ApplyAnimation(targetid,"ped","WEAPON_crouch",4.1,1,0,0,0,0,1);
Cuffed[targetid] = 1;
return 1;
}