08.12.2012, 21:48
pawn Код:
if(strcmp(cmd, "/detain", true) == 0)
new seat;
{
if(IsPlayerConnected(playerid))
{
if(IsACop(playerid) || IsAFreecop(playerid))
{
tmp = strtok(cmdtext, idx, seat);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USAGE: /detain [playerid/PartOfName] [seatid]");
return 1;
}
if(seat < 1 || seat > 3)
{
SendClientMessage(playerid, COLOR_GRAD1, "The seat ID cannot be above 3 or below 1.");
return 1;
}
if(PlayerInfo[playerid][pDBanned] == 1)
{
SendClientMessage(playerid, COLOR_GREY, "** You are Banned From Cop Duty!");
return 1;
}
new newcar = gLastCar[playerid];
new playa;
playa = ReturnUser(tmp);
if(IsACopCar(newcar) || IsNgCar(newcar) || IsAnFbiCar(newcar))
{
if(IsPlayerConnected(playa))
{
if(playa != INVALID_PLAYER_ID)
{
if(PlayerCuffed[giveplayerid] = 1)
{
new Float:x, Float:y, Float:z;
GetPlayerPos(playa,x,y,z);
if(IsPlayerInRangeOfPoint(playerid, 5, x, y, z))
{
PutPlayerInVehicle(playa, newcar, seat);
GetPlayerName(playa, giveplayer, sizeof(giveplayer));
format(string, sizeof(string), "* %s throws %s in the vehicle.", sendername ,giveplayer);
ProxDetector(30.0, playerid, string, COLOR_CHAT1,COLOR_CHAT2,COLOR_CHAT3,COLOR_CHAT4,COLOR_CHAT5);
new y1, m, d;
new h,mi,s;
getdate(y1,m,d);
gettime(h,mi,s);
TogglePlayerControllable(giveplayerid, 0);
GameTextForPlayer(giveplayerid, "~r~Detained", 2500, 3);
format(string,sizeof(string), "(%d/%d/%d)[%d:%d:%d] %s [CMD] -> /detain %s",d,m,y1,h,mi,s,sendername,giveplayer);
CommandLog(string);
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Player is not near you.");
}
}
else
{
SendClientMessage(playerid, COLOR_GREY, "Player isn't cuffed.");
}
}
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not in police vehicle!");
}
}
else
{
SendClientMessage(playerid, COLOR_GRAD1, "You are not a cop!");
return 1;
}
}
return 1;
}
Thanks