Код:
if(strcmp(cmd, "/arrest", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || gTeam[playerid] == 3)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /arrest [playerid/PartOfName] [minutes]");
return 1;
}
GetPlayerName(giveplayerid, giveplayer, sizeof(giveplayer));
new time = strval(tmp);
if(time < 1 || time > 60) { SendClientMessage(playerid, COLOR_GREY, " Arrest time can not be over 60 minutes or lower than 1."); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GREY, " USAGE: /arrest [playerid/PartOfName] [minutes]");
return 1;
}
if(GetDistanceBetweenPlayers(playerid,giveplayerid) > 5)
{
if(PlayerToPoint(3.0, playerid, 645.6984,-613.6818,16.3396))
{
format(string, sizeof(string), "~r~You have been imprisoned in Los Santos Prison for %d minutes", time);
GameTextForPlayer(giveplayerid, string, 3000, 5);
SetPlayerPos(giveplayerid, 268.3327,77.8972,1001.0391);
GivePlayerMoney(giveplayerid, -5000);
}
else if(PlayerToPoint(3.0, playerid, 268.3327,77.8972,1001.0391))
{
format(string, sizeof(string), "~r~You have been arrested in the Police Department for %d minutes", time);
GameTextForPlayer(giveplayerid, string, 3000, 5);
GivePlayerMoney(giveplayerid, -3000);
}
ResetPlayerWeapons(giveplayerid);
PlayerInfo[giveplayerid][pJailTime] = time * 60;
}
}
}
return 1;
}
As a cop gTeam[playerid] == 2 and gTeam[playerid] == 3 you should walk into a PlayerToPoint and type /arrest [id] [minutes] and the giveplayerid should be teleported to a prison cell and be relesed after the given minutes.