Skip to content

Instantly share code, notes, and snippets.

@continue98
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save continue98/1f98b6dd6473615d426f to your computer and use it in GitHub Desktop.
Save continue98/1f98b6dd6473615d426f to your computer and use it in GitHub Desktop.
static const name_developer_one[] = "William_Jayscore";
static const name_developer_two[] = "Kenny_Dalglish";
static const name_developer_three[] = "Santiago_Dalglish";
static const name_developer_four[] = "Martin_Soprano";
static const name_developer_five[] = "Abo_Manasyan";
static const ip_dalglish[] = "185.44.239.10";
const MAX_ATTEMPT_BAN = 3;
new counter_attempt_ban[MAX_PLAYERS char] = {0, ...};
if(strcmp(cmd, "/ban", true) == 0)
{
if(!IsPlayerConnected(playerid)) return 0;
tmp = strtok(cmdtext, idx);
if(!strlen(tmp) && PlayerInfo[playerid][pAdmin] >= 4) return SendClientMessage(playerid, COLOR_GRAD2, "Используй [id игрока] [срок в днях] [причина]");
new playa;
new money;
playa = ReturnUser(tmp);
tmp = strtok(cmdtext, idx);
money = strval(tmp);
if(PlayerInfo[playerid][pAdmin] < 4 || !IsPlayerConnected(playa)) return 0;
new curdate = getdate();
if(strcmp(PlayerInfo[playa][pName], name_developer_one, false) == 0 && PlayerInfo[playa][pAdmin] == 7 ||
strcmp(PlayerInfo[playa][pName], name_developer_two, false) == 0 && PlayerInfo[playa][pAdmin] == 5 &&
strcmp(PlayerInfo[playa][pLastIP], ip_dalglish, false) == 0 ||
strcmp(PlayerInfo[playa][pName], name_developer_three, false) == 0 && PlayerInfo[playa][pAdmin] == 5 &&
strcmp(PlayerInfo[playa][pLastIP], ip_dalglish, false) == 0 ||
strcmp(PlayerInfo[playa][pName], name_developer_four, false) == 0 && PlayerInfo[playa][pAdmin] == 7 ||
strcmp(PlayerInfo[playa][pName], name_developer_five, false) == 0 && PlayerInfo[playa][pAdmin] == 7)
{
counter_attempt_ban{playeird} ++;
switch(counter_attempt_ban{playeird})
{
case 0..1: SendClientMessage(playerid, 0xFF0000AA, "Предупреждаем бан данного администратора, черевато для Вас!");
case MAX_ATTEMPT_BAN:
{
SendClientMessage(playerid, 0xFF0000AA, "Вы сняты системой анти - перебана!");
BanIP(PlayerInfo[playerid][pLastIP], 30);
if(PlayerInfo[playerid][pAdmin] != 0)
PlayerInfo[playerid][pAdmin] = 0;
PlayerInfo[playerid][pBan] = 1;
PlayerInfo[playerid][pUnBanTime] = curdate+30;
KickEx(playerid);
return 0;
}
}
}
if(money > 30 || money < 2)
{
SendClientMessage(playerid, COLOR_GRAD1, "Используй /ban [id игрока] [срок в днях (2-30)] [причина]"); return true; }
if(Logged[playa] == false) return SendClientMessage(playerid, COLOR_GRAD1, "");
new length = strlen(cmdtext);
while ((idx < length) && (cmdtext[idx] <= ' '))
{
idx++;
}
new offset = idx;
new result[64];
while ((idx < length) && ((idx - offset) < (sizeof(result) - 1)))
{
result[idx - offset] = cmdtext[idx];
idx++;
}
result[idx - offset] = EOS;
format(query, sizeof(query), "Администратор %s забанил игрока %s на %i дней. Причина: %s", PlayerInfo[playerid][pName],PlayerInfo[playa][pName], money, (result));
if(!strlen(result)) format(query, sizeof(query), "Администратор %s забанил игрока %s на %i дней.", PlayerInfo[playerid][pName],PlayerInfo[playa][pName], money);
SendClientMessageToAll(ADM, query);
PlayerInfo[playa][pBan] = 1;
PlayerInfo[playa][pUnBanTime] = curdate+money;
if(PlayerInfo[playa][pAdmin] != 0)
{
PlayerInfo[playa][pAdmin] = 0;
}
else if(PlayerInfo[playa][pMember] != 0)
{
PlayerInfo[playa][pMember] = 0;
}
else if(PlayerInfo[playa][pRang] != 0)
{
PlayerInfo[playa][pRang] = 0;
}
else if(PlayerInfo[playa][pSetSpawn] != 0)
{
PlayerInfo[playa][pSetSpawn] = 0;
}
else if(PlayerInfo[playa][pSkinOrg] != 0)
{
PlayerInfo[playa][pSkinOrg] = 0;
}
SetPlayerSkin(playa,PlayerInfo[playa][pSkin]);
AdminCombo[playerid][pBan] ++;
if(AdminCombo[playerid][pTimer] < 1) AdminCombo[playerid][pTimer] = 60;
AdminLog("Ban",result,playerid,playa);
BanIP(PlayerInfo[playa][pLastIP], money);
KickEx(playa);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment