Правила форума Гаранты форума
Размещение рекламы AMX-X компилятор

Здравствуйте, гость Вход | Регистрация

Наши новости:

14-дек
24-апр
10-апр
11-апр

> Правила форума

В данном разделе обсуждаются вопросы, связанные с клиентской частью. Темы не относящиеся к тематике раздела будут перемещены или удалены, а авторы наказаны.
При создании темы кратко опишите проблему в ее названии! Темы с названиями "Как сделать?", "Помогите", "Вопрос" и т.п. будут удалятся!

voteban+superban

Статус пользователя HONDA
сообщение 9.11.2011, 2:51
Сообщение #1
Стаж: 15 лет

Сообщений: 282
Благодарностей: 44
Полезность: 141

Ребят помогите скрестить эти два плагина,нашел тему здесь но что то не банит.
sma
код
Код
#include <amxmodx>
#include <amxmisc>

#define MAX_players 32
#define MAX_menudata 1024

new ga_PlayerName[MAX_players][32]
new ga_PlayerAuthID[MAX_players][35]
new ga_PlayerID[MAX_players]
new ga_PlayerIP[MAX_players][16]
new ga_MenuData[MAX_menudata]
new ga_Choice[2]
new gi_VoteStarter
new gi_MenuPosition
new gi_Sellection
new gi_TotalPlayers
new gi_SysTimeOffset = 0
new i
//pcvars
new gi_LastTime
new gi_DelayTime
new gf_Ratio
new gf_MinVoters
new gf_BF_Ratio
new gi_BanTime
new gi_Disable
new gi_BanType


public plugin_init()
{
  register_plugin("Voteban Menu Rus","1.2","hjvl & Maksovich")
  register_clcmd("say /voteban","SayIt")
  register_clcmd("say voteban","SayIt")
  register_clcmd("say /vtb","SayIt")
  register_clcmd("say vtb","SayIt")
  register_menucmd(register_menuid("ChoosePlayer"), 1023, "ChooseMenu")
  register_menucmd(register_menuid("VoteMenu"), 1023, "CountVotes")

  gi_LastTime=register_cvar("amx_voteban_lasttime","0")
  gi_DelayTime=register_cvar("amxx_voteban_delaytime","600")
  gf_Ratio=register_cvar("amxx_voteban_ratio","0.50")
  gf_MinVoters=register_cvar("amxx_voteban_minvoters","0.0")
  gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","0.0")
  gi_BanTime=register_cvar("amxx_voteban_bantime","5")
  gi_Disable=register_cvar("amxx_voteban_disable","0")
  gi_BanType=register_cvar("amxx_voteban_type","2")
}

public SayIt(id)
{
  if(get_pcvar_num(gi_Disable))
  {
    client_print(id,print_chat,"[VTB] Голосование отключено.")
    return 0
  }

  new Elapsed=get_systime(gi_SysTimeOffset) - get_pcvar_num(gi_LastTime)
  new Delay=get_pcvar_num(gi_DelayTime)

  if( (Delay > Elapsed) && !is_user_admin(id) )
  {
    new seconds = Delay - Elapsed
    client_print(id,print_chat,"Вы должны подождать %d секунд до нового голосования.", seconds)
    return 0
  }

  get_players( ga_PlayerID, gi_TotalPlayers )
  for(i=0; i<gi_TotalPlayers; i++)
  {
    new TempID = ga_PlayerID[i]
    if( is_user_admin(TempID))
    {
      if(!is_user_admin(id))
      {
        client_print(id,print_chat,"Администратор на сервере, голосование отключено!")
        return 0
      }
    }

    if(TempID == id)
      gi_VoteStarter=i

    get_user_name( TempID, ga_PlayerName[i], 31 )
    get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
    get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
  }

  gi_MenuPosition = 0
  ShowPlayerMenu(id)
  return 0
}

public ShowPlayerMenu(id)
{
  new arrayloc = 0
  new keys = (1<<9)

  arrayloc = format(ga_MenuData,(MAX_menudata-1),"Голосование за БАН ^n")
  for(i=0; i<8; i++)
   if( gi_TotalPlayers>(gi_MenuPosition+i) )
   {
     arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
     keys |= (1<<i)
   }
  if( gi_TotalPlayers>(gi_MenuPosition+8) )
  {
    arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. Дальше")
    keys |= (1<<8)
  }
  arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. Назад/Выход")

  show_menu(id, keys, ga_MenuData, 20, "ChoosePlayer")
  return PLUGIN_HANDLED
}

public ChooseMenu(id, key)
{
  switch(key)
  {
    case 8:
    {
      gi_MenuPosition=gi_MenuPosition+8
      ShowPlayerMenu(id)
    }
    case 9:
    {
      if(gi_MenuPosition>=8)
      {
        gi_MenuPosition=gi_MenuPosition-8
        ShowPlayerMenu(id)
      }
      else
        return 0
    }
    default:
    {
      gi_Sellection=gi_MenuPosition+key
      new Now=get_systime(gi_SysTimeOffset)
      set_pcvar_num(gi_LastTime, Now)

      run_vote()
      return 0
    }
  }
  return PLUGIN_HANDLED
}

public run_vote()
{
  log_amx("Голосование запустил %s за %s %s", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
  format(ga_MenuData,(MAX_menudata-1),"Забанить %s на %d минут?^n1. Да^n2. Нет",ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
  ga_Choice[0] = 0
  ga_Choice[1] = 0
  show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteMenu" )
  set_task(15.0,"outcom")
  return 0
}

public CountVotes(id, key)
{
  ++ga_Choice[key]
  return PLUGIN_HANDLED
}

public outcom()
{
  new TotalVotes = ga_Choice[0] + ga_Choice[1]
  new Float:result = (float(ga_Choice[0]) / float(TotalVotes))

  if( get_pcvar_float(gf_MinVoters) >= ( float(TotalVotes) / float(gi_TotalPlayers) ) )
  {
    client_print(0,print_chat,"Для голосования нехватает %s игрока!", ga_PlayerName[gi_Sellection])
    return 0
  }
  else
  {
    if( result < get_pcvar_float(gf_BF_Ratio) )
    {
      client_print(0,print_chat,"Голосование не состоялось, инициатор %s забанен на %d минут.", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
      ActualBan(gi_VoteStarter)
      log_amx("Голосование не состоялось, инициатор %s забанен на %d минут.", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
    }

    if( result >= get_pcvar_float(gf_Ratio) )
    {
      client_print(0,print_chat,"Голосование окончено, %s забанен на %d минут.", ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
      log_amx("Голосование окончено, %s забанен на %d минут.", ga_PlayerAuthID[gi_Sellection], get_pcvar_num(gi_BanTime))
      ActualBan(gi_Sellection)
    }
    else
    {
      client_print(0,print_chat,"Голосование не состоялось!")
      log_amx("Голосование не состоялось!")
    }
  }
  client_print(0,print_chat,"Всего %d игроков, %d сказали ДА.", gi_TotalPlayers, ga_Choice[0])

  return 0
}

public ActualBan(Selected)
{
  new Type = get_pcvar_num(gi_BanType)
  switch(Type)
  {
    case 1:
      server_cmd("addip %d %s", get_pcvar_num(gi_BanTime), ga_PlayerIP[Selected])
    case 2:
      server_cmd("amx_ban %d %s Voteban", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
    default:
      server_cmd("banid %d %s kick", get_pcvar_num(gi_BanTime), ga_PlayerAuthID[Selected])
  }
  return 0
}

!
Предупреждение:
Большой текст нужно убирать в спойлер


Отредактировал: balaban, - 10.11.2011, 16:31
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
Статус пользователя Zero
сообщение 9.11.2011, 14:02
Сообщение #2


Стаж: 15 лет

Сообщений: 848
Благодарностей: 290
Полезность: 591

Супербан с мэйкссервера ? :)

P.S когда покупал Гудвин сразу скидывал вотебан
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя HONDA
сообщение 9.11.2011, 15:03
Сообщение #3
Стаж: 15 лет

Сообщений: 282
Благодарностей: 44
Полезность: 141

Цитата(Gangster. @ 9.11.2011, 15:02) *
Супербан с мэйкссервера ? :)

P.S когда покупал Гудвин сразу скидывал вотебан

ты дурачек что ли?лицензия на два сервера мне он нечего не скидывал
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Zero
сообщение 9.11.2011, 17:06
Сообщение #4


Стаж: 15 лет

Сообщений: 848
Благодарностей: 290
Полезность: 591

Лови :)

вотебан под супербан

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "Vote Ban"
#define VERSION "1.0"
#define AUTHOR "Alka"

#define MAX_PLAYERS 33

#define MENU_KEYS (1<<0 | 1<<1 | 1<<2 | 1<<3 | 1<<4 | 1<<5 | 1<<6 | 1<<7 | 1<<8 | 1<<9)
#define MENU_SLOTS 8

new g_iMenuPage[MAX_PLAYERS];
new g_iVotedPlayers[MAX_PLAYERS];
new g_iVotes[MAX_PLAYERS];

new g_iPlayers[MAX_PLAYERS - 1];
new g_iNum;

new g_iMsgidSayText;

enum {
CVAR_PERCENT = 0,
CVAR_BANTYPE,
CVAR_BANTIME
};
new g_szCvarName[][] = {
"voteban_percent",
"voteban_type",
"voteban_time"
};
new g_szCvarValue[][] = {
"80",
"1",
"100"
};
new g_iPcvar[3];
new g_szLogFile[64];

public plugin_init() {

register_plugin(PLUGIN, VERSION, AUTHOR);

register_saycmd("voteban", "Cmd_VoteBan", -1, "");

register_menucmd(register_menuid("\rVOTEBAN \yMenu:"), MENU_KEYS, "Menu_VoteBan");

for(new i = 0 ; i < 3 ; i++)
{
g_iPcvar[i] = register_cvar(g_szCvarName[i], g_szCvarValue[i]);
}
g_iMsgidSayText = get_user_msgid("SayText");

new szLogInfo[] = "amx_logdir";
get_localinfo(szLogInfo, g_szLogFile, charsmax(g_szLogFile));
add(g_szLogFile, charsmax(g_szLogFile), "/voteban");

if(!dir_exists(g_szLogFile))
mkdir(g_szLogFile);

new szTime[32];
get_time("%d-%m-%Y", szTime, charsmax(szTime));
format(g_szLogFile, charsmax(g_szLogFile), "%s/%s.log", g_szLogFile, szTime);
}

public client_disconnect(id)
{
if(g_iVotedPlayers[id])
{
get_players(g_iPlayers, g_iNum, "h");

for(new i = 0 ; i < g_iNum ; i++)
{
if(g_iVotedPlayers[id] & (1 << g_iPlayers[i]))
{
g_iVotes[g_iPlayers[i]]--;
}
}
g_iVotedPlayers[id] = 0;
}
}

public Cmd_VoteBan(id)
{
get_players(g_iPlayers, g_iNum, "h");

if(g_iNum < 3)
{
client_printc(id, "\g> \dDaHHa9 komaHga HegocTynHa. Hy)I(Ho He meHee 3 urpokoB!");
return PLUGIN_HANDLED;
}
ShowBanMenu(id, g_iMenuPage[id] = 0);
return PLUGIN_CONTINUE;
}

public ShowBanMenu(id, iPos)
{
static i, iPlayer, szName[32];
static szMenu[1024], iCurrPos; iCurrPos = 0;
static iStart, iEnd; iStart = iPos * MENU_SLOTS;
static iKeys;

get_players(g_iPlayers, g_iNum, "h");

if(iStart >= g_iNum)
{
iStart = iPos = g_iMenuPage[id] = 0;
}

static iLen;
iLen = formatex(szMenu, charsmax(szMenu), "\rVOTEBAN \yMenu:^n^n");

iEnd = iStart + MENU_SLOTS;
iKeys = MENU_KEY_0;

if(iEnd > g_iNum)
{
iEnd = g_iNum;
}

for(i = iStart ; i < iEnd ; i++)
{
iPlayer = g_iPlayers[i];
get_user_name(iPlayer, szName, charsmax(szName));

iKeys |= (1 << iCurrPos++);
iLen += formatex(szMenu[iLen], charsmax(szMenu) - iLen, "\r%d\w.%s \d(\r%d%%\d)^n", iCurrPos, szName, get_percent(g_iVotes[iPlayer], g_iNum));
}

if(iEnd != g_iNum)
{
formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r9\w.Bnepeg^n\r0\w.%s", iPos ? "Ha3ag" : "BbIxog");
iKeys |= MENU_KEY_9;
}
else
{
formatex(szMenu[iLen], charsmax(szMenu) - iLen, "^n\r0\w.%s", iPos ? "Ha3ag" : "BbIxog");
}
show_menu(id, iKeys, szMenu, -1, "");
return PLUGIN_HANDLED;
}

public Menu_VoteBan(id, key)
{
switch(key)
{
case 8:
{
ShowBanMenu(id, ++g_iMenuPage[id]);
}
case 9:
{
if(!g_iMenuPage[id])
return PLUGIN_HANDLED;

ShowBanMenu(id, --g_iMenuPage[id]);
}
default: {
static iPlayer;
iPlayer = g_iPlayers[g_iMenuPage[id] * MENU_SLOTS + key];

if(!is_user_connected(iPlayer))
{
ShowBanMenu(id, g_iMenuPage[id]);
return PLUGIN_HANDLED;
}
if(iPlayer == id)
{
client_print(id, print_center, "HeJIb39 3a6aHuTb camoro ce69!");
ShowBanMenu(id, g_iMenuPage[id]);

return PLUGIN_HANDLED;
}
if(g_iVotedPlayers[id] & (1 << iPlayer))
{
client_print(id, print_center, "BbI y)I(e nporoJIocoBaJIu 3a gaHHoro urpoka");
ShowBanMenu(id, g_iMenuPage[id]);

return PLUGIN_HANDLED;
}
g_iVotes[iPlayer]++;
g_iVotedPlayers[id] |= (1 << iPlayer);

static szName[2][32];
get_user_name(id, szName[0], charsmax(szName[]));
get_user_name(iPlayer, szName[1], charsmax(szName[]));

client_printc(0, "\g> \dUrpok \t%s \dnporoJIocoBaJI 3a 6aH \t%s\d!", szName[0], szName[1]);

CheckVotes(iPlayer, id);

ShowBanMenu(id, g_iMenuPage[id]);
}
}
return PLUGIN_HANDLED;
}

public CheckVotes(id, voter)
{
get_players(g_iPlayers, g_iNum, "h");
new iPercent = get_percent(g_iVotes[id], g_iNum);
new szName[2][32];
get_user_name(id, szName[0], charsmax(szName[]));
get_user_name(voter, szName[1], charsmax(szName[]));

if(iPercent >= get_pcvar_num(g_iPcvar[CVAR_PERCENT]))
{
switch(get_pcvar_num(g_iPcvar[CVAR_BANTYPE]))
{
case 1:
{
new szAuthid[32];
get_user_authid(id, szAuthid, charsmax(szAuthid));
server_cmd("amx_superban #%d %d roJIocoBaHue", get_user_userid(id), get_pcvar_num(g_iPcvar[CVAR_BANTIME]));
}
case 2:
{
new szIp[32];
get_user_ip(id, szIp, charsmax(szIp), 1);
server_cmd("amx_superban #%d %d roJIocoBaHue", get_user_userid(id), get_pcvar_num(g_iPcvar[CVAR_BANTIME]));
}
}
g_iVotes[id] = 0;

client_printc(0, "\g> \dUrpok \t%s \d3a6aHeH Ha \g%d\d muH. 6oJIwuHcTBom roJIocoB!", szName[0], get_pcvar_num(g_iPcvar[CVAR_BANTIME]));
log_to_file(g_szLogFile, "Player '%s' banned", szName[0]);
}
log_to_file(g_szLogFile, "Player '%s' voted for banning '%s'", szName[1], szName[0]);
}

stock get_percent(value, tvalue)
{
return floatround(floatmul(float(value) / float(tvalue) , 100.0));
}

stock register_saycmd(saycommand[], function[], flags = -1, info[])
{
static szTemp[64];
formatex(szTemp, charsmax(szTemp), "say %s", saycommand);
register_clcmd(szTemp, function, flags, info);
formatex(szTemp, charsmax(szTemp), "say_team %s", saycommand);
register_clcmd(szTemp, function, flags, info);
formatex(szTemp, charsmax(szTemp), "say /%s", saycommand);
register_clcmd(szTemp, function, flags, info);
formatex(szTemp, charsmax(szTemp), "say .%s", saycommand);
register_clcmd(szTemp, function, flags, info);
formatex(szTemp, charsmax(szTemp), "say_team /%s", saycommand);
register_clcmd(szTemp, function, flags, info);
formatex(szTemp, charsmax(szTemp), "say_team .%s", saycommand);
register_clcmd(szTemp, function, flags, info);
}

stock client_printc(id, const text[], any:...)
{

new szMsg[191], iPlayers[32], iCount = 1;
vformat(szMsg, charsmax(szMsg), text, 3);

replace_all(szMsg, charsmax(szMsg), "\g","^x04");
replace_all(szMsg, charsmax(szMsg), "\d","^x01");
replace_all(szMsg, charsmax(szMsg), "\t","^x03");

if(id)
iPlayers[0] = id;
else
get_players(iPlayers, iCount, "ch");

for(new i = 0 ; i < iCount ; i++)
{
if(!is_user_connected(iPlayers[i]))
continue;

message_begin(MSG_ONE_UNRELIABLE, g_iMsgidSayText, _, iPlayers[i]);
write_byte(iPlayers[i]);
write_string(szMsg);
message_end();
}
}



Отредактировал: Gangster., - 9.11.2011, 17:07
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Статус пользователя HONDA
сообщение 9.11.2011, 22:31
Сообщение #5
Стаж: 15 лет

Сообщений: 282
Благодарностей: 44
Полезность: 141

спасибо большое

Отредактировал: san4o703, - 9.11.2011, 22:31
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя HONDA
сообщение 10.11.2011, 16:24
Сообщение #6
Стаж: 15 лет

Сообщений: 282
Благодарностей: 44
Полезность: 141

Цитата(san4o703 @ 9.11.2011, 23:31) *
спасибо большое

Gangster,а как сделать что бы через мой вотебан,банил супербан?
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя Zero
сообщение 11.11.2011, 5:47
Сообщение #7


Стаж: 15 лет

Сообщений: 848
Благодарностей: 290
Полезность: 591

Gangster,а как сделать что бы через мой вотебан,банил супербан?
Попробуй изменить

Код
server_cmd("addip %d %s", get_pcvar_num(gi_BanTime), ga_PlayerIP[Selected])


На


Код
server_cmd("amx_superban #%d %d roJIocoBaHue", get_user_userid(id), get_pcvar_num(g_iPcvar[CVAR_BANTIME]));


И поставить в амхх.cfg

amx_voteban_type 1

Я не скриптер, попробуй, вроде бы должно так работать
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
Статус пользователя nranis
сообщение 10.2.2014, 22:18
Сообщение #8
Стаж: 12 лет

Сообщений: 37
Благодарностей: 3
Полезность: 63

вот исходник вотебана. работает только с супербан
Скрытый текст
#include <amxmodx>
#include <amxmisc>
#include <colorchat>

#define MAX_players 32
#define MAX_menudata 1024

new ga_PlayerName[MAX_players][32]
new ga_PlayerAuthID[MAX_players][35]
new ga_PlayerID[MAX_players]
new ga_PlayerIP[MAX_players][16]
new ga_MenuData[MAX_menudata]
new ga_Choice[2]
new gi_VoteStarter
new gi_MenuPosition
new gi_Sellection
new gi_TotalPlayers
new gi_SysTimeOffset = 0
new i
//pcvars
new gi_LastTime
new gi_DelayTime
new gf_Ratio
new gf_MinVoters
new gf_BF_Ratio
new gi_BanTime
new gi_Disable
new gi_BanReason
new banReasonCvar[32]


public plugin_init()
{
register_plugin("voteban menu","1.2","hjvl")
register_clcmd("say /voteban","SayIt" )
register_clcmd("say voteban","SayIt" )
register_clcmd("say /vtb","SayIt" )
register_clcmd("say vtb","SayIt" )
register_clcmd("say_team /voteban","SayIt" )
register_clcmd("say_team /vtb","SayIt" )
register_clcmd("say_team /vtb","SayIt" )
register_clcmd("say_tam voteban","SayIt" )
register_menucmd(register_menuid("ChoosePlayer"), 1023, "ChooseMenu")
register_menucmd(register_menuid("VoteMenu"), 1023, "CountVotes")

gi_LastTime=register_cvar("amx_voteban_lasttime","0")
gi_DelayTime=register_cvar("amxx_voteban_delaytime","600")
gf_Ratio=register_cvar("amxx_voteban_ratio","0.50")
gf_MinVoters=register_cvar("amxx_voteban_minvoters","0.0")
gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","0.0")
gi_BanTime=register_cvar("amxx_voteban_bantime","5")
gi_Disable=register_cvar("amxx_voteban_disable","0")
gi_BanReason=register_cvar("amxx_voteban_reason","VoteBan")
}

public SayIt(id)
{
if(get_pcvar_num(gi_Disable))
{
ColorChat(id, RED, "^x01[^x04Сервер^x01] ^x03 VoteBan выключен на сервере!")
return 0
}

new Elapsed=get_systime(gi_SysTimeOffset) - get_pcvar_num(gi_LastTime)
new Delay=get_pcvar_num(gi_DelayTime)

if( (Delay > Elapsed) && !is_user_admin(id) )
{
new seconds = Delay - Elapsed
ColorChat(id, RED, "^x01[^x04Сервер^x01] ^x01 Подождите ^x03 %d секунд ^x01 до следующего голосования за бан игрока!", seconds)
return 0
}

get_players( ga_PlayerID, gi_TotalPlayers )
for(i=0; i<gi_TotalPlayers; i++)
{
new TempID = ga_PlayerID[i]
if( is_user_admin(TempID))
{
if(!is_user_admin(id))
{
client_print(id,print_chat,"^x01[^x04Сервер^x01] ^x01 На сервере присутствует ^x04 Администрация! ^x01 Voteban ^x03 [выключен]")
return 0
}
}

if(TempID == id)
gi_VoteStarter=i

get_user_name( TempID, ga_PlayerName[i], 31 )
get_user_authid( TempID, ga_PlayerAuthID[i], 34 )
get_user_ip( TempID, ga_PlayerIP[i], 15, 1 )
}

gi_MenuPosition = 0
ShowPlayerMenu(id)
return 0
}

public ShowPlayerMenu(id)
{
new arrayloc = 0
new keys = (1<<9)

arrayloc = format(ga_MenuData,(MAX_menudata-1),"VoteBan Меню ^n")
for(i=0; i<8; i++)
if( gi_TotalPlayers>(gi_MenuPosition+i) )
{
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"%d. %s^n", i+1, ga_PlayerName[gi_MenuPosition+i])
keys |= (1<<i)
}
if( gi_TotalPlayers>(gi_MenuPosition+8) )
{
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n9. Далее")
keys |= (1<<8)
}
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n0. Назад/Выход")

show_menu(id, keys, ga_MenuData, 20, "ChoosePlayer")
return PLUGIN_HANDLED
}

public ChooseMenu(id, key)
{
switch(key)
{
case 8:
{
gi_MenuPosition=gi_MenuPosition+8
ShowPlayerMenu(id)
}
case 9:
{
if(gi_MenuPosition>=8)
{
gi_MenuPosition=gi_MenuPosition-8
ShowPlayerMenu(id)
}
else
return 0
}
default:
{
gi_Sellection=gi_MenuPosition+key
new Now=get_systime(gi_SysTimeOffset)
set_pcvar_num(gi_LastTime, Now)

run_vote()
return 0
}
}
return PLUGIN_HANDLED
}

public run_vote()
{
log_amx("Vote ban started by %s for %s %s", ga_PlayerName[gi_VoteStarter], ga_PlayerName[gi_Sellection], ga_PlayerAuthID[gi_Sellection])
format(ga_MenuData,(MAX_menudata-1),"Забанить %s на %d минут?^n1. Да^n2. Нет",ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
ga_Choice[0] = 0
ga_Choice[1] = 0
show_menu( 0, (1<<0)|(1<<1), ga_MenuData, 15, "VoteMenu" )
set_task(15.0,"outcom")
return 0
}

public CountVotes(id, key)
{
++ga_Choice[key]
return PLUGIN_HANDLED
}

public outcom()
{
new TotalVotes = ga_Choice[0] + ga_Choice[1]
new Float:result = (float(ga_Choice[0]) / float(TotalVotes))

if( get_pcvar_float(gf_MinVoters) >= ( float(TotalVotes) / float(gi_TotalPlayers) ) )
{
ColorChat(0, RED, "^x01[^x04Сервер^x01] ^x01 Не хватает голосов для бана игрока ^x04 %s!", ga_PlayerName[gi_Sellection])
return 0
}
else
{
if( result < get_pcvar_float(gf_BF_Ratio) )
{
ColorChat(0, RED, "^x01[^x04Сервер^x01] ^x01 Голосование завершено! ^x04 Игрок %s ^x01 забанен на ^x04 %d минут!^x01", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
ActualBan(gi_VoteStarter)
log_amx("[AMXX] The vote back fired at %s, he is banned for %d minutes", ga_PlayerName[gi_VoteStarter], get_pcvar_num(gi_BanTime))
}

if( result >= get_pcvar_float(gf_Ratio) )
{
ColorChat(0, RED, "^x01[^x04Сервер^x01] ^x01 Голосование завершено! ^x04 Игрок %s ^x01 забанен на ^x04 %d минут!^x01", ga_PlayerName[gi_Sellection], get_pcvar_num(gi_BanTime))
log_amx("[AMXX] The vote succeeded: %s is banned for %d minutes", ga_PlayerAuthID[gi_Sellection], get_pcvar_num(gi_BanTime))
ActualBan(gi_Sellection)
}
else
{
ColorChat(0, RED, "^x01[^x04Сервер^x01] ^x03 Голосование не состоялось!")
log_amx("[AMXX] The voteban dit not sucseed.")
}
}
ColorChat(0, RED, "^x01[^x04Сервер^x01] ^x01 Всего проголосовало: ^x04 %d игроков, ^x04 %d ^x01 из них проголосовали ^x03 ЗА!", gi_TotalPlayers, ga_Choice[0])

return 0
}

public ActualBan(Selected)
{
get_pcvar_string(gi_BanReason, banReasonCvar, charsmax(banReasonCvar))
server_cmd("amx_superban %s %d %s", ga_PlayerIP[Selected], get_pcvar_num(gi_BanTime), banReasonCvar)
return 0
}
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Ответить в данную темуНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: