/* #=================================================== # _______ ______ __ __ ______ _______ # / _ // ____// /\ / /\/ ____// _ /\ # / // // /\_ /_ /_/ _/ / /\_ / // / / # / // // ___/\_\/___ /_\/ ___/\/ // / / # / // // /\__\/ _/\_/ // /\__\/ // / / # /__//__//_____//_/\\/ /_//_____//__//__/ / # \__\\__\\_____\\_\/ \_\\_____\\__\\__\/ # # NeXeN.org # #NeXeN on Quakenet #=================================================== # By Syam (jhuwette@free.fr) #=================================================== # This file is provided as is (no warranties). #=================================================== */ #include /* read this file to learn the amx functions */ new match_status = 0 new match_rules[20] new match_map[20] new match_passwd[20] new match_id = 0 new match_hostname[96] new team_a[20] new team_b[20] new team_ct_ready = 0 new team_t_ready = 0 new score_a_ct new score_a_t new score_b_ct new score_b_t new cfg_force[192][32] new cfg_vforce[192][32] new cfg_force_num = 0 // ------------------------------------------------------- /* Script d'effets d'Affichages. */ //(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4) public nxn_blue_msg() { new message[192] read_args(message,192) set_hudmessage(100, 100, 255, -1.0, 0.20, 2, 0.25, 12.0, 0.02, 2.0, 4) show_hudmessage(0,message) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_gold_msg() { new message[192] read_args(message,192) set_hudmessage(200, 100, 0, -1.0, 0.30, 2, 0.25, 12.0, 0.02, 2.0, 5) show_hudmessage(0,message) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_red_msg() { new message[192] read_args(message,192) set_hudmessage(255, 50, 50, -1.0, 0.40, 2, 0.25, 12.0, 0.02, 2.0, 6) show_hudmessage(0,message) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_white_msg(message[]) { //new message[192] //read_args(message,192) //(red=200, green=100, blue=0, Float:x=-1.0, Float:y=0.35, effects=0, Float:fxtime=6.0, Float:holdtime=12.0, Float:fadeintime=0.1, Float:fadeouttime=0.2,channel=4) set_hudmessage(255, 255, 255, 0.03, 0.6, 2, 6.0, 12.0, 0.02, 2.0, 7) show_hudmessage(0,message) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_double_msg() { new message_a[193],message_b[193] if (read_argc() < 3){ server_print("Usage: nxn_dbl < blue_msg > < gold_msg >") return PLUGIN_HANDLED } read_argv(1,message_a,192) read_argv(2,message_b,192) //Blue set_hudmessage(100, 100, 255, -1.0, 0.20, 2, 0.25, 12.0, 0.02, 2.0, 4) show_hudmessage(0,message_a) //Gold set_hudmessage(200, 100, 0, -1.0, 0.30, 2, 0.25, 12.0, 0.02, 2.0, 5) show_hudmessage(0,message_b) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_clexec() { if (read_argc() < 1) { server_print("Usage: nxn_clexec ") return PLUGIN_HANDLED } new command[192] read_args(command,192) client_cmd(0,command); return PLUGIN_CONTINUE } // ------------------------------------------------------- public team_score() { new team[2] read_data(1,team,1) if ((match_status == 2) || (match_status == 4)) { if (team[0] == 'C') { if (match_status == 2) { score_a_ct = read_data(2) //score_a_ct = score_a_ct + 1 } if (match_status == 4) { score_b_ct = read_data(2) //score_b_ct = score_b_ct + 1 } } else if (team[0] == 'T') { if (match_status == 2) { score_b_t = read_data(2) //score_b_t = score_b_t + 1 } if (match_status == 4) { score_a_t = read_data(2) //score_a_t = score_a_t + 1 } } //server_cmd("exec bot_force.cfg") server_cmd("pausable 0") check_maxround() } // reinit status team each round. if (match_status >= 1 && match_status <= 4) { team_ct_ready = 0 team_t_ready = 0 } //show_match_status() save_var_to_cvar() return PLUGIN_CONTINUE } // ------------------------------------------------------- public check_maxround() { if ((match_status == 2) && (score_a_ct + score_b_t == get_cvar_num("nxn_maxrounds"))) { //Fin de la manche 1 match_status = 3 server_cmd("nxn_gold [First set finished, please take a screenshot]") if(get_cvar_num("nxn_autoswapteams")) { set_task(5.0,"swap_teams") } set_task(10.0,"nxn_warmup") } if ((match_status == 4) && (score_b_ct + score_a_t == get_cvar_num("nxn_maxrounds"))) { //Fin de la manche 2 match_status = 5 server_cmd("nxn_gold [Second set finished, please take a screenshot]") set_task(10.0,"nxn_end_of_match") } return PLUGIN_HANDLED } // ------------------------------------------------------- public chk_match() { match_id = get_cvar_num("nxn_m_id") if(match_id != 0) { //get match info from cvar get_cvar_string("nxn_team_a",team_a,20) get_cvar_string("nxn_team_b",team_b,20) get_cvar_string("nxn_map",match_map,20) get_cvar_string("nxn_rules",match_rules,20) get_cvar_string("nxn_passwd",match_passwd,20) //set passwd server_cmd("sv_password %s",match_passwd) //check map new current_map[20] get_mapname(current_map,20) if(!equal(current_map,match_map)) { //changemap server_cmd("changelevel %s",match_map) return PLUGIN_CONTINUE } //save hostname //get_cvar_string("hostname",server_hostname,96) //new hostname new servername_prefix[32] get_cvar_string("nxn_servername_prefix",servername_prefix,32) format(match_hostname,96,"%s %s vs %s",servername_prefix,team_a,team_b) set_cvar_string("hostname",match_hostname) //warmup 1 match_status = 1 score_a_ct = 0 score_a_t = 0 score_b_ct = 0 score_b_t = 0 // Load warmup rules server_cmd("exec rules_warmup.cfg") nxn_warmup() nxn_reforce() //show_match_status() } return PLUGIN_HANDLED } // ------------------------------------------------------- public nxn_match() { if (read_argc() < 6) { server_print("[AMX] Usage: nxn_match [match_id]") return PLUGIN_HANDLED } if (match_status != 0) { server_print("[AMX] Match currently running. Please use nxn_match_stop command before.") return PLUGIN_HANDLED } server_print("[AMX] Match loaded.") new tmp_m_id[12] read_argv(1,team_a,20) read_argv(2,team_b,20) read_argv(3,match_map,20) read_argv(4,match_rules,12) read_argv(5,match_passwd,20) //get_cvar_num("port",match_id) if(read_argc() >= 7) { read_argv(6,tmp_m_id,12) match_id = str_to_num(tmp_m_id) } if(read_argc() < 7) { match_id = -1 } //set passwd server_cmd("sv_password %s",match_passwd) //save match info to cvar save_var_to_cvar() //warmup 1 match_status = 1 score_a_ct = 0 score_a_t = 0 score_b_ct = 0 score_b_t = 0 set_task(0.1,"chk_match") return PLUGIN_CONTINUE } // ------------------------------------------------------- public save_var_to_cvar() { //save match info to cvar set_cvar_string("nxn_team_a",team_a) set_cvar_string("nxn_team_b",team_b) set_cvar_string("nxn_map",match_map) set_cvar_string("nxn_rules",match_rules) set_cvar_string("nxn_passwd",match_passwd) set_cvar_num("nxn_m_id",match_id) //save scores set_cvar_num("nxn_score_a_ct",score_a_ct) set_cvar_num("nxn_score_a_t",score_a_t) set_cvar_num("nxn_score_b_ct",score_b_ct) set_cvar_num("nxn_score_b_t",score_b_t) } // ------------------------------------------------------- public random_teams_side() { if(random_num(0,1) == 1) { new cache[20] cache = team_a team_a = team_b team_b = cache } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_match_stop() { if(match_status != 0) { match_status = 0 match_id = 0 //default hostname nxn_rename() server_cmd("nxn_red [Fight stopped]") server_cmd("exec rules_ffa.cfg") set_cvar_string("nxn_m_id","0") //save_var_to_cvar() server_print("[AMX] Match stopped.") //show_match_status() } else { server_print("[AMX] No match running.") } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_match_restart() { if(match_status != 0) { match_status = 1 score_a_ct = 0 score_a_t = 0 score_b_ct = 0 score_b_t = 0 save_var_to_cvar() server_cmd("sv_restart 1") server_print("[AMX] Match restarted.") server_cmd("nxn_red [Fight reset - 1st Warmup time loaded]") set_task(3.0,"nxn_warmup") //show_match_status() } else { server_print("[AMX] No match running.") } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_rename() { if(match_status == 0) { //default hostname new servername_default[96] get_cvar_string("nxn_servername_default",servername_default,96) set_cvar_string("hostname",servername_default) server_print("[AMX] Server renamed to ^"%s^".",servername_default) } if(match_status != 0) { //default hostname new servername_prefix[96] new hostname[128] get_cvar_string("nxn_servername_prefix",servername_prefix,96) format(hostname,128,"%s %s vs %s",servername_prefix,team_a,team_b) set_cvar_string("hostname",hostname) server_print("[AMX] Server renamed to ^"%s^".",hostname) } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_warmup() { new warmup_msg[192] get_cvar_string("nxn_warmup_msg",warmup_msg,192) if(equal(warmup_msg,"")) { format(warmup_msg,192,"This server is controled by AdminBot-MX powered by NeXeN (www.nexen.org)") } remove_task(0) //warmup 1 if(match_status == 1) { server_cmd("exec rules_warmup.cfg") server_cmd("nxn_blue %s",warmup_msg) server_cmd("nxn_gold [1st Warmup : Say 'ready' when Ready]") nxn_show_commands() } //warmup 2 if(match_status == 3) { server_cmd("exec rules_warmup.cfg") server_cmd("nxn_blue %s",warmup_msg) server_cmd("nxn_gold [2nd Warmup : Say 'ready' when Ready]") nxn_show_commands() } remove_task(1) set_task(20.0,"nxn_show_teams",1) set_task(40.0,"nxn_warmup",1) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_show_teams() { //warmup 1 if(match_status == 1) { server_cmd("nxn_gold [Counter-T: %s] [Terrorist: %s]",team_a,team_b) } //warmup 2 if(match_status == 3) { server_cmd("nxn_gold [Counter-T: %s] [Terrorist: %s]",team_b,team_a) } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_show_commands() { new message[1024] add(message,1024,"Commands^n") add(message,1024,"-----------------------------------^n") if(get_cvar_num("nxn_allow_ready")) { add(message,1024,"say ready : start or restart a set.^n") } else { add(message,1024,"say ready : start a set.^n") } if(get_cvar_num("nxn_allow_stop")) { add(message,1024,"say stop : cancel ready or cancel a set (back to warmup)^n") } else { add(message,1024,"say stop : cancel ready^n") } if(get_cvar_num("nxn_allow_pause")) { add(message,1024,"say pause : automatic pause at end of round.^n") } if(get_cvar_num("nxn_allow_reset")) { add(message,1024,"say reset : reset the fight cycle.") } nxn_white_msg(message) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_end_of_match() { //end of match if(match_status == 5) { server_cmd("nxn_blue [End of Fight, you can leave this server]") set_task(20.0,"nxn_end_of_match") } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_serv_cmd(cmd[]) { server_cmd(cmd) } // ------------------------------------------------------- public nxn_ready(id) { new team[2] get_user_team(id,team,1) if(!nxn_checkminplayer()) { client_print(id,print_chat,"Sorry, there is not enough players on server (minimum %d players per team)",get_cvar_num("nxn_minplayers")) return PLUGIN_CONTINUE } if(team[0] == 'C' && team_ct_ready != 1) { //CT-team is ready if(match_status == 1) { server_cmd("nxn_gold [%s ready for Fight]",team_a) team_ct_ready = 1 } else if(match_status == 2 && get_cvar_num("nxn_allow_ready")) { server_cmd("nxn_gold [%s want a new Restartround]",team_a) team_ct_ready = 1 } else if(match_status == 3) { server_cmd("nxn_gold [%s ready for Fight]",team_b) team_ct_ready = 1 } else if(match_status == 4 && get_cvar_num("nxn_allow_ready")) { server_cmd("nxn_gold [%s want a new Restartround]",team_b) team_ct_ready = 1 } else { if(get_cvar_num("nxn_allow_ready")) { client_print(id,print_chat,"Sorry, you are not in warmup or fight time.") } else { client_print(id,print_chat,"Sorry, you are not in warmup time.") } } } else if(team[0] == 'T' && team_t_ready != 1) { //T-team is ready if(match_status == 1) { server_cmd("nxn_gold [%s ready for Fight]",team_b) team_t_ready = 1 } else if(match_status == 2 && get_cvar_num("nxn_allow_ready")) { server_cmd("nxn_gold [%s want a new Restartround]",team_b) team_t_ready = 1 } else if(match_status == 3) { server_cmd("nxn_gold [%s ready for Fight]",team_a) team_t_ready = 1 } else if(match_status == 4 && get_cvar_num("nxn_allow_ready")) { server_cmd("nxn_gold [%s want a new Restartround]",team_a) team_t_ready = 1 } else { if(get_cvar_num("nxn_allow_ready")) { client_print(id,print_chat,"Sorry, you are not in warmup or fight time.") } else { client_print(id,print_chat,"Sorry, you are not in warmup time.") } } } //show_match_status() if(team_ct_ready == 1 && team_t_ready == 1) { if(match_status == 1) { match_status = 2 } else if(match_status == 3) { match_status = 4 } team_ct_ready = 0 team_t_ready = 0 nxn_dlb_rs() } //client_print(id,print_console,"[AMX] Your team is %s",team) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_stop(id) { new team[2] get_user_team(id,team,1) if(team[0] == 'C' && team_ct_ready != -1) { //CT-team is not ready if(match_status == 1) { server_cmd("nxn_red [%s not ready for Fight]",team_a) team_ct_ready = -1 } else if(match_status == 2 && get_cvar_num("nxn_allow_stop")) { server_cmd("nxn_red [%s want to cancel this set]",team_a) team_ct_ready = -1 } else if(match_status == 3) { server_cmd("nxn_red [%s ready for Fight]",team_b) team_ct_ready = -1 } else if(match_status == 4 && get_cvar_num("nxn_allow_stop")) { server_cmd("nxn_red [%s want to cancel this set]",team_b) team_ct_ready = -1 } else { if(get_cvar_num("nxn_allow_stop")) { client_print(id,print_chat,"Sorry, you are not in warmup or fight time.") } else { client_print(id,print_chat,"Sorry, you are not in warmup time.") } } } else if(team[0] == 'T' && team_t_ready != -1) { //T-team is not ready if(match_status == 1) { server_cmd("nxn_red [%s not ready for Fight]",team_b) team_t_ready = -1 } else if(match_status == 2 && get_cvar_num("nxn_allow_stop")) { server_cmd("nxn_red [%s want to cancel this set]",team_b) team_t_ready = -1 } else if(match_status == 3) { server_cmd("nxn_red [%s not ready for Fight]",team_a) team_t_ready = -1 } else if(match_status == 4 && get_cvar_num("nxn_allow_stop")) { server_cmd("nxn_red [%s want to cancel this set]",team_a) team_t_ready = -1 } else { if(get_cvar_num("nxn_allow_stop")) { client_print(id,print_chat,"Sorry, you are not in warmup or fight time.") } else { client_print(id,print_chat,"Sorry, you are not in warmup time.") } } } //show_match_status() if(team_ct_ready == -1 && team_t_ready == -1) { if(match_status == 2) { match_status = 1 server_cmd("nxn_red [Fisrt set canceled - Warmup time loaded]") nxn_warmup() } else if(match_status == 4) { match_status = 3 server_cmd("nxn_red [Second set canceled - Warmup time loaded]") nxn_warmup() } team_ct_ready = 0 team_t_ready = 0 } //client_print(id,print_console,"[AMX] Your team is %s",team) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_reset(id) { if(!get_cvar_num("nxn_allow_reset")) { return PLUGIN_CONTINUE } new team[2] get_user_team(id,team,1) if(team[0] == 'C' && team_ct_ready != -1) { //CT-team is not ready team_ct_ready = -2 if(match_status == 2) { server_cmd("nxn_red [%s want to reset the Fight]",team_a) } if(match_status == 3 || match_status == 4) { server_cmd("nxn_red [%s want to reset the Fight]",team_b) } if(match_status < 1) { client_print(id,print_chat,"Sorry, can't reset until fisrt set is not load.") } } else if(team[0] == 'T' && team_t_ready != -1) { //T-team is not ready team_t_ready = -2 if(match_status > 1) { server_cmd("nxn_red [%s want to reset the Fight]",team_b) } if(match_status == 3 || match_status == 4) { server_cmd("nxn_red [%s want to reset the Fight]",team_a) } if(match_status < 1) { client_print(id,print_chat,"Sorry, can't reset until fisrt set is not load.") } } //show_match_status() if(team_ct_ready == -2 && team_t_ready == -2) { team_ct_ready = 0 team_t_ready = 0 nxn_match_restart() } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_dlb_rs() { server_cmd("nxn_gold [3 Restarts and Go]") server_cmd("exec rules_%s.cfg",match_rules) server_cmd("exec rules_%s.cfg",match_rules) //show_match_status() remove_task(2) set_task(4.0,"nxn_serv_cmd",2,"sv_restart 1",20) set_task(6.0,"nxn_serv_cmd",2,"sv_restart 1",20) set_task(8.0,"nxn_serv_cmd",2,"sv_restart 1",20) set_task(10.0,"nxn_serv_cmd",2,"nxn_gold [Fight !!]",20) return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_match_report() { if(match_status != 0) { server_print("nxn_match_report = ^"%s;%s;%s;%d;%s;%d;%d;%d;%d;%d;%d;%s;^"", team_a,team_b,match_map,get_cvar_num("nxn_maxrounds"),match_passwd, match_id,match_status,score_a_ct,score_a_t,score_b_ct,score_b_t,match_rules) } else { server_print("[AMX] No match running.") } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_splash() { server_print("===================================================") server_print(" _______ ______ __ __ ______ _______ ") server_print(" / _ // ____// /\ / /\/ ____// _ /\ ") server_print(" / // // /\_ /_ /_/ _/ / /\_ / // / / ") server_print(" / // // ___/\_\/___ /_\/ ___/\/ // / / ") server_print(" / // // /\__\/ _/\_/ // /\__\/ // / / ") server_print(" /__//__//_____//_/\\/ /_//_____//__//__/ / ") server_print(" \__\\__\\_____\\_\/ \_\\_____\\__\\__\/") server_print(" www.NeXeN.org") server_print(" #NeXeN on Quakenet") server_print("===================================================") server_print(" NeXeN AdminBot-MX Script Loaded") server_print("===================================================") server_print(" By Syam (jhuwette@free.fr)") server_print("===================================================") return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_help() { server_print("===================================================") server_print(" NeXeN AdminBot AMX-Script Command List:") server_print("===================================================") server_print(" - nxn_blue ") server_print(" - nxn_gold ") server_print(" - nxn_red ") server_print(" - nxn_dbl ") server_print(" - nxn_clexec ") server_print(" - nxn_match [match_id]") server_print(" - nxn_match_restart") server_print(" - nxn_match_stop") server_print(" - nxn_rename") server_print(" - nxn_kickall") server_print(" - nxn_kick_ct") server_print(" - nxn_kick_t") server_print(" - nxn_force ") server_print(" - nxn_reforce") server_print("===================================================") return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_isrunning() { server_print("1") return PLUGIN_CONTINUE } public nxn_load_cfg() { if(!get_cvar_num("nxn_autoexec")) { server_cmd("exec server.cfg") server_cmd("nxn_autoexec 1") } return PLUGIN_CONTINUE } // ------------------------------------------------------- // Swap_team function from Match Deluxe plugin public swap() { new playersCT[32] new playersT[32] new nbrCT,nbrT get_players(playersCT,nbrCT,"e","CT") get_players(playersT,nbrT,"e","TERRORIST") for(new i = 0; i < nbrCT; i++) { engclient_cmd(playersCT[i], "chooseteam") engclient_cmd(playersCT[i], "menuselect", "1") engclient_cmd(playersCT[i], "menuselect", "2") } for(new i = 0; i < nbrT; i++) { engclient_cmd(playersT[i], "chooseteam") engclient_cmd(playersT[i], "menuselect", "2") engclient_cmd(playersT[i], "menuselect", "4") } return PLUGIN_CONTINUE } public swap_teams() { client_print(0,print_chat,"Switching teams ...") set_cvar_string("mp_limitteams","0") set_cvar_string("mp_autoteambalance","0") server_cmd("sv_restart 1") set_task(1.5,"swap") return PLUGIN_CONTINUE } // ------------------------------------------------------- public select_team(str_id[]) { new menu_msg[256] new dec_id dec_id = str_to_num(str_id) //server_print("Debug select_team: id, %s, %d",str_id,dec_id) if(match_status == 1 || match_status == 2) { format(menu_msg,255,"\ySelect your Team:\w^n^n1. %s (CT)^n2. %s (TERRORIST)^n^n",team_a,team_b) } if(match_status == 3 || match_status == 4) { format(menu_msg,255,"\ySelect your Team:\w^n^n1. %s (TERRORIST)^n2. %s (CT)^n^n",team_a,team_b) } show_menu(dec_id,(1<<0|1<<1),menu_msg,-1) return PLUGIN_CONTINUE } public set_team(id,key) { if(match_status == 1 || match_status == 2) { if (key == 1) { client_cmd(id, "chooseteam") client_cmd(id, "menuselect 1") } else if(key == 0) { client_cmd(id, "chooseteam") client_cmd(id, "menuselect 2") } } else if(match_status == 3 || match_status == 4) { if (key == 1) { client_cmd(id, "chooseteam") client_cmd(id, "menuselect 2") } else if(key == 0) { client_cmd(id, "chooseteam") client_cmd(id, "menuselect 1") } } return PLUGIN_HANDLED } // ------------------------------------------------------- public pause_server(id) { if(!get_cvar_num("nxn_allow_pause")) { return PLUGIN_CONTINUE } if(match_status == 2 || match_status == 4) { if(!id) { id = find_player("h") if (!id) { return PLUGIN_CONTINUE } } set_cvar_num("pausable",1) client_cmd(id,"pause") } return PLUGIN_CONTINUE } public request_pause(id) { if(!get_cvar_num("nxn_allow_pause")) { return PLUGIN_CONTINUE } if(match_status == 2 || match_status == 4) { set_cvar_num("nxn_pauseonnextround",1) client_print(0,print_chat,"Server will be paused at the end of this round.") //client_cmd(id,"pause") } return PLUGIN_CONTINUE } public round_start() { if(get_cvar_num("nxn_pauseonnextround")) { // Disengaged the autopause //server_cmd("nxn_red [Automatic Pause Disengaged]") set_cvar_num("pausable",0) set_cvar_num("nxn_pauseonnextround",0) } return PLUGIN_CONTINUE } public round_end() { if(get_cvar_num("nxn_pauseonnextround") && (match_status == 2 || match_status == 4)) { // Pause the server server_cmd("nxn_red [Automatic Pause Engaged]") set_task(1.0,"pause_server",1,"0") } return PLUGIN_CONTINUE } // ------------------------------------------------------- public nxn_kickall() { server_cmd("nxn_clexec echo All players kicked by console.") server_cmd("nxn_clexec disconnect") server_print("[AMX] All players kicked.") return PLUGIN_CONTINUE } public nxn_kick_ct() { new players[32],players_number get_players(players,players_number,"e","CT") for(new i = 0 ; i < players_number ; i++) { client_cmd(players[i],"echo All Counter-T players kicked by console.") client_cmd(players[i],"disconnect") } server_print("[AMX] All Counter-T players kicked.") return PLUGIN_CONTINUE } public nxn_kick_t() { new players[32],players_number get_players(players,players_number,"e","T") for(new i = 0 ; i < players_number ; i++) { client_cmd(players[i],"echo All Terrorist players kicked by console.") client_cmd(players[i],"disconnect") } server_print("[AMX] All Terrorist players kicked.") return PLUGIN_CONTINUE } // ------------------------------------------------------- //from Djeyl wwcl-like AMX script, thanks to him. public nxn_force(id) { new arg[32] //cvar name read_argv(1,arg,31) copy(cfg_force[cfg_force_num],31,arg) //cvar value read_argv(2,arg,31) copy(cfg_vforce[cfg_force_num],31,arg) //increment cfg_force_num++ return PLUGIN_CONTINUE } public do_client_forcing(id) { if(is_user_hltv(id)) { return PLUGIN_HANDLED } new username[32] get_user_name(id,username,31) for(new i = 0 ; i < cfg_force_num ; i++) { //forcing //server_print("%s %s",cfg_force[i],cfg_vforce[i]) client_cmd(id,"%s %s",cfg_force[i],cfg_vforce[i]) //blocking //server_print("alias %s ^"[AMX] %s is blocking to %s^"",cfg_force[i],cfg_force[i],cfg_vforce[i]) client_cmd(id,"alias %s ^"echo [AMX] %s is forced to %s^"",cfg_force[i],cfg_force[i],cfg_vforce[i]) } client_cmd(id,"echo [AMX] Configuration forced.") server_print("[AMX] Configuration forced on ^"%s.^"",username) return PLUGIN_HANDLED } public nxn_reforce() { new players[32],players_number get_players(players,players_number,"c") for(new i = 0 ; i < players_number ; i++) { do_client_forcing(players[i]) } return PLUGIN_HANDLED } // ------------------------------------------------------- public nxn_checkminplayer() { new players[32],players_number,minplayer_cvar minplayer_cvar = get_cvar_num("nxn_minplayers") // Check CTs get_players(players,players_number,"e","CT") if(players_number < minplayer_cvar) { return 0 } // Check Ts get_players(players,players_number,"e","TERRORIST") if(players_number < minplayer_cvar) { return 0 } return 1 } // ------------------------------------------------------- public show_match_status() { //because there is a bug with steam :) return PLUGIN_HANDLED new final_status[256] new status[32] new team_a_status[32] new team_b_status[32] if(match_status == 1){format(status,32,"1st Warmup");} if(match_status == 2){format(status,32,"1st Set");} if(match_status == 3){format(status,32,"2nd Warmup");} if(match_status == 4){format(status,32,"2nd Set");} if(match_status == 5){format(status,32,"Finished");} if(match_status == 1 || match_status == 2) { if(team_ct_ready == 0) {format(team_a_status,32,"");} if(team_ct_ready == 1) {format(team_a_status,32,"ready");} if(team_ct_ready == -1){format(team_a_status,32,"stop");} if(team_ct_ready == -2){format(team_a_status,32,"reset");} if(team_t_ready == 0) {format(team_b_status,32,"");} if(team_t_ready == 1) {format(team_b_status,32,"ready");} if(team_t_ready == -1) {format(team_b_status,32,"stop");} if(team_t_ready == -2) {format(team_b_status,32,"reset");} } if(match_status == 3 || match_status == 4) { if(team_ct_ready == 0) {format(team_b_status,32,"");} if(team_ct_ready == 1) {format(team_b_status,32,"ready");} if(team_ct_ready == -1){format(team_b_status,32,"stop");} if(team_ct_ready == -2){format(team_b_status,32,"reset");} if(team_t_ready == 0) {format(team_a_status,32,"");} if(team_t_ready == 1) {format(team_a_status,32,"ready");} if(team_t_ready == -1) {format(team_a_status,32,"stop");} if(team_t_ready == -2) {format(team_a_status,32,"reset");} } if(match_status != 0) { format(final_status,255,"Status: %s %s: %d %s %s: %d %s",status,team_a,(score_a_ct + score_a_t),team_a_status,team_b,(team_b,score_b_ct + score_b_t),team_b_status) } else { format(final_status,255,"") } // display match status // ... //server_print(final_status) return PLUGIN_HANDLED } public client_connect(id) { if(match_status == 1 || match_status == 2) { client_cmd(id,"echo ") client_cmd(id,"echo ") client_cmd(id,"echo NeXeN AdminBot-MX beta 2.1 (www.nexen.org)") client_cmd(id,"echo -----------------------------------------") client_cmd(id,"echo Current match: %s vs %s",team_a,team_b) client_cmd(id,"echo Counter-T: %s",team_a) client_cmd(id,"echo Terrorist: %s",team_b) client_cmd(id,"echo ") client_cmd(id,"echo ") client_cmd(id,"echo ") } if(match_status == 3 || match_status == 4) { client_cmd(id,"echo ") client_cmd(id,"echo ") client_cmd(id,"echo NeXeN AdminBot-MX beta 2.1 (www.nexen.org)") client_cmd(id,"echo -----------------------------------------") client_cmd(id,"echo Current match: %s vs %s",team_a,team_b) client_cmd(id,"echo Counter-T: %s",team_b) client_cmd(id,"echo Terrorist: %s",team_a) client_cmd(id,"echo ") client_cmd(id,"echo ") client_cmd(id,"echo ") } if(match_status != 0) { //configuration forcing do_client_forcing(id) } return PLUGIN_HANDLED } public client_putinserver(id) { if(match_status > 0) { new str_id[10] num_to_str(id,str_id,10) //server_print("Debug putinserver id: %d, %s",id,str_id) set_task(0.5,"select_team",1,str_id,10) } } public client_disconnect(id) { if(!get_cvar_num("nxn_allow_pause")) { return PLUGIN_HANDLED } if(get_cvar_num("nxn_pauseondisco") && (match_status == 2 || match_status == 4)) { set_cvar_num("nxn_pauseonnextround",1) client_print(0,print_chat,"Server will be paused at the end of this round.") return PLUGIN_HANDLED } return PLUGIN_HANDLED } // ------------------------------------------------------- public plugin_init() { register_plugin("NeXeN AdminBot","1.8","Syam") //commands register_srvcmd("nxn_gold","nxn_gold_msg") register_srvcmd("nxn_blue","nxn_blue_msg") register_srvcmd("nxn_red","nxn_red_msg") //register_srvcmd("nxn_white","nxn_white_msg") register_srvcmd("nxn_dbl","nxn_double_msg") register_srvcmd("nxn_clexec","nxn_clexec") register_srvcmd("nxn_match","nxn_match") register_srvcmd("nxn_match_restart","nxn_match_restart") register_srvcmd("nxn_match_stop","nxn_match_stop") register_srvcmd("nxn_match_report","nxn_match_report") register_srvcmd("nxn_help","nxn_help") register_srvcmd("nxn_adminbot","nxn_isrunning") register_srvcmd("nxn_rename","nxn_rename") register_srvcmd("nxn_kickall","nxn_kickall") register_srvcmd("nxn_kick_ct","nxn_kick_ct") register_srvcmd("nxn_kick_t","nxn_kick_t") register_srvcmd("nxn_force","nxn_force") register_srvcmd("nxn_reforce","nxn_reforce") register_srvcmd("nxn_swapteams","swap_teams") register_clcmd("say ready","nxn_ready") //register_clcmd("say_team ready","nxn_ready") register_clcmd("say stop","nxn_stop") //register_clcmd("say_team stop","nxn_stop") register_clcmd("say pause","request_pause") //register_clcmd("say_team pause","pause_server") register_clcmd("say reset","nxn_reset") //register_clcmd("say_team reset","nxn_reset") //register_clcmd("say team","select_team") //register_clcmd("ex_extrapmax","alert_extrap") //register_clcmd("ex_interp","alert_interp") //events register_event("TeamScore","team_score","a") //register_event("ResetHUD", "Round_start", "b") register_logevent("round_start",2,"1=Round_Start") register_logevent("round_end",2,"1=Round_End") /* register_menucmd(register_menuid("ySelect your team: "),(1<<0)|(1<<1),"set_team") register_event("ShowMenu","select_team","b","4&Team_Select") register_event("VGUIMenu","select_team","b","1=2","1=26","1=27") */ register_menucmd(register_menuid("ySelect your Team:"),(1<<0|1<<1),"set_team") //register_event("ShowMenu","select_team","b","4&Team_Select") //register_event("VGUIMenu","select_team","b","1=2","1=26","1=27") //cvars register_cvar("nxn_team_a","") register_cvar("nxn_team_b","") register_cvar("nxn_map","") register_cvar("nxn_maxrounds","12") register_cvar("nxn_rules","") register_cvar("nxn_passwd","") register_cvar("nxn_m_id","0") register_cvar("nxn_warmup_msg","") register_cvar("nxn_score_a_ct","0") register_cvar("nxn_score_a_t","0") register_cvar("nxn_score_b_ct","0") register_cvar("nxn_score_b_t","0") register_cvar("nxn_servername_default","Counter-Strike 1.6 Server with AdminBot-MX") register_cvar("nxn_servername_prefix","War:") register_cvar("nxn_allow_ready","1") register_cvar("nxn_allow_stop","1") register_cvar("nxn_allow_pause","1") register_cvar("nxn_allow_reset","1") register_cvar("nxn_autoexec","0") register_cvar("nxn_minplayers","0") register_cvar("nxn_autoswapteams","0") register_cvar("nxn_pauseondisco","0") register_cvar("nxn_pauseonnextround","0") //tasks set_task(0.0,"chk_match") set_task(3.0,"nxn_splash") set_task(3.5,"nxn_load_cfg") //reinitialisation du compteur des cvars cfg_force_num = 0 server_cmd("exec client_force.cfg") return PLUGIN_CONTINUE }