Код:
if(strcmp(cmd, "/unjail",true)==0)
{
new tmp[256];
if(PlayerInfo[playerid][power] >= 1 || PlayerInfo[playerid][playerteam]==SASF || PlayerInfo[playerid][playerteam]==COPS)
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientUsage(playerid, cmd, "[Name/ID]");
return 1;
}
if(!IsNumeric(tmp) && (PlayerID(tmp)==-2 || PlayerID(tmp)==-1))
{
SendClientError(playerid, "Error: Not found. Invalid part of name or more than one result");
return 1;
}
if(!IsNumeric(tmp) && PlayerID(tmp)>=0) giveplayerid = PlayerID(tmp);
if(IsNumeric(tmp)) giveplayerid = strval(tmp);
if(!IsPlayerConnected(giveplayerid))
{
SendClientError(playerid, "Not found or not online");
return 1;
}
if(giveplayerid==playerid && PlayerInfo[playerid][power]==0)
{
SendClientError(playerid, "You can't unjail yourself");
return 1;
}
if(PlayerInfo[giveplayerid][bail]==777 && PlayerInfo[playerid][power]==0)
{
SendClientWarning(playerid, "You can't unjail him, he's jailed by an admin");
return 1;
}
if(PlayerInfo[playerid][power]>0 || (IsPlayerInSphere(playerid,193.41,175.51,1003.02,6) && IsPlayerInSphere(giveplayerid,193.41,175.51,1003.02,6)))
{
if(PlayerInfo[giveplayerid][jail]) UnJail(giveplayerid);
else
{
SendClientWarning(playerid, "Given player isnt jailed");
return 1;
}
}
return 1;
}
return 1;
}