01.12.2010, 19:54
(
Последний раз редактировалось Mokerr; 02.12.2010 в 09:20.
)
pawn Код:
if(strcmp(cmd, "/cuff", true) == 0)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, "USAGE: /cuff [playerid]");
}
giveplayerid = strval(tmp);
new Float:x, Float:y, Float:z;
GetPlayerPos(playerid, x, y, z);
if(gTeam[playerid] == TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] == TEAM_ARMY && PlayerInfo[playerid][pRank] == 2)
{
if(giveplayerid == playerid)
{
SendClientMessage(playerid, COLOR_RED, "You cannot cuff yourself!");
return 1;
}
if (ProxDetectorS(7.5, playerid, giveplayerid))
{
if(gTeam[playerid] == TEAM_COP && PlayerInfo[playerid][pRank] == 1 || gTeam[playerid] == TEAM_ARMY && PlayerInfo[playerid][pRank] == 2 && IsPlayerAdmin(playerid) || PlayerInfo[playerid][pAdmin] >= 104)
{
format(string, sizeof(string), "Officer %s has cuffed (suspect) %s", PlayerName[playerid], PlayerName[giveplayerid]);
SendClientMessageToAll(COLOR_BLUE, string);
TogglePlayerControllable(giveplayerid, false);
return 1;
}
else
{
SendClientMessage(playerid, COLOR_RED, "You could not cuff an officer that follows the law to.");
}
}
else
{
SendClientMessage(playerid, COLOR_RED, "That playerid is not close (enough) to you!");
}
}
else
{
SendClientMessage(playerid, COLOR_RED,"You are not a part of the cops team.");
}
return 1;
}
pawn Код:
forward ProxDetectorS(Float:radi, playerid, targetid);
pawn Код:
public ProxDetectorS(Float:radi, playerid, targetid)
{
if(IsPlayerConnected(playerid)&&IsPlayerConnected(targetid))
{
new Float:posx, Float:posy, Float:posz;
new Float:oldposx, Float:oldposy, Float:oldposz;
new Float:tempposx, Float:tempposy, Float:tempposz;
GetPlayerPos(playerid, oldposx, oldposy, oldposz);
GetPlayerPos(targetid, posx, posy, posz);
tempposx = (oldposx -posx);
tempposy = (oldposy -posy);
tempposz = (oldposz -posz);
if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
{
return 1;
}
}
return 0;
}