Код:
dcmd_tempban(playerid,params[])
{
if(Player[playerid][pAdmin] < 1)
return 0; // idx
else
{
new tmp[256],tmp2[256],Index; tmp = strtok(params,Index), tmp2 = strtok(params,Index);
new tmp3[256];
tmp3 = strtok(params,Index);
if(!strlen(tmp)||!strlen(tmp2) || !strlen(tmp3))
return SendClientMessage(playerid,COR_USOCORRETO,"Uso: /tempban [id] [dias] [motivo]");
new id;
if(!IsNumeric(tmp))
id = ReturnPlayerID(tmp);
else
id = strval(tmp);
if(strval(tmp2) > 999)
return SendClientMessage(playerid, COR_ERRO, "ERRO: Mбximo de dias: 999");
if(Player[playerid][DelayBan] == true)
return SendClientMessage(playerid, COR_ERRO, "ERRO: Aguarde um instante para poder banir alguйm novamente.");
if(!IsPlayerConnected(id) && id != INVALID_PLAYER_ID)
return SendClientMessage(playerid,COR_ERRO,"ERRO: Jogador nгo conectado.");
else
{
BanExtend(playerid, id, params[strlen(tmp3)+strlen(tmp2)+2], strval(tmp2));
Player[playerid][DelayBan] = true;
SetTimerEx("TimerBan", 1000, 0, "i", playerid);
return 1;
}
}
}
Код:
forward BanExtend(playerid,id, reason[], days); //funзгo de ban
public BanExtend(playerid,id, reason[], days)
{
new reason[64];
if(Player[playerid][pAdmin] < 1)
return 0;
Server[Bans] += 1;
//if(strlen(reason) > 30 || InvalidBanCharacters(reason))
format(reason, strlen(reason),"N/A");
new string[256];
if(!days)
format(string, 256,"-GFInfo-: %s foi banido pelo %s %s | Motivo: %s",getPName(id), AccountName(playerid), getPName(playerid),reason);
else
format(string, 256,"-GFInfo-: %s foi banido pelo %s %s | Tempo: %d dias | Motivo: %s",getPName(id), AccountName(playerid), getPName(playerid), days, reason);
SendClientMessageToAll(COR_RED,string);
new playerip[24];
GetPlayerIp(id, playerip, sizeof(playerip));
new banfile[256];
banfile = GetBannedFile(id);
new hour, minute, second, day, month, year;
gettime(hour, minute, second);
getdate(year, month, day);
DOF2_CreateFile(banfile);
DOF2_SetString(banfile,"PlayerName", getPName(id));
if(days)
{
DOF2_SetInt(banfile,"BanTime", Now()+ONE_DAY*days);
DOF2_SetInt(banfile,"BanDays", days);
}
new str[52];
format(str,52,"Admin %s", getPName(playerid));
DOF2_SetString(banfile,"AdminName", str);
DOF2_SetString(banfile,"Motivo", reason);
format(string, sizeof(string), "%02d/%02d аs %02d:%02d", day, month, hour, minute);
DOF2_SetString(banfile,"Data", string);
DOF2_SaveFile();
if(Player[id][pLogged]) // se o jogador tiver uma conta
{
new banfile2[256];
format(banfile2,256,BANIDOS(getPName(id)));
DOF2_CreateFile(banfile2);
if(days)
{
DOF2_SetInt(banfile2,"BanTime", Now()+ONE_DAY*days);
DOF2_SetInt(banfile2,"BanDays", days);
}
DOF2_SetString(banfile2,"AdminName", str);
DOF2_SetString(banfile2,"Motivo", reason);
DOF2_SetString(banfile2,"Data", string);
DOF2_SaveFile();
}
SendClientMessage(id,COR_BARRAS,"-GF- Informaзхes importantes sobre o Ban:");
format(string, 128,"-GF- Nick: %s - Admin: %s - Motivo: %s", getPName(id), getPName(playerid), reason);
SendClientMessage(id, COR_ORANGE,string);
format(string, 128,"-GF- Data: %02d/%02d/%d - IP: %s (Salve Esses Dados)",day, month, year, playerip);
SendClientMessage(id, COR_ORANGE,string);
return Kick(id);
}