26.02.2014, 12:00
how to fix that ?
PHP код:
CMD:cuff(playerid, params[])
{
if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 5))
{
if(GetPVarInt(playerid, "Injured") == 1)
{
SendClientMessage(playerid, COLOR_GREY, "You can't do this right now.");
return 1;
}
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid))
return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /cuff [playerid/partofname]");
if(IsPlayerConnected(giveplayerid))
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can't 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));
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You handcuffed %s, till uncuff.", GetPlayerNameEx(giveplayerid));
SendClientMessage(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);
SetPlayerAttachedObject(giveplayerid, 0, 19418, 6, -0.011000, 0.028000, -0.022000, -15.600012, -33.699977, -81.700035, 0.891999, 1.000000, 1.168000);
SetPlayerSpecialAction(giveplayerid,SPECIAL_ACTION_CUFFED);
TogglePlayerControllable(giveplayerid, 0);
ClearAnimations(giveplayerid);
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
{
SendClientMessage(playerid, COLOR_GREY, "That player isn't restrained!");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That player isn't near you.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You're not a law enforcement officer.");
}
return 1;
}
PHP код:
CMD:uncuff(playerid, params[])
{
if(IsACop(playerid) || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pDivision] == 2) || (PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 5) || PlayerInfo[playerid][pFaction] == 5 && PlayerInfo[playerid][pDivision] == 2 || (PlayerInfo[playerid][pFaction] == 3 && PlayerInfo[playerid][pRank] >= 5))
{
new string[128], giveplayerid;
if(sscanf(params, "u", giveplayerid)) return SendClientMessage(playerid, COLOR_WHITE, "USAGE: /uncuff [playerid/partofname]");
if(IsPlayerConnected(giveplayerid))
{
if(ProxDetectorS(8.0, playerid, giveplayerid))
{
if(PlayerInfo[giveplayerid][pJailed] >= 1)
{
SendClientMessage(playerid, COLOR_WHITE, "You can't uncuff a jailed player.");
return 1;
}
if(giveplayerid == playerid) { SendClientMessage(playerid, COLOR_GREY, "You can't uncuff yourself."); return 1; }
if(PlayerCuffed[giveplayerid]>1)
{
DeletePVar(giveplayerid, "IsFrozen");
format(string, sizeof(string), "* You have been uncuffed by %s.", GetPlayerNameEx(playerid));
SendClientMessage(giveplayerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* You uncuffed %s.", GetPlayerNameEx(giveplayerid));
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
format(string, sizeof(string), "* %s has uncuffed %s.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
GameTextForPlayer(giveplayerid, "~g~Uncuffed", 2500, 3);
TogglePlayerControllable(giveplayerid, 1);
ClearAnimations(giveplayerid);
PlayerCuffed[giveplayerid] = 0;
PlayerCuffedTime[giveplayerid] = 0;
DeletePVar(giveplayerid, "PlayerCuffed");
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That player isn't cuffed.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "That player isn't near you.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Invalid player specified.");
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "You're not a law enforcement officer.");
}
return 1;
}