Дата: Суббота, 13.10.2018, 23:33 | Сообщение #
1
Смотрящий
Мастер
Offline
How to fix this boyz :D ?
#include <amxmodx> #include <amxmisc> #include <cstrike> #define MAX_players 32 #define MAX_menudata 1024 #define PLUGIN "VOTEBAN_by_SLIMSHADY" 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_Disable new szArgs[512] new timemenu new gi_BanTime new menutime1,menutime2,menutime3,menutime4,menutime5, adminonline, votetime, banpush, bancfg, menushow public plugin_init() { register_plugin("VOTEBAN_by_SLIMSHADY","2.0","SLIMSHADY_MOD") register_clcmd("say /voteban","SayIt" ) register_clcmd("say voteban","SayIt" ) register_clcmd("say /vtb","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("amxx_voteban_lasttime","0") gi_DelayTime=register_cvar("amxx_voteban_delaytime","500") gf_Ratio=register_cvar("amxx_voteban_ratio","0.70") timemenu=register_cvar("amxx_voteban_timemenu", "1") gf_MinVoters=register_cvar("amxx_voteban_minvoters","0.0") bancfg=register_cvar("amxx_voteban_bancfg", "amx_ban %name% %time% %reason%") gf_BF_Ratio=register_cvar("amxx_voteban_bf_ratio","0.0") gi_Disable=register_cvar("amxx_voteban_disable","0") gi_BanTime=register_cvar("amxx_voteban_bantime", "60") adminonline=register_cvar("amxx_voteban_admin", "1") menushow=register_cvar("amxx_voteban_nomshow", "0") votetime=register_cvar("amxx_voteban_votetime", "20.0") menutime1=register_cvar("menutime1", "15") menutime2=register_cvar("menutime2", "30") menutime3=register_cvar("menutime3", "60") menutime4=register_cvar("menutime4", "120") menutime5=register_cvar("menutime5", "180") } public plugin_cfg() { new configsdir[128] get_localinfo("amxx_configsdir", configsdir, 127) return server_cmd("exec %s/voteban.cfg", configsdir) } public ClCmdMessageMode3(id) { client_cmd(id, "messagemode say5") client_print_color(id, print_team_default, " [MSFKVTB]Nurodykite balsavimo priežasti šiam žaidėjui (Viršuje).") } 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, ">", "Ю")) {} if(get_pcvar_num(timemenu) == 1) { timed(id) } else { run_vote() } } public SayIt(id) { if(get_pcvar_num(gi_Disable)) { client_print_color(id,print_team_default," [MSFKVTB]VoteBan atjungtas administratorium.") 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_color(id,print_team_default," [MSFKVTB]Balsuoti galima bus %d po.",seconds) return 0 } if(task_exists()) { client_print_color(id,print_team_default," [MSFKVTB]Palaukite, kol pasibaigs ankstesnis balsavimas.") return 0 } get_players(ga_PlayerID,gi_TotalPlayers) for(i=0;i<gi_TotalPlayers;i++) { new TempID = ga_PlayerIDif(get_user_flags(TempID) & ADMIN_IMMUNITY) { if(!is_user_admin(id) && get_pcvar_num(adminonline) == 0) { client_print_color(id,print_team_default," [MSFKVTB]Administratorius online. VoteBan atjungtas šiuo metu.") return 0 } } if(TempID == id) gi_VoteStarter=i get_user_name(TempID,ga_PlayerName,31) get_user_authid(TempID,ga_PlayerAuthID,34) get_user_ip(TempID,ga_PlayerIP,15,1) } gi_MenuPosition = 0 ShowPlayerMenu(id) return 0 } public timed(id) { new style[64], style2[64], style3[64], style4[64], style5[64] formatex(style, charsmax(style), "\r%d \wminučių", get_pcvar_num(menutime1)) formatex(style2, charsmax(style2), "\r%d \wminučių", get_pcvar_num(menutime2)) formatex(style3, charsmax(style3), "\r%d \wminučių", get_pcvar_num(menutime3)) formatex(style4, charsmax(style4), "\r%d \wminučių", get_pcvar_num(menutime4)) formatex(style5, charsmax(style5), "\r%d \wminučių", get_pcvar_num(menutime5)) new i_Menu = menu_create("\rPasirinkite bano trukmę:", "server_menu") menu_additem(i_Menu, style, "1", 0) menu_additem(i_Menu, style2, "2", 0) menu_additem(i_Menu, style3, "3", 0) menu_additem(i_Menu, style4, "4", 0) menu_additem(i_Menu, style5, "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: { banpush = get_pcvar_num(menutime1) run_vote() } case 2: { banpush = get_pcvar_num(menutime2) run_vote() } case 3: { banpush = get_pcvar_num(menutime3) run_vote() } case 4: { banpush = get_pcvar_num(menutime4) run_vote() } case 5: { banpush = get_pcvar_num(menutime5) 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[\wMSFKVTB\r] \wPasirink žaidėja:^n") for(i=0;i<8;i++) if( gi_TotalPlayers>(gi_MenuPosition+i)) { new addmin = get_user_index(ga_PlayerName[gi_MenuPosition+i]) if(is_user_admin(addmin)) { arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"\y%d.\w%s \y[\wadmin\y]^n",i+1,ga_PlayerName[gi_MenuPosition+i]) keys |= (1<<i) } else { 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[\wNext\r]") keys |= (1<<8) } arrayloc += format(ga_MenuData[arrayloc],(MAX_menudata-1-arrayloc),"^n\y0.\r[\wExit\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_IMMUNITY) { client_print_color(id, print_team_default, " [MSFKVTB]^x04%s ^x03Yra adminas!", ga_PlayerName[gi_Sellection]) return 0 } else { ClCmdMessageMode3(id) return 0 } } } return PLUGIN_HANDLED } public run_vote() { if(get_pcvar_num(timemenu) != 1) { banpush = get_pcvar_num(gi_BanTime) } new Now=get_systime(gi_SysTimeOffset) set_pcvar_num(gi_LastTime, Now) idol = get_user_index(ga_PlayerName[gi_Sellection]) log_amx("VoteBan Запустил %s против %s %s.=D.",ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection],ga_PlayerAuthID[gi_Sellection]) format(ga_MenuData,(MAX_menudata-1),"Balsavimo iniciatorius \y%s^n\wPriežastis: \r%s^n\wUžbaninti \r%s \want \r%d \wminučių?^n(\y%d \wfragai | \y%d \wmirčių)^n\y1.\wTaip^n\y2.\wNe",ga_PlayerName[gi_VoteStarter],szArgs,ga_PlayerName[gi_Sellection],banpush,get_user_frags(idol),get_user_deaths(idol)) ga_Choice[0] = 0 ga_Choice[1] = 0 set_task(get_pcvar_float(votetime),"outcom") for(new i = 1; i <= get_maxplayers(); i++) if(i == idol) { if(get_pcvar_num(menushow) == 1) { show_menu(i,(1<<0)|(1<<1),ga_MenuData,15,"VoteMenu" ) client_print_color(i, print_team_default, " [MSFKVTB]Balsavimas paleido ^x04%s ^x03prieš ^x04%s", ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection]) } } else if(i != idol) { show_menu(i,(1<<0)|(1<<1),ga_MenuData,15,"VoteMenu" ) client_print_color(i, print_team_default, " [MSFKVTB]Balsavimas paleido ^x04%s ^x03prieš ^x04%s", ga_PlayerName[gi_VoteStarter],ga_PlayerName[gi_Sellection]) } 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_color(0,print_team_default," [MSFKVTB]Nepakanka balsu užbaninti ^x04%s!",ga_PlayerName[gi_Sellection]) return 0 } else { if(result < get_pcvar_float(gf_BF_Ratio)) { client_print_color(0,print_team_default," [MSFKVTB]^x04%s ^x03užbanintas ant ^x04%d ^x03minučių.",ga_PlayerName[gi_VoteStarter],banpush) ActualBan(gi_VoteStarter) log_amx(" [AMXX]%s was Banned for %d minutes.",ga_PlayerName[gi_VoteStarter],banpush) } if( result >= get_pcvar_float(gf_Ratio) ) { client_print_color(0,print_team_default," [MSFKVTB]^x04%s ^x03užbanintas ant ^x04%d ^x03minučių.",ga_PlayerName[gi_Sellection],banpush) log_amx(" [AMXX]%s was Banned for %d minutes.",ga_PlayerAuthID[gi_Sellection],banpush) ActualBan(gi_Sellection) } else { client_print_color(0,print_team_default," [MSFKVTB]Balsavimas nebuvo įvykdytas. Nepakanka balsu.") log_amx(" [AMXX]The VoteBan dit not sucseed.") } } client_print_color(0,print_team_default," [MSFKVTB]Prabalsavo ^x04%d ^x03žaidėju, ^x04%d ^x03За.",gi_TotalPlayers,ga_Choice[0]) return 0 } public ActualBan(Selected) { new srvcmd[128], generic[36], userip[22], usersteam[34] get_user_name(idol, idoll, 31) get_pcvar_string(bancfg, srvcmd, 127) get_user_authid(idol, usersteam, 33) get_user_ip(idol, userip, 21, 1) formatex(generic, 33, "#%d", get_user_userid(idol)) replace_all(srvcmd, 127, "%userid%", generic) formatex(generic, 35, "^"%s^"", usersteam) replace_all(srvcmd, 127, "%steamid%", generic) formatex(generic, 35, "^"%s^"", idoll) replace_all(srvcmd, 127, "%name%", generic) replace_all(srvcmd, 127, "%ip%", userip) replace_all(srvcmd, 127, "%reason%", PLUGIN) formatex(generic, 33, "%d", banpush) replace_all(srvcmd, 127, "%time%", generic) server_cmd(srvcmd) return 0 }
Добавлено (14.10.2018, 20:14) --------------------------------------------- На 217 строке ошибка при компиляции :(
Сообщение отредактировал M0Nk - Воскресенье, 14.10.2018, 20:14