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

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

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

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

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

Этот раздел, как вы могли заметить по названию, предназначен для решения вопросов по поводу уже существующих модов и плагинов.
Пожалуйста, если у вас проблема с написанием плагина, не путайте этот раздел с разделом по скриптингу.
Для поиска плагинов и модов существует соответствующий раздел.

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

Правила оформления темы:
1. Помимо заголовка не забудьте верно сформулировать свой вопрос.
2. Выложите исходник (в тег кода + ) или ссылку на плагин который вызывает у вас вопросы.
3. Выложите лог с ошибками (если имеется) под спойлер

Не работает voteban

Simbo
сообщение 24.5.2012, 18:43
Сообщение #1
Стаж: 13 лет

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

Здраствуйте поставил на сервер voteban_by_slimshady.amxx, плагин очень прост и красив, впринцепе он работает, но вот после окончания бана, игрок продолжает играть на сервере... что же можно сделать, так же на сервере стоит amxbans 6.
Исходник
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#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
new idol
new idoll[32]
//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
new szArgs[512]


public plugin_init()
{
register_plugin("VoteBan_by_SLIMSHADY","1.5","RAF_SLIMSHADY_MOD")
register_clcmd("say /voteban","SayIt" )
register_clcmd("say voteban","SayIt" )
register_menucmd(register_menuid("ChoosePlayer"),1023,"ChooseMenu")
register_menucmd(register_menuid("VoteMenu"),1023,"CountVotes")
register_clcmd("messagemode5", "ClCmdMessageMode3")
register_clcmd("say5", "xax")

gi_LastTime=register_cvar("amx_voteban_lasttime","0")
gi_DelayTime=register_cvar("amxx_voteban_delaytime","500")
gf_Ratio=register_cvar("amxx_voteban_ratio","0.70")
gf_MinVoters=register_cvar("amxx_voteban_minvoters","0.0")
gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","0.0")
gi_Disable=register_cvar("amxx_voteban_disable","0")
gi_BanType=register_cvar("amxx_voteban_type","0")
}


public ClCmdMessageMode3(id)
{
client_cmd(id, "messagemode say5")
ColorChat(id, RED, "[VOTEBAN] Введите причину голосования для этого игрока наверху.")
}

public xax(id)
{
read_args(szArgs, 511)
remove_quotes(szArgs)
while (replace(szArgs, 511, "q", "й")) {}
while (replace(szArgs, 511, "w", "ц")) {}
while (replace(szArgs, 511, "e", "у")) {}
while (replace(szArgs, 511, "r", "к")) {}
while (replace(szArgs, 511, "t", "е")) {}
while (replace(szArgs, 511, "y", "н")) {}
while (replace(szArgs, 511, "u", "г")) {}
while (replace(szArgs, 511, "i", "ш")) {}
while (replace(szArgs, 511, "o", "щ")) {}
while (replace(szArgs, 511, "p", "з")) {}
while (replace(szArgs, 511, "[", "х")) {}
while (replace(szArgs, 511, "]", "ъ")) {}
while (replace(szArgs, 511, "a", "ф")) {}
while (replace(szArgs, 511, "s", "ы")) {}
while (replace(szArgs, 511, "d", "в")) {}
while (replace(szArgs, 511, "f", "а")) {}
while (replace(szArgs, 511, "g", "п")) {}
while (replace(szArgs, 511, "h", "р")) {}
while (replace(szArgs, 511, "j", "о")) {}
while (replace(szArgs, 511, "k", "л")) {}
while (replace(szArgs, 511, "l", "д")) {}
while (replace(szArgs, 511, ";", "ж")) {}
while (replace(szArgs, 511, "'", "э")) {}
while (replace(szArgs, 511, "z", "я")) {}
while (replace(szArgs, 511, "x", "ч")) {}
while (replace(szArgs, 511, "c", "с")) {}
while (replace(szArgs, 511, "v", "м")) {}
while (replace(szArgs, 511, "b", "и")) {}
while (replace(szArgs, 511, "n", "т")) {}
while (replace(szArgs, 511, "m", "ь")) {}
while (replace(szArgs, 511, ",", "б")) {}
while (replace(szArgs, 511, ".", "ю")) {}
while (replace(szArgs, 511, "Q", "Й")) {}
while (replace(szArgs, 511, "W", "Ц")) {}
while (replace(szArgs, 511, "E", "У")) {}
while (replace(szArgs, 511, "R", "К")) {}
while (replace(szArgs, 511, "T", "Е")) {}
while (replace(szArgs, 511, "Y", "Н")) {}
while (replace(szArgs, 511, "U", "Г")) {}
while (replace(szArgs, 511, "I", "Ш")) {}
while (replace(szArgs, 511, "O", "Щ")) {}
while (replace(szArgs, 511, "P", "З")) {}
while (replace(szArgs, 511, "{", "Х")) {}
while (replace(szArgs, 511, "}", "Ъ")) {}
while (replace(szArgs, 511, "A", "Ф")) {}
while (replace(szArgs, 511, "S", "Ы")) {}
while (replace(szArgs, 511, "D", "В")) {}
while (replace(szArgs, 511, "F", "А")) {}
while (replace(szArgs, 511, "G", "П")) {}
while (replace(szArgs, 511, "H", "Р")) {}
while (replace(szArgs, 511, "J", "О")) {}
while (replace(szArgs, 511, "K", "Л")) {}
while (replace(szArgs, 511, "L", "Д")) {}
while (replace(szArgs, 511, ":", "Ж")) {}
while (replace(szArgs, 511, "Z", "Я")) {}
while (replace(szArgs, 511, "X", "Ч")) {}
while (replace(szArgs, 511, "C", "С")) {}
while (replace(szArgs, 511, "V", "М")) {}
while (replace(szArgs, 511, "B", "И")) {}
while (replace(szArgs, 511, "N", "Т")) {}
while (replace(szArgs, 511, "M", "Ь")) {}
while (replace(szArgs, 511, "<", "Б")) {}
while (replace(szArgs, 511, ">", "Ю")) {}
timed(id)

}


public SayIt(id)
{
if(get_pcvar_num(gi_Disable))
{
client_print(id,print_chat,"VoteBan off.")
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,"[VOTEBAN] Голосование возможно через %d секунд.",seconds)
return 0
}

get_players(ga_PlayerID,gi_TotalPlayers)
for(i=0;i<gi_TotalPlayers;i++)
{
new TempID = ga_PlayerID[i]
if(get_user_flags(TempID) & ADMIN_RCON)
{

}

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 timed(id)
{

new i_Menu = menu_create("\rВыбери время бана:", "server_menu")
menu_additem(i_Menu, "\r15 \wминут", "1", 0)
menu_additem(i_Menu, "\r30 \wминут", "2", 0)
menu_additem(i_Menu, "\r1 \wчас", "3", 0)
menu_additem(i_Menu, "\r2 \wчаса", "4", 0)
menu_additem(i_Menu, "\r3 \wчаса", "5", 0)

menu_setprop(i_Menu, MPROP_EXIT, MEXIT_ALL)

menu_display(id, i_Menu, 0)

return PLUGIN_HANDLED


}

public server_menu(id, menu, item)
{

if (item == MENU_EXIT)
{
menu_destroy(menu)

return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback

menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

new i_Key = str_to_num(s_Data)

switch(i_Key)
{

case 1:
{
gi_BanTime = 15
run_vote()
}
case 2:
{
gi_BanTime = 30
run_vote()
}
case 3:
{
gi_BanTime = 60
run_vote()
}
case 4:
{
gi_BanTime = 120
run_vote()
}
case 5:
{
gi_BanTime = 180
run_vote()
}


}
menu_destroy(menu)
return PLUGIN_HANDLED
}





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

arrayloc = format(ga_MenuData,(MAX_menudata-1),"\r[\wVOTEBAN\r] \wУкажи игрока:^n")
for(i=0;i<8;i++)

if( gi_TotalPlayers>(gi_MenuPosition+i))
{
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"\y%d.\w%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),"^n\y9.\r[\wДалее\r]")
keys |= (1<<8)
}
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n\y0.\r[\wВыход\r]")

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 admin = get_user_index(ga_PlayerName[gi_Sellection])
if (get_user_flags(admin) & ADMIN_LEVEL_H)
{
ColorChat(0, RED, "[VOTEBAN] ^x04%s ^x03является админом!", ga_PlayerName[gi_Sellection])
return 0
}
else
{
ClCmdMessageMode3(id)
return 0
}
}
}
return PLUGIN_HANDLED
}

public run_vote()
{
new Now=get_systime(gi_SysTimeOffset)
idol = get_user_index(ga_PlayerName[gi_Sellection])
set_pcvar_num(gi_LastTime, Now)
get_user_ip(idol,idoll,15,1)
log_amx("VoteBan Запустил %s против %s %s.=D.",ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection],ga_PlayerAuthID
[gi_Sellection])
ColorChat(0, RED, "[VOTEBAN] Голосование запустил ^x04%s ^x03против ^x04%s", ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection])
format(ga_MenuData,(MAX_menudata-1),"Инициатор голосования \y%s^n\wПричина: \r%s^n\wЗабанить \r%s \wна \r%d \wминут?^n(\y%d \wфрагов | \y%d \wсмертей)^n\y1.\wДа^n\y2.\wНет",ga_PlayerName[gi_VoteStarter],szArgs,ga_PlayerName[gi_Sellection],gi_BanTi
me,get_user_frags(idol),get_user_deaths(idol))
ga_Choice[0] = 0
ga_Choice[1] = 0
show_menu(0,(1<<0)|(1<<1),ga_MenuData,15,"VoteMenu" )
set_task(20.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,"[VOTEBAN] Недостаточно голосов за Бан ^x04%s!",ga_PlayerName[gi_Sellection])
return 0
}
else
{
if(result < get_pcvar_float(gf_BF_Ratio))
{
ColorChat(0,RED,"[VOTEBAN] ^x04%s ^x03забанен на ^x04%d ^x03минут.",ga_PlayerName[gi_VoteStarter],gi_BanTime)
ActualBan(gi_VoteStarter)
log_amx("[AMXX] %s was Banned for %d minutes.",ga_PlayerName[gi_VoteStarter],gi_BanTime)
}

if( result >= get_pcvar_float(gf_Ratio) )
{
ColorChat(0,RED,"[VOTEBAN] ^x04%s ^x03забанен на ^x04%d ^x03минут.",ga_PlayerName[gi_Sellection],gi_BanTime)
log_amx("[AMXX] %s was Banned for %d minutes.",ga_PlayerAuthID[gi_Sellection],gi_BanTime)
ActualBan(gi_Sellection)
}
else
{
ColorChat(0,RED,"[VOTEBAN] Голосование не состоялось. Недостаточно голосов.")
log_amx("[AMXX] The VoteBan dit not sucseed.")
}
}
ColorChat(0,RED,"[VOTEBAN] Проголосовало ^x04%d ^x03игроков, ^x04%d ^x03За.",gi_TotalPlayers,ga_Choice[0])

return 0
}

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

Конфиг
amxx_voteban_timemenu "0"
// 1 - показывать, 0 - не показывать меню с выбором времени.

amxx_voteban_bantime "60"
// Стандартное время бана, если отключено меню с выбором времени.

amxx_voteban_bancfg "amx_ban %name% %time% %reason%"
// тип бана, можно менять как вам угодно.
// %time% - время
// %reason% - причина
// %userid% - ID игрока
// %ip% - IP игрока
// %steamid% - STEAM игрока
// %name% - имя игрока

amxx_voteban_admin "1"
// 1 - голосование работает, 0 - не работает при онлайн админе.

amxx_voteban_nomshow "1"
// 0 - не показывать, 1 - показывать номинанту меню с голосованием.

amxx_voteban_votetime "15.0"
// длительность голосования

menutime1 "15"
menutime2 "30"
menutime3 "60"
menutime4 "120"
menutime5 "180"
// Если включено меню с выбором времени, то Вы можете настроить время каждого из пяти пунктов на свое усмотрение (в минутах).

amxx_voteban_delaytime "600"
// Время между голосованиями (от голосования каждые 20 секунд идиотами) По стандарту стоит 600 секунд.

amxx_voteban_ratio "0.50"
// Необходимое процентное соотношение проголосовавших. По стандарту 0.50 (=50%)

amxx_voteban_minvoters "0.0"
// Минимум игроков для начала голосования. Стандарт 0.0

amxx_voteban_bf_ratio "0.40"
// Если если какой-то игрок часто затевает голосование, то при низком значении голосов "ЗА", инициатор будет забанен. (если на сервере больше 10-ти человек)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   Цитировать сообщение
arsen_stalker
сообщение 24.5.2012, 19:55
Сообщение #2
Стаж: 14 лет

Сообщений: 317
Благодарностей: 41
Полезность: 0

Цитата(Simbo @ 24.5.2012, 18:43) *
Здраствуйте поставил на сервер voteban_by_slimshady.amxx, плагин очень прост и красив, впринцепе он работает, но вот после окончания бана, игрок продолжает играть на сервере... что же можно сделать, так же на сервере стоит amxbans 6.
Исходник
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#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
new idol
new idoll[32]
//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
new szArgs[512]


public plugin_init()
{
register_plugin("VoteBan_by_SLIMSHADY","1.5","RAF_SLIMSHADY_MOD")
register_clcmd("say /voteban","SayIt" )
register_clcmd("say voteban","SayIt" )
register_menucmd(register_menuid("ChoosePlayer"),1023,"ChooseMenu")
register_menucmd(register_menuid("VoteMenu"),1023,"CountVotes")
register_clcmd("messagemode5", "ClCmdMessageMode3")
register_clcmd("say5", "xax")

gi_LastTime=register_cvar("amx_voteban_lasttime","0")
gi_DelayTime=register_cvar("amxx_voteban_delaytime","500")
gf_Ratio=register_cvar("amxx_voteban_ratio","0.70")
gf_MinVoters=register_cvar("amxx_voteban_minvoters","0.0")
gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","0.0")
gi_Disable=register_cvar("amxx_voteban_disable","0")
gi_BanType=register_cvar("amxx_voteban_type","0")
}


public ClCmdMessageMode3(id)
{
client_cmd(id, "messagemode say5")
ColorChat(id, RED, "[VOTEBAN] Введите причину голосования для этого игрока наверху.")
}

public xax(id)
{
read_args(szArgs, 511)
remove_quotes(szArgs)
while (replace(szArgs, 511, "q", "й")) {}
while (replace(szArgs, 511, "w", "ц")) {}
while (replace(szArgs, 511, "e", "у")) {}
while (replace(szArgs, 511, "r", "к")) {}
while (replace(szArgs, 511, "t", "е")) {}
while (replace(szArgs, 511, "y", "н")) {}
while (replace(szArgs, 511, "u", "г")) {}
while (replace(szArgs, 511, "i", "ш")) {}
while (replace(szArgs, 511, "o", "щ")) {}
while (replace(szArgs, 511, "p", "з")) {}
while (replace(szArgs, 511, "[", "х")) {}
while (replace(szArgs, 511, "]", "ъ")) {}
while (replace(szArgs, 511, "a", "ф")) {}
while (replace(szArgs, 511, "s", "ы")) {}
while (replace(szArgs, 511, "d", "в")) {}
while (replace(szArgs, 511, "f", "а")) {}
while (replace(szArgs, 511, "g", "п")) {}
while (replace(szArgs, 511, "h", "р")) {}
while (replace(szArgs, 511, "j", "о")) {}
while (replace(szArgs, 511, "k", "л")) {}
while (replace(szArgs, 511, "l", "д")) {}
while (replace(szArgs, 511, ";", "ж")) {}
while (replace(szArgs, 511, "'", "э")) {}
while (replace(szArgs, 511, "z", "я")) {}
while (replace(szArgs, 511, "x", "ч")) {}
while (replace(szArgs, 511, "c", "с")) {}
while (replace(szArgs, 511, "v", "м")) {}
while (replace(szArgs, 511, "b", "и")) {}
while (replace(szArgs, 511, "n", "т")) {}
while (replace(szArgs, 511, "m", "ь")) {}
while (replace(szArgs, 511, ",", "б")) {}
while (replace(szArgs, 511, ".", "ю")) {}
while (replace(szArgs, 511, "Q", "Й")) {}
while (replace(szArgs, 511, "W", "Ц")) {}
while (replace(szArgs, 511, "E", "У")) {}
while (replace(szArgs, 511, "R", "К")) {}
while (replace(szArgs, 511, "T", "Е")) {}
while (replace(szArgs, 511, "Y", "Н")) {}
while (replace(szArgs, 511, "U", "Г")) {}
while (replace(szArgs, 511, "I", "Ш")) {}
while (replace(szArgs, 511, "O", "Щ")) {}
while (replace(szArgs, 511, "P", "З")) {}
while (replace(szArgs, 511, "{", "Х")) {}
while (replace(szArgs, 511, "}", "Ъ")) {}
while (replace(szArgs, 511, "A", "Ф")) {}
while (replace(szArgs, 511, "S", "Ы")) {}
while (replace(szArgs, 511, "D", "В")) {}
while (replace(szArgs, 511, "F", "А")) {}
while (replace(szArgs, 511, "G", "П")) {}
while (replace(szArgs, 511, "H", "Р")) {}
while (replace(szArgs, 511, "J", "О")) {}
while (replace(szArgs, 511, "K", "Л")) {}
while (replace(szArgs, 511, "L", "Д")) {}
while (replace(szArgs, 511, ":", "Ж")) {}
while (replace(szArgs, 511, "Z", "Я")) {}
while (replace(szArgs, 511, "X", "Ч")) {}
while (replace(szArgs, 511, "C", "С")) {}
while (replace(szArgs, 511, "V", "М")) {}
while (replace(szArgs, 511, "B", "И")) {}
while (replace(szArgs, 511, "N", "Т")) {}
while (replace(szArgs, 511, "M", "Ь")) {}
while (replace(szArgs, 511, "<", "Б")) {}
while (replace(szArgs, 511, ">", "Ю")) {}
timed(id)

}


public SayIt(id)
{
if(get_pcvar_num(gi_Disable))
{
client_print(id,print_chat,"VoteBan off.")
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,"[VOTEBAN] Голосование возможно через %d секунд.",seconds)
return 0
}

get_players(ga_PlayerID,gi_TotalPlayers)
for(i=0;i<gi_TotalPlayers;i++)
{
new TempID = ga_PlayerID[i]
if(get_user_flags(TempID) & ADMIN_RCON)
{

}

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 timed(id)
{

new i_Menu = menu_create("\rВыбери время бана:", "server_menu")
menu_additem(i_Menu, "\r15 \wминут", "1", 0)
menu_additem(i_Menu, "\r30 \wминут", "2", 0)
menu_additem(i_Menu, "\r1 \wчас", "3", 0)
menu_additem(i_Menu, "\r2 \wчаса", "4", 0)
menu_additem(i_Menu, "\r3 \wчаса", "5", 0)

menu_setprop(i_Menu, MPROP_EXIT, MEXIT_ALL)

menu_display(id, i_Menu, 0)

return PLUGIN_HANDLED


}

public server_menu(id, menu, item)
{

if (item == MENU_EXIT)
{
menu_destroy(menu)

return PLUGIN_HANDLED
}

new s_Data[6], s_Name[64], i_Access, i_Callback

menu_item_getinfo(menu, item, i_Access, s_Data, charsmax(s_Data), s_Name, charsmax(s_Name), i_Callback)

new i_Key = str_to_num(s_Data)

switch(i_Key)
{

case 1:
{
gi_BanTime = 15
run_vote()
}
case 2:
{
gi_BanTime = 30
run_vote()
}
case 3:
{
gi_BanTime = 60
run_vote()
}
case 4:
{
gi_BanTime = 120
run_vote()
}
case 5:
{
gi_BanTime = 180
run_vote()
}


}
menu_destroy(menu)
return PLUGIN_HANDLED
}





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

arrayloc = format(ga_MenuData,(MAX_menudata-1),"\r[\wVOTEBAN\r] \wУкажи игрока:^n")
for(i=0;i<8;i++)

if( gi_TotalPlayers>(gi_MenuPosition+i))
{
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"\y%d.\w%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),"^n\y9.\r[\wДалее\r]")
keys |= (1<<8)
}
arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n\y0.\r[\wВыход\r]")

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 admin = get_user_index(ga_PlayerName[gi_Sellection])
if (get_user_flags(admin) & ADMIN_LEVEL_H)
{
ColorChat(0, RED, "[VOTEBAN] ^x04%s ^x03является админом!", ga_PlayerName[gi_Sellection])
return 0
}
else
{
ClCmdMessageMode3(id)
return 0
}
}
}
return PLUGIN_HANDLED
}

public run_vote()
{
new Now=get_systime(gi_SysTimeOffset)
idol = get_user_index(ga_PlayerName[gi_Sellection])
set_pcvar_num(gi_LastTime, Now)
get_user_ip(idol,idoll,15,1)
log_amx("VoteBan Запустил %s против %s %s.=D.",ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection],ga_PlayerAuthID
[gi_Sellection])
ColorChat(0, RED, "[VOTEBAN] Голосование запустил ^x04%s ^x03против ^x04%s", ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection])
format(ga_MenuData,(MAX_menudata-1),"Инициатор голосования \y%s^n\wПричина: \r%s^n\wЗабанить \r%s \wна \r%d \wминут?^n(\y%d \wфрагов | \y%d \wсмертей)^n\y1.\wДа^n\y2.\wНет",ga_PlayerName[gi_VoteStarter],szArgs,ga_PlayerName[gi_Sellection],gi_BanTi
me,get_user_frags(idol),get_user_deaths(idol))
ga_Choice[0] = 0
ga_Choice[1] = 0
show_menu(0,(1<<0)|(1<<1),ga_MenuData,15,"VoteMenu" )
set_task(20.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,"[VOTEBAN] Недостаточно голосов за Бан ^x04%s!",ga_PlayerName[gi_Sellection])
return 0
}
else
{
if(result < get_pcvar_float(gf_BF_Ratio))
{
ColorChat(0,RED,"[VOTEBAN] ^x04%s ^x03забанен на ^x04%d ^x03минут.",ga_PlayerName[gi_VoteStarter],gi_BanTime)
ActualBan(gi_VoteStarter)
log_amx("[AMXX] %s was Banned for %d minutes.",ga_PlayerName[gi_VoteStarter],gi_BanTime)
}

if( result >= get_pcvar_float(gf_Ratio) )
{
ColorChat(0,RED,"[VOTEBAN] ^x04%s ^x03забанен на ^x04%d ^x03минут.",ga_PlayerName[gi_Sellection],gi_BanTime)
log_amx("[AMXX] %s was Banned for %d minutes.",ga_PlayerAuthID[gi_Sellection],gi_BanTime)
ActualBan(gi_Sellection)
}
else
{
ColorChat(0,RED,"[VOTEBAN] Голосование не состоялось. Недостаточно голосов.")
log_amx("[AMXX] The VoteBan dit not sucseed.")
}
}
ColorChat(0,RED,"[VOTEBAN] Проголосовало ^x04%d ^x03игроков, ^x04%d ^x03За.",gi_TotalPlayers,ga_Choice[0])

return 0
}

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

Конфиг
amxx_voteban_timemenu "0"
// 1 - показывать, 0 - не показывать меню с выбором времени.

amxx_voteban_bantime "60"
// Стандартное время бана, если отключено меню с выбором времени.

amxx_voteban_bancfg "amx_ban %name% %time% %reason%"
// тип бана, можно менять как вам угодно.
// %time% - время
// %reason% - причина
// %userid% - ID игрока
// %ip% - IP игрока
// %steamid% - STEAM игрока
// %name% - имя игрока

amxx_voteban_admin "1"
// 1 - голосование работает, 0 - не работает при онлайн админе.

amxx_voteban_nomshow "1"
// 0 - не показывать, 1 - показывать номинанту меню с голосованием.

amxx_voteban_votetime "15.0"
// длительность голосования

menutime1 "15"
menutime2 "30"
menutime3 "60"
menutime4 "120"
menutime5 "180"
// Если включено меню с выбором времени, то Вы можете настроить время каждого из пяти пунктов на свое усмотрение (в минутах).

amxx_voteban_delaytime "600"
// Время между голосованиями (от голосования каждые 20 секунд идиотами) По стандарту стоит 600 секунд.

amxx_voteban_ratio "0.50"
// Необходимое процентное соотношение проголосовавших. По стандарту 0.50 (=50%)

amxx_voteban_minvoters "0.0"
// Минимум игроков для начала голосования. Стандарт 0.0

amxx_voteban_bf_ratio "0.40"
// Если если какой-то игрок часто затевает голосование, то при низком значении голосов "ЗА", инициатор будет забанен. (если на сервере больше 10-ти человек)

В конфиге измени следующее:
amxx_voteban_bancfg "amx_ban %name% %time% %reason%" на amxx_voteban_bancfg "amx_ban %time% %name% %reason%"

Отредактировал: arsen_stalker, - 24.5.2012, 19:57
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Simbo
сообщение 24.5.2012, 20:02
Сообщение #3
Стаж: 13 лет

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

Цитата(arsen_stalker @ 24.5.2012, 19:55) *
В конфиге измени следующее:
amxx_voteban_bancfg "amx_ban %name% %time% %reason%" на amxx_voteban_bancfg "amx_ban %time% %name% %reason%"

щас проверю=)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
arsen_stalker
сообщение 24.5.2012, 20:06
Сообщение #4
Стаж: 14 лет

Сообщений: 317
Благодарностей: 41
Полезность: 0

Цитата(Simbo @ 24.5.2012, 20:02) *
щас проверю=)

А почему не изменить значение квары amxx_voteban_admin "1" на "0"
ps.gif То есть, когда есть админы, игрок может вызвать голосование и скорее всего (зависит от проголосовавших) забанит его.
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
Поблагодарили 1 раз
   + Цитировать сообщение
Simbo
сообщение 24.5.2012, 20:13
Сообщение #5
Стаж: 13 лет

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

ура, заработало=)
Перейти в начало страницы         Просмотр профиля    Отправить личное сообщение
   + Цитировать сообщение
  Тема закрытаНачать новую тему
 
0 пользователей и 1 гостей читают эту тему: