if(strcmp(cmd, "/prender", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(gTeam[playerid] == 2 || IsACop(playerid))
{
if(OnDuty[playerid] != 1 && PlayerInfo[playerid][pMember] == 1)
{
SendClientMessage(playerid, COLOR_GREY, " Voce nao esta em servico!");
return 1;
}
if(!IsPlayerinCela(playerid))
{// Jail spot
SendClientMessage(playerid, COLOR_GREY, " Voce nao esta perto das celas!");
return 1;
}
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /prender [ID] [Tempo (minutos)] [Fianca (0=nao 1=sim)] [Preco da Fianca]");
return 1;
}
new suspect = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /prender [ID] [Tempo (minutos)] [Fianca (0=nao 1=sim)] [Preco da Fianca]");
return 1;
}
new time = strval(tmp);
if(time < 1 || time > 20) { SendClientMessage(playerid, COLOR_GREY, " Tempo de prisao Minimo 1, Maximo 20!"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /prender [ID] [Tempo (minutos)] [Fianca (0=nao 1=sim)] [Preco da Fianca]");
return 1;
}
new bail = strval(tmp);
if(bail < 0 || bail > 1) { SendClientMessage(playerid, COLOR_GREY, " defina a fianзa 1 ou 0"); return 1; }
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "USE: /prender [ID] [Tempo (minutos)] [Fianca (0=nao 1=sim)] [Preco da Fianca]");
return 1;
}
new bailprice = strval(tmp);
if(bailprice < 0 || bailprice > 3000000) { SendClientMessage(playerid, COLOR_GREY, " Preco da fianca Minimo 1, Maximo 3000000!"); return 1; }
if(suspect != INVALID_PLAYER_ID)
{
if(IsPlayerConnected(suspect))
{
if(GetDistanceBetweenPlayers(playerid,suspect) < 5)
{
GetPlayerName(suspect, giveplayer, sizeof(giveplayer));
GetPlayerName(playerid, sendername, sizeof(sendername));
if(WantedLevel[suspect] < 1)
{
SendClientMessage(playerid, COLOR_GREY, " Jogador precisa de no minimo 1 nivel de procurado!");
return 1;
}
if(IsACop(suspect))
{
SendClientMessage(playerid, COLOR_GREY, " O Jogador й um Policial!");
return 1;
}
format(string, sizeof(string), "* Voce prendeu %s !", giveplayer);
SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
GivePlayerMoneyEx(suspect, -moneys);
format(string, sizeof(string), "Voce foi preso pelo %s ~n~ por $%d", sendername, moneys);
GameTextForPlayer(suspect, string, 5000, 5);
ResetPlayerWeapons(suspect);
if(PlayerInfo[playerid][pMember]==1 || PlayerInfo[playerid][pLeader]==1)
{
format(string, sizeof(string), "<< Policial Militar %s prendeu o suspeito %s >>", sendername, giveplayer);
OOCNews(COLOR_LIGHTRED, string);
PlayerInfo[suspect][pJailed] = 1;
}
else if(PlayerInfo[playerid][pMember]==2 || PlayerInfo[playerid][pLeader]==2)
{
format(string, sizeof(string), "<< R.O.T.A.M %s prendeu o suspeito %s >>", sendername, giveplayer);
OOCNews(COLOR_LIGHTRED, string);
PlayerInfo[suspect][pJailed] = 2;
}
else if(PlayerInfo[playerid][pMember]==3 || PlayerInfo[playerid][pLeader]==3)
{
format(string, sizeof(string), "<< G.I.R.O %s prendeu o suspeito %s >>", sendername, giveplayer);
OOCNews(COLOR_LIGHTRED, string);
PlayerInfo[suspect][pJailed] = 3;
}
PlayerInfo[suspect][pJailTime] = time * 60;
SpawnPlayer(suspect);
if(bail == 1)
{
JailPrice[suspect] = bailprice;
format(string, sizeof(string), "Voce foi preso por %d segundos. Fianca: $%d (/fianca)", PlayerInfo[suspect][pJailTime], JailPrice[suspect]);
SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
}
else
{
JailPrice[suspect] = 0;
format(string, sizeof(string), "Voce foi preso por %d segundos. Fianca: Desabilitada", PlayerInfo[suspect][pJailTime]);
SendClientMessage(suspect, COLOR_LIGHTBLUE, string);
}
PlayerInfo[suspect][pArrested] += 1;
SetPlayerFree(suspect,playerid, "Preso");
// WantedPoints[suspect] = 0;
WantedLevel[suspect] = 0;
SetPlayerWantedLevel(suspect, 0);
}//distance
else
{
SendClientMessage(playerid, COLOR_GREY, " Ninguem perto para voce prender.");
return 1;
}
}//not connected
}// invalid playerid
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Voce nao e um oficial!");
return 1;
}
}//not connected
return 1;
}
|