/* AMX MOD script. * * Originally coded by Shromilder * Upgraded and converted to Amx Mod X by Infra * Converted to AMX Mod by KRoT@L * * Current version: 6.01 * * This file is provided as is (no warranties). * * -=[ AMX Match Deluxe ]=- * * -- Works with AMX 2005 or more only! -- * -- Requires admin level "m" -- * * * * --- Optional Module: --- * ------------------------- * * - Sockets * * * Note: To use the HLTV ability, you need the Sockets module, which is included with Amx Mod, as of v2005.1. * /!\ IF YOU DON'T WANT TO USE SOCKETS MODULE (FOR THE HLTV), YOU HAVE TO COMMENT THE LINE "#define USE_HLTV_SECTION" AND RECOMPILE THE PLUGIN (read the AMX readme/doc). /!\ * * * This plug-in allows you to play matchs in MaxRound (warmup, CT, warmup2, Terrorist) or TimeLimit. * * Plugin supports: * ----------------- * - Changing of the server hostname * - Changing of the server password * - Shield (re)restrictions * - Swapping the teams * - Overtime * - Overtime configs * - Match server configs * - Default(FFA) server config * - Screenshots * - Demos, In-eyes and HLTV * - A Menu * * Installation: * -------------- * - Copy amx_match_deluxe.amx to your plugins directory * - Add this line to your plugins.ini file: * * amx_match_deluxe.amx ; Amx Match Deluxe * * - Copy the amxmd folder to "addons/amx/config/amxmd" * - Enable the correct modules in the modules.ini file (meaning Sockets with the compiled plugin included in the zip file) * - Restart hlds * - Then you should be good to go :) * * * Usage: * ------- * * To load a match: * ----------------- * * amx_match [recdemo|rechltv|recboth] * * - or - * * amx_match2 [recdemo|rechltv|recboth] * * * For example: * -------------------- * * amx_match SK eoL mr12 ecup recboth * * * This will load a match with teams: "SK" and "eol", with MaxRound 12 rule, * using the ecup.cfg server config file, and will record demos and HLTV demos. * * Note: if your clan tag has a space, use quote marks: "SK swe" * * To restart a match: amx_matchrestart * To stop a match: amx_matchstop or "say /stop" * To force the start of a match: amx_matchstart or "say /start" * To swap teams: amx_swapteams * * * The Menu: * ---------- * First you must configure the menu, by using these commands: * * amx_match_tmenu [ ...] * amx_match_cmenu * * Note: Concretely, add them to the amxmd.cfg file (Most are already added to the config file, feel free to add your own)... * * When it's done, just use amx_matchmenu command and the menu will popup, allowing you to choose your match :). * * * Cvars: * ------- * amx_match_endtype: * Maxround: * 0 -> the match is finished after all rounds are played. (set by default) * 1 -> the match is finished when a team has won mp_maxrounds+1 rounds. * 2 -> there is a vote to play out the match after a team has won maxrounds+1 rounds, unless rounds played is less than 1/5 of total rounds away from end of match). * * Timelimit: * 0 -> the match is finished immediately after the timelimit is up. (set by default) * 1 -> the match is finished at end of the last round. * * amx_match_hostname: 0 -> Does not change host name of server. * 1 -> Changes host name of server to " vs. | CS Match In Progress" or (amx_match2) " CS Match In Progress". (set by default) * * amx_match_hltvdelay: Only used in the HLTV section. If you commented the line to turn the hltv off, don't worry about this cvar * This is the delay for the hltv server to delay the demo (30 by default). * * amx_match_overtime: 0 -> there is no overtime if there's a draw (set by default). * 1 -> there is an overtime after a draw match. * * amx_match_overtimecfg: Only use if you set amx_match_overtime to 1 * 0 -> there is no overtime config (set by default). * 1 -> there is an overtime config. * * amx_match_otrounds: Only used if you've set amx_match_overtime to 1. * This is the number of rounds which are played during the maxround overtime (3 by default). * * amx_match_password: 0 -> match plugin will not password server before match. * 1 -> match plugin will password server before match, use with amx_match_password2. (set by default) * * amx_match_password2: Only use this cvar if you set amx_match_password to 1. * Use this cvar to set the value of password. (default value is "scrim") * * amx_match_playerneed: Only used if you've set amx_match_readytype to 1. * This is the number of players which have to be ready (default value is "10"). * (Set it to 4 if you want to play a 2 vs 2 match for example.) * * amx_match_readytype: 0 -> only one player of each side must say ready for the match to begin. * 1 -> ALL players much say ready in order to start the match (set by default). * 2 -> only an AMX admin can start the match by saying /start or amx_matchstart * * amx_match_swaptype: 0 -> teams will not swap after the 1st half. * 1 -> teams will swap automatically after the 1st half (set by default). * * amx_match_screenshot: 0 -> no screenshot at all. * 1 -> screenshot of the score is taken at the end of each half (set by default). * 2 -> screenshot of score, including userids, is taken at the end of each half. * * amx_match_screenshot2: 0 -> no screenshot if match is stopped using amx_match_stop or "say /stop" . * 1 -> screenshot of the score is taken at the end of each half, even if match is stopped using amx_match_stop or "say /stop" (set by default). * * amx_match_shield: This cvar only works with CS 1.6. * 0 -> you can't use the shield during the match (set by default). * 1 -> you can use the shield during the match. * * amx_match_shield2: This cvar only works with CS 1.6. * 0 -> unrestricts shield after match. * 1 -> (re)restricts shield after match (set by default). * * amx_match_showscore: 0 -> Score will not be show after each round . * 1 -> Score is shown after each round (set by default). * * * For MaxRound: * -------------- * When a match is loaded, warmup time begins and match server config is loaded. * Then, when one player of each team says 'ready' (depends on readytype cvar), the 1st half of the match starts. * When the maxround limit is reached, the match goes back to warmup. * Then, when both teams say 'ready' again, the 2nd half starts. * When the game is finished, the plugin tells you which team has won the match and loads FFA server config file. * The plugin also records both side demos if you want it. * * For TimeLimit: * --------------- * When a match is loaded, warmup time begins and match server config is loaded. * Then, when one player of each team says 'ready' (depends on readytype cvar), the plugin starts the match * When the timelimit is up, the match goes back into warmup. * Then, when both teams say 'ready' again, the 2nd half starts * When the game is finished, the plugin tells you which team has won the match and loads FFA server config file. * The plugin also records both side demos if you want it. * * * Config Files: * -------------- * There are some special config files: * - default.cfg is a server config file which is executed before every games. * It can be used to disable some plug-ins like stats or set some default cvars * which will erase your match config file cvars * - ffa.cfg is the server config file which is executed at the end of the match * in order that your server can be played by everyone =) * - cfglist.txt is the list of your available config files. * It is shown when you type a wrong config file when you're trying to load a match. * So if you don't want to remember the name of all your server config files, * just add them into this file =) * * All config files, except 'amxmd.cfg' and 'hltv.ini', need to be in the "addons/amx/config/amxmd/leagues/" folder * and have .cfg extension (/!\ This is case sensitive so .CFG will not work! /!\) * * (The 'amxmd.cfg' and 'hltv.ini' config files go in the "addons/amx/config/amxmd" folder) * * * HLTV help: * ----------- * /!\ IF YOU DON'T WANT TO USE SOCKETS MODULE (FOR THE HLTV), YOU HAVE TO COMMENT THE LINE "#define USE_HLTV_SECTION" AND RECOMPILE THE PLUGIN (read AMX readme/doc). /!\ * * To configure your HLTV: * In order to be able to control the HLTV, you must know the rcon password. HLTV rcon can be set using "adminpassword" command in the HLTV console * * HLTV Checklist: * ---------------- * - Load your HLTV. * - Set the HLTV adminpassword by using adminpassword command in the HLTV console. * - Then connect the HLTV to your server using "connect ip:port" in the HLTV console. * - Set the HLTV adminpassword in the 'hltv.ini' config file. * - Load your match on the server using amx_match or amx_match2 * - Then: * 1. If your HLTV is already connected, you should see it say "HLTV correctly configured =)". * 2. If you don't see that, it means that the HLTV adminpassword hasn't been correctly configured. * 3. If your HLTV isn't connected, it will try the adminpassword that you've set when it enters the server. * * * * Changelog: * ---------- * * - 6.01: (minor bug fix) - Monday, August 1st, 2005 * fixed plugin settings menu for multipule bugs, including no second page and not working with no steam. Thanks for the heads up TheRising * * ---------- * * - 6.00: (major release) - Sunday, July 24th, 2005 * fixed force-start functions. Plugin now ignores more than one (1) force-start command * fixed demo menu. You can now start a match from the menu without being required to record a demo * fixed restart function where if a timelimit match is restarted it would become a maxround match * fixed typo in command description ( "cl" --> "tl" ) * --- * changed timelimit matches to have a timer and be on the same map for the whole match. (Major) * --- * added functionality to amx_match_endtype so that it pertains to timelimit matches as well * added swedish translations to plugin. Thanks Sunner * * ---------- * * - 5.00: (major release) - Saturday, April 30th, 2005 * cleaned up code * --- * removed includes for 'engine' and 'cstrike', these modules are not required anymore. * removed a few global variables. * --- * added amx_match_hltvdelay to the plugin settings menu * added require_module function calls, so people won't get confused when they don't enable the regex or sockets modules * --- * changed format of hltv.ini to be more user-friendly (in the format of: " ") * changed format of the action_main_menu to match display_main_menu (easier to take care of now) * changed the three 'plugin settings menu' functions to one function * --- * fixed hltv code again to allow for disabling the Sockets module, thanks for the heads-up V!PER... * fixed bug in main menu, during a half, where Swap teams would bring up the settings menu * fixed and added to the readme to reflect changes * * ---------- * * - 4.00: (major release) * added multi-lingual functionality * added hltv.ini config file, for the hltv admin password * --- * changed swap teams so that if a player had vGUIs turned on it won't make them old-style * --- * fixed hltv code to allow for hltv and server consoles with the same ip address, Thanks Ramm... * * ---------- * * - 3.00: (major release) * added new command: amx_matchsave, which will save your current cvar configuration to amxmd.cfg * added menu item to main AMXX menu. (amxmodmenu) * added support for hltv, using the sockets module. - Thanks redmist... * added amxmd.cfg file - Thanks V!PER... * added "Save configuration" menu option in the Plugin settings menu. (Save your current configuration to the amxmd.cfg file) * --- * changed the readme to be easier to understand * changed behavior of menu cfg file and type adders; the adder functions will not add the cfg's or types if the cfg or type is already in the menu... * changed location of config files to be /amxmd/[leagues] * changed name of menu command from 'amx_match_menu' to 'amx_matchmenu' to match the naming convention of other commands * changed name of hltv command from 'amx_match_hltv' to 'amx_matchhltv' to match the naming convention of other commands * --- * fixed bug in clantags finder functions; they actually find the clan tags now ^_^. * fixed bugs in voting functions, rofl: version 3 ^_^ - Thanks breaddawson... * * ---------- * * - 2.01: fixed string bug in back_to_ffa(), where there was no '%s' >_<. * added match_restart to amx_match_menu. * * ---------- * * - 2.00: (major release) * added support for restarting the match. * added support for show activity, if on. * added cvars that were not previously in the menu, to the menu. * --- * changed behavior of amx_match_password2 and amx_match_password for more fluid execution and easier to remember. * --- * fixed version number bug in register plugin command. * fixed bug where hostname would not be changed back to original hostname after match, if changed by match plugin. * fixed bug where the vote, for playout, would happen even if there were 3 or 4 (total-rounds divided by 5 minus 1) or (30/5) - 1 = 5) rounds left in the match. version 2 ^_^ * fixed bug where vote to play out would happen even if end_type = 0 * fixed "un/passwording" of server after match, used same method as hostname fix to add/remove password at end of match. * * ---------- * * - 1.81: fixed readme file to reflect changes that will be in AMXX 0.20. * added amx_match_password and amx_match_password2 cvars * added support for "passwording" the server. * - 1.80: fixed bug where overtime config file was execed even in regular match time. * - 1.79: added support for overtime config files. * added amx_match_overtimecfg to turn [on|off] overtime config files. * - 1.78: fixed typos. * - 1.77: better code. * fixed bug where the vote, for playout, would happen even if there were 3 or 4 rounds left in the match. * - 1.76: added amx_match_shield2 cvar, unrestricts or (re)restricts shield after the match * - 1.75: added compatibility with AmxModX 0.16 * - 1.74: added the ability to vote to play out the match. (Use amx_match_endtype) * - 1.73: added amx_match_screenshot2 to take end-half screenshots even if match is stopped using amx_match_stop or "say /stop" * - 1.72: added amx_match_hostname cvar to have the server change it's name based on who is playing. * added "say /stop" command in addition to amx_match_stop. * - 1.71: added the possibility to change match settings in the menu (it just change them, it doesn't save them anywhere so after a changelevel, all is lost). * added amx_match_shield cvar to allow or not the use of the shield during the match. * * ---------- * * - 1.70: trying to make it 1.6 compatible: * stoprecord changed to stoprecording if using 1.6 * cancelselect used for the screenshots if using 1.6 * changed the hud msgs for 1.6 (readylist not yet done) * score msg is a hud msg if using 1.6 * - 1.69: better code. * - 1.68: if a player is already recording his own demo, then it's stopped to record a correct one. * changed the score display. * some bugs fixed & small changes. * - 1.67: the cvar amx_match_showids has been changed to amx_match_screenshot which allow you to choose if you want to take a screenshot or not. * added overtime support with amx_match_overtime & amx_match_otrounds cvars. To respect clantags, the team which must start the overtime as CT * must be the team which started the match as CT (if you don't use clantags, there's no problem). * - 1.66: changed showids. it now takes a screenshot of 'status' in the console * - 1.65: added clantag recognition in the menu * - 1.62: added the possibility to show score after each rounds using amx_match_showscore cvar (default is off) * - 1.61: added the option to see wonid using amx_match_showids cvar (default is off) * - 1.60: added the ability to use UDP module or not (so in fact, use hltv feature or not) * - 1.54: corrected demo not stopping when the match is stoped. * added amx_matchstart command which force the start of a match * - 1.52: modified the menu, added HLTV help * - 1.51: fixed HLTV record demo & some other bugs (thx to en3my for HLTV) * - 1.50: HLTV demos \o/ recdemo will record players demos. rechltv will record HLTV demos. recboth will record HLTV and players demos. * - 1.46: added amx_match_swaptype * - 1.45: added admin start with say & menu (amx_match_readytype 2) * - 1.44: some modifications. HLTV soon! * - 1.43: removed a possible bug (warmup msg during match) * - 1.42: corrected swapteam command: now it check if the user using it is an admin (stupid me :/) * - 1.41: removed an horrible bug (changing map before the match) >:[ * - 1.40: added amx_match_menu which allow to load a match with a menu =] * - 1.30: added amx_match_readytype & amx_match_playerneed cvars which allow that everyone must say ready * - 1.21: added notready feature which allow a team or a player to remove their ready flag * - 1.20: added amx_match_endtype cvar & fixed some bugs like recording demos with voicecom on. * - 1.10: added amx_match2 and amx_swapteams command, added screenshots feature * - 1.02: other bugs removed, less warmup msg flood * - 1.01: added log commands, small bug removed * - 1.00: first release * * To do: * ------- * * - Allow double maps matches: * amx_match3 [recdemo|rechltv|recboth] * amx_match4 [recdemo|rechltv|recboth] * */ // COMMENT THIS LINE IF YOU DON'T WANT TO USE THE SOCKETS MODULE (add '//' in front of it) AND RECOMPILE THE PLUGIN //#define USE_HLTV_SECTION #include #include #include #if defined USE_HLTV_SECTION #include // Using hltv? #endif /* * * Variables and Defines * */ #define MAX_VARS 64 // Maximum variables for the menu #define MAX_TAGS 20 // Maximum of tags in the menu #define MIN_TAG_LENGTH 3 // The minimum length of a tag (number of same letters) // Custom directory for the config files new customdir[64] // Configs new cmdtype = 0 // 1 -> amx_match, 2 -> amx_match2 new match_inprogress = 0 // 0 -> No match, 1 -> Warmup #1, 2 -> 1st half, 3 -> Warmup #2, 4 -> 2nd half new teams_ready = 0 // 0 -> None, 4 -> CT ready, 8 -> T ready new ready_type = 0 // 0 -> Only one, 1 -> All players, 2 -> Admin starts it new swap_type = 0 // 1 -> Teams are swapped after first half, 0 -> They aren't new players_ready[33] // List of userid of players which are ready new ready_CT_names[256] // List of name of CT which are ready new ready_T_names[256] // List of name of T which are ready new end_type = 0 // 0 -> Match ends after all rounds played, 1 -> Match ends after mp_maxrounds+1 rounds won, 2 -> There is a vote to play out the match after mp_maxrounds+1 rounds won. new ct_score[2], t_score[2] // Scores during match new clanCT[32],clanT[32] // Clan Names new cfgfile[32],cfgfile2[64] // Config file names new matchtype1,matchtype2 // 1 -> mr, 2 -> tl new recdemo // 0 -> None, 1 -> In-eyes, 2 -> HLTV, 3 -> Both, In-eyes and HLTV new checktype[32], checktype2[32] // Match type, used to check between mr and tl new in_overtime = 0 // 1 -> playing overtime, 0 -> no overtime new in_overtime2 = 0 // 1 -> in overtime right now, 0 -> no new overtime_score = 0 // Overtime score new server_pass[32] // Server password during match new match_command[256] // Used for restarting the match (server command) new seconds // Used for the timer for tl matches #if defined NO_STEAM new StatusTextid // used for the score msg #else new shield_type = 1 // 1 -> shield allowed, 0 -> shield not allowed new shield_type2 = 1 // 1 -> (re)restricts shield, 0 -> unrestricts shield after match #endif // Reset server... new old_serverpass[32] new old_servername[64] // Vote new g_isVoting = 0 // This flag is to check if a vote is already happening new option[10] // option[0] -> Yes's, option[1] -> No's // HLTV Stuff #if defined USE_HLTV_SECTION new hltv_id // Player ID of the HLTV new hltv_iaddress[32] // Full IP address of the HLTV, inlcuding port new hltv_ip[32] // Ip address of the HLTV new hltv_port // Port of the HLTV new hltv_file[64] // Path to HLTV file, points to 'hltv.ini' new hltv_rconPass[64] // HLTV Admin Password #endif // For force start functions new is_started = 0; // MENU new typelist[MAX_VARS][32] // List of match types new typelistpos = 0 // Position of last type added new confignamelist[MAX_VARS][32] // List of match configs names new configfilelist[MAX_VARS][32] // List of match configs filenames new configlistpos = 0 // Position of last config added new menu_position[33] // Position in menu of each players new menu_selections[33][5] // Commands selected by users new CT_tags[MAX_TAGS][32] // CT tags from tag finder functions new T_tags[MAX_TAGS][32] // T tags from tag finder functions new CT_tagspos = 0, T_tagspos = 0 // Array positions... new menuBody[512] // For Multilanguage Menu format new g_menuPosition[33] // For Plugin Settings Menu new g_logFile[16] /* * * Main Plugin * */ public set_team(id,team) { new vgui[10]; get_user_info(id,"_vgui_menus",vgui,9) user_kill(id,1) //client_cmd(id,"setinfo _vgui_menus 0;wait;wait;wait;chooseteam;wait;wait;wait;menuselect %d;wait;wait;wait;menuselect 5;wait;wait;wait;menuselect 0;wait;wait;wait;menuselect 5",(team == 1) ? 1 : 2) //client_cmd(id,"wait; wait; wait; wait; wait; wait; slot10; wait; wait; wait; wait; wait; slot10;") engclient_cmd(id,"jointeam", (team == 1) ? "1" : "2") engclient_cmd(id,"joinclass", "1") if ( str_to_num(vgui) == 1 ) { client_cmd(id,"setinfo _vgui_menus 1"); } return PLUGIN_CONTINUE } 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++) { set_team(playersCT[i], 1) } for(new i = 0; i < nbrT; i++) { set_team(playersT[i], 2) } return PLUGIN_CONTINUE } public swap_teams(id,level,cid) { if (!cmd_access(id,level,cid,1)) { return PLUGIN_HANDLED } new name[32] get_user_name(id,name,31) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,"%s %s: %s", _T("ADMIN"), name, _T("switched the teams")) case 1: client_print(0,print_chat,"%s %s", _T("ADMIN"), _T("switched the teams")) } client_print(0,print_chat,"* [AMX MATCH] %s !...", _T("Switching teams")) set_cvar_string("mp_limitteams","0") set_cvar_string("mp_autoteambalance","0") restart_round("1") swap() restart_round("1") return PLUGIN_CONTINUE } public restart_round(time[]) { server_cmd("sv_restartround %s",time) return PLUGIN_CONTINUE } public voice_enable(time[]) { server_cmd("sv_voiceenable %s",time) return PLUGIN_CONTINUE } #if defined USE_HLTV_SECTION public hltv_help(idt[]) { new ident = str_to_num(idt) console_print(ident,"* %s", _T("In order to properly record HLTV demos, an HLTV must be connected on the server before each half and it must have an adminpassword (use adminpassword in the HLTV console in order to set it).^n* Now you have to type the adminpassword of the HLTV here.^n* Use amx_matchhltv to set it.^n* If you don't do it, HLTV demos will never be recorded.")) return PLUGIN_CONTINUE } public hltv_rcon_cmd(cmd[], id) { if (hltv_id == 0) { client_print(id, print_console, "* %s", _T("No HLTV currently connected to the server")) } else { new hltv_address = 0 new error new rconid[13] new rcv[256],snd[256] // Connect to HLTV Proxy hltv_address = socket_open(hltv_ip, hltv_port, SOCKET_UDP, error) if (error != 0) { client_print(id, print_console, "* %s - %s %i", _T("HLTV Proxy Connection Failed") , _T("error"), error) return PLUGIN_CONTINUE } //send challenge rcon and receive response setc(snd,4,0xff) copy(snd[4],255,"challenge rcon") setc(snd[18],1,'^n') socket_send(hltv_address,snd,255) socket_recv(hltv_address,rcv,255) // get hltv rcon challenge number from response copy(rconid,12,rcv[19]) replace(rconid,255,"^n","") // set rcon command setc(snd,255,0x00) setc(snd,4,0xff) format(snd[4],255,"rcon %s %s %s^n",rconid,hltv_rconPass,cmd) // send rcon command and close socket socket_send(hltv_address,snd,255) socket_close(hltv_address) } return PLUGIN_CONTINUE } #endif public rec_demos() { new demoname[256],curmap[32],time_date[32] get_mapname(curmap,31) get_time("%Y.%m.%d-%H.%M.%S",time_date,31) #if defined USE_HLTV_SECTION new cmd[512] if (recdemo > 1) { // HLTV demos if (cmdtype == 1) format(demoname,255,"%s(%s)_%s(%s)_%s_HLTV_%s.dem",clanCT,(match_inprogress==1) ? "CT" : "T",clanT,(match_inprogress==1) ? "T" : "CT",curmap,time_date) else format(demoname,255,"%s_part%i_HLTV_%s.dem",curmap,(match_inprogress==1) ? 1 : 2,time_date) // Remove bad strings before recording while(replace(demoname,255,"/","-")) {} while(replace(demoname,255,"\","-")) {} while(replace(demoname,255,":","-")) {} while(replace(demoname,255,"*","-")) {} while(replace(demoname,255,"?","-")) {} while(replace(demoname,255,">","-")) {} while(replace(demoname,255,"<","-")) {} while(replace(demoname,255,"|","-")) {} while(replace(demoname,255," ","-")) {} format(cmd,511,"say * [AMX MATCH] %s : %s", _T("Recording a demo",0), demoname) hltv_rcon_cmd(cmd,0) format(cmd,511,"record %s",demoname) if (task_exists(3388442)) { set_task(float(get_cvar_num("amx_match_hltvdelay")), "hltv_rcon_cmd", 3388441, cmd, 512) } else { hltv_rcon_cmd(cmd,0) } } #endif if ((recdemo == 1)||(recdemo == 3)) { // Player's demos new players[32],playername[32],playerteam[16] new nbr,i get_players(players,nbr) for(i=0; i","-")) {} while(replace(demoname,255,"<","-")) {} while(replace(demoname,255,"|","-")) {} client_cmd(players[i],"stop") #if defined NO_STEAM client_cmd(players[i],"record ^"%s^"",demoname) #else client_cmd(players[i],"record ^"%s.a^"",demoname) #endif client_print(players[i],print_chat,"* [AMX MATCH] %s : %s", _T("Recording a demo on your PC"), demoname) } } } return PLUGIN_CONTINUE } #if defined USE_HLTV_SECTION public stop_hltvdemo() { #if defined NO_STEAM hltv_rcon_cmd("stoprecord",0) #else hltv_rcon_cmd("stoprecording",0) #endif hltv_rcon_cmd("say [AMX MATCH] Stopped recording the demo.",0) } #endif public stop_demo() { if ((recdemo == 1)||(recdemo == 3)) { // Player's demos new players[32],playerteam[16] new nbr,i get_players(players,nbr) for(i=0; i 1) { // HLTV demos new delay = get_cvar_num("amx_match_hltvdelay") delay = delay + 10 set_task(float(delay),"stop_hltvdemo", 3388442) } #endif return PLUGIN_CONTINUE } public screenshot() { new players[32] new nbr get_players(players,nbr) for(new i=0; i 0) { if (show == 2) { client_print(0,print_chat,"* [AMX MATCH] %s", _T("Taking screenshots... Smile!")) client_cmd(0,"status") set_task(0.5,"toggle_console") set_task(1.0,"screenshot") set_task(1.5,"remove_console") set_task(2.0,"show_scoreboard") set_task(2.5,"screenshot") set_task(5.0,"remove_scoreboard") } else { client_cmd(0,"+showscores") client_print(0,print_chat,"* [AMX MATCH] %s", _T("Taking a screenshot... Smile!")) set_task(1.5,"screenshot") set_task(4.0,"remove_scoreboard") } } return PLUGIN_CONTINUE } public start_match(id,level,cid) { new command[16] read_argv(0,command,15) if (equal(command,"amx_match")) cmdtype = 1 else cmdtype = 2 if (cmdtype == 1) { if (!cmd_access(id,level,cid,5)) { return PLUGIN_HANDLED } } else { if (!cmd_access(id,level,cid,3)) { return PLUGIN_HANDLED } } if (match_inprogress == 0) { // Exec AMXMD.cfg if (file_exists(cfgfile2)) { server_cmd("exec %s", cfgfile2) } // checks config file if (cmdtype == 1) read_argv(4,cfgfile,31) else read_argv(2,cfgfile,31) new cfgfile3[64] new cfgfile4[64] format(cfgfile3,63,"%s/amxmd/leagues/%s.cfg",customdir, cfgfile) if (!(file_exists(cfgfile3))) { console_print(id,"* %s", _T("This config file doesn't exist.")) format(cfgfile4,63,"%s/amxmd/leagues/cfglist.txt",customdir) if (file_exists(cfgfile3)) { new line = 0, txtsize = 0, message[192] console_print(id,"* %s", _T("Here is the list of available config files:")) while((line = read_file(cfgfile3,line,message,191,txtsize)) != 0) console_print(id,"* %s",message) } return PLUGIN_HANDLED } // checks match type if (cmdtype == 1) read_argv(3,checktype,31) else read_argv(1,checktype,31) if (equali(checktype,"mr",2)) { matchtype1 = 1 } else if (equali(checktype,"tl",2)) { matchtype1 = 2 } checktype2 = checktype new i,length length=strlen(checktype) for(i=0;i<(length-2);i++) checktype[i] = checktype[i+2] checktype[i]= 0 if (!( matchtype1 && str_to_num(checktype) )) { console_print(id,"* %s", _T("That type of match isn't supported :/^n* Type supported is maxround: mrXX (mr12 for example) or timelimit: tlXX (tl30 for example).")) return PLUGIN_HANDLED } // starting the match match_inprogress = 1 in_overtime2 = 0 ready_type = get_cvar_num("amx_match_readytype") end_type = get_cvar_num("amx_match_endtype") swap_type = get_cvar_num("amx_match_swaptype") #if !defined NO_STEAM shield_type = get_cvar_num("amx_match_shield") if ( shield_type == 0) { server_cmd("amx_restrict on shield") client_print(0,print_chat,"* [AMX MATCH] %s", _T("Tactical shield has been disabled")) } else { server_cmd("amx_restrict off shield") client_print(0,print_chat,"* [AMX MATCH] %s", _T("Tactical shield has been enabled")) } #endif new pass pass = get_cvar_num("amx_match_password") if(pass == 1) { get_cvar_string("sv_password", old_serverpass, 31) get_cvar_string("amx_match_password2", server_pass, 31) server_cmd("sv_password ^"%s^"", server_pass) client_print(0,print_chat,"* [AMX MATCH] %s", _T("Server password has been set by the plugin")) client_print(id,print_chat,"* [AMX MATCH] %s : | %s |", _T("Server password has been set to"), server_pass) } format(ready_CT_names,31,"%s.", _T("None",0)) format(ready_T_names,31,"%s.", _T("None",0)) players_ready[0] = 0 if (cmdtype == 1) { read_argv(1,clanCT,31) read_argv(2,clanT,31) } else { format(clanCT,31,"CT") format(clanT,31,"T") } new hostname_type new cfgfile_upr[32]; hostname_type = get_cvar_num("amx_match_hostname") if(hostname_type == 1) { cfgfile_upr = cfgfile strtoupper(cfgfile_upr) get_cvar_string("hostname", old_servername, 63) if (cmdtype == 1) { server_cmd("hostname ^"%s vs. %s | %s %s ^"", clanCT, clanT, cfgfile_upr, _T("CS Match In Progress",0)) } else { server_cmd("hostname ^"%s %s ^"", cfgfile_upr, _T("CS Match In Progress",0)) } } new demo[8] if (cmdtype == 1) read_argv(5,demo,7) else read_argv(3,demo,7) new temp[16] temp[0] = 0 if (equali(demo,"recdemo")) { recdemo = 1 temp = "Players " } #if defined USE_HLTV_SECTION if (equali(demo,"rechltv")) { recdemo = 2 num_to_str(id,temp,15) set_task(1.0,"hltv_help",0,temp,15) temp = "HLTV " } if (equali(demo,"recboth")) { recdemo = 3 num_to_str(id,temp,15) set_task(1.0,"hltv_help",0,temp,15) temp = "Players & HLTV " } #endif matchtype2 = str_to_num(checktype) // log new name[32],authid[16], userid new hudmsg[200] get_user_name(id,name,31) get_user_authid(id,authid,15) userid = get_user_userid(id) if (cmdtype == 1) // For log and show activity format(hudmsg,199,"%s vs %s. %s%i. %s.cfg. recdemo: %i",clanCT,clanT,(matchtype1==1)?"mr":"tl",matchtype2,cfgfile,recdemo) else format(hudmsg,199,"%s%i. %s.cfg. recdemo: %i",(matchtype1==1)?"mr":"tl",matchtype2,cfgfile,recdemo) log_to_file(g_logFile, "^"%s<%d><%s><>^" %s ^"%s^"",name,userid,authid,_T("started a match"),hudmsg) // Show activity, if on get_user_name(id,name,31) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,"%s %s: %s ^"%s^"",_T("ADMIN"), name, _T("started a match"), hudmsg) case 1: client_print(0,print_chat,"%s %s ^"%s^"",_T("ADMIN"), _T("started a match"), hudmsg) } if (cmdtype == 1) format(hudmsg,199,"--[ %s : %s(CT) vs %s(T) ]--^n^n%s %s %i (%s config)",_T("Match loaded",0),clanCT,clanT,_T("Match type is",0),(matchtype1==1)?"MaxRound":"TimeLimit",matchtype2,cfgfile) else format(hudmsg,199,"--[ %s ]--^n^n %s %s %i (%s config)",_T("Match loaded",0),_T("Match type is",0),(matchtype1==1)?"MaxRound":"TimeLimit",matchtype2,cfgfile) set_hudmessage(0, 255, 255, -1.0, 0.30, 0, 2.0, 6.0, 0.8, 0.8, 2) show_hudmessage(0,hudmsg) format(hudmsg,199,"%s%s^n %s ",temp,(recdemo>0) ? "%s":"",_T("Entering warmup session...",0),_T("demos autorecorded",0)) set_hudmessage(0, 255, 255, -1.0, 0.38, 0, 2.0, 6.0, 0.8, 0.8, 5) show_hudmessage(0,hudmsg) #if defined USE_HLTV_SECTION if (recdemo > 1) { if (!cmd_access(id,level,cid,2)) { return PLUGIN_HANDLED } console_print(id,"* %s ^"%s^"",_T("HLTV adminpassword set to"), hltv_rconPass) if (hltv_id == 0) { console_print(id,"* %s", _T("No HLTV currently connected to the server") ) console_print(id,"* %s", _T("HLTV demos are not recorded during this match.") ) hltv_iaddress[0] = 0 } else { new hltv_console_help[64] get_user_ip(hltv_id,hltv_iaddress,31) get_user_ip(hltv_id,hltv_ip,31,1) new pos = contain(hltv_iaddress,":") hltv_port = str_to_num(hltv_iaddress[pos+1]) console_print(id,"* %s (%s:%i)...", _T("Testing HLTV"), hltv_ip,hltv_port) format( hltv_console_help, 63, "say %s =)", _T("HLTV correctly configured",0) ) hltv_rcon_cmd(hltv_console_help,id) console_print(id,"* %s", _T("If the HLTV said something, it's ok. Otherwise, the adminpassword of the HLTV isn't correct :/") ) } } else { console_print(id,"* %s", _T("HLTV demos are not recorded during this match.") ) } #else console_print(id,"* %s", _T("HLTV demos are not recorded during this match.") ) #endif start_warmup() } else { console_print(id,"* %s", _T("Match already in progress.")) client_print(id,print_chat,"* [AMX MATCH] %s", _T("Match already in progress.")) } return PLUGIN_CONTINUE } public restart_match(id,level) { if (!access(id,level)) { console_print(id,"* [AMX MATCH] %s", _T("You have no access to that command.")) console_print(id,"* %s", _T("You have no access to that command.")) return PLUGIN_HANDLED } if (match_inprogress > 0){ new name[32] // Remove timelimit tasks if ( task_exists( 18+2 ) ) { remove_task( 18+2 ) } if ( task_exists( 18+3 ) ) { remove_task( 18+3 ) } get_user_name(id,name,31) set_hudmessage(208, 12, 2, -1.0, 0.32, 0, 2.0, 6.0, 0.8, 0.8, 2) show_hudmessage(0,"--[ %s %s ]--^n^n",name,_T("HAS RESTARTED THE MATCH")) server_print("* %s", _T("Match stopped.")) back_to_ffa() // Format string for match restart // recdemo = 0: none // recdemo = 1: player // recdemo = 2: hltv // recdemo = 3: both new record_str[32] if(recdemo == 0) // none { record_str = "" } else if (recdemo == 1) //player { record_str = "recdemo" } else if (recdemo == 2) //hltv { record_str = "rechltv" } else if (recdemo == 3) // both { record_str = "recboth" } new matchtype_str[32] if( matchtype1 == 1) { format(matchtype_str, 31, "mr%d", matchtype2) } else { format(matchtype_str, 31, "tl%d", matchtype2) } if(cmdtype == 1) { // amx_match [recdemo|rechltv|recboth] format(match_command, 255, "amx_match %s %s %s %s %s", clanCT, clanT, matchtype_str, cfgfile, record_str) } else { // amx_match [recdemo|rechltv|recboth] format(match_command, 255, "amx_match2 %s %s %s", matchtype_str, cfgfile, record_str) } // Uninitialize uninit() remove_task(1337) // log new authid[16], userid get_user_authid(id,authid,15) userid = get_user_userid(id) log_to_file(g_logFile, "^"%s<%d><%s><>^" %s",name,userid,authid,_T("restarted the match")) // Show activity, if on get_user_name(id,name,31) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,"%s %s: %s", _T("ADMIN"),name, _T("restarted the match")) case 1: client_print(0,print_chat,"%s %s", _T("ADMIN"), _T("restarted the match")) } server_cmd("%s", match_command) } else { client_print(id,print_chat,"* [AMX MATCH] %s", _T("There's no match to restart.")) console_print(id,"* %s", _T("There's no match to restart.")) } return PLUGIN_CONTINUE } public stop_match(id,level) { if (!access(id,level)) { console_print(id,"* [AMX MATCH] %s",_T("You have no access to that command.")) console_print(id,"* %s", _T("You have no access to that command.")) return PLUGIN_HANDLED } if (match_inprogress > 0){ new name[32] new screenshot2 // Remove timelimit tasks if ( task_exists( 18+2 ) ) { remove_task( 18+2 ) } if ( task_exists( 18+3 ) ) { remove_task( 18+3 ) } get_user_name(id,name,31) screenshot2 = get_cvar_num("amx_match_screenshot2") if(screenshot2 == 1) { set_hudmessage(208, 12, 2, 0.05, -0.25, 0, 6.0, 12.0, 0.1, 0.2, 4) show_hudmessage(0,"--[ %s %s ]--",_T("MATCH WAS ENDED EARLY BY"), name) show_the_score() take_screenshot() } set_hudmessage(208, 12, 2, -1.0, 0.32, 0, 2.0, 6.0, 0.8, 0.8, 2) show_hudmessage(0,"--[ %s %s ]--^n^n %s ;-)",name,_T("HAS STOPPED THE MATCH"),_T("Let's go back to FFA")) server_print("* %s", _T("Match stopped.")) back_to_ffa() uninit() remove_task(1337) // log new authid[16], userid get_user_authid(id,authid,15) userid = get_user_userid(id) log_to_file(g_logFile, "^"%s<%d><%s><>^" %s",name,userid,authid,_T("stopped the match")) // Show activity, if on get_user_name(id,name,31) switch(get_cvar_num("amx_show_activity")) { case 2: client_print(0,print_chat,"%s %s: %s", _T("ADMIN"),name, _T("stopped the match")) case 1: client_print(0,print_chat,"%s %s", _T("ADMIN"),_T("stopped the match")) } } else { client_print(id,print_chat,"* [AMX MATCH] %s", _T("There's no match to stop.")) console_print(id,"* %s", _T("There's no match to stop.")) } return PLUGIN_CONTINUE } public uninit() { if (recdemo > 0) stop_demo() match_inprogress = 0 in_overtime = 0 overtime_score = 0 ready_type = 0 end_type = 0 swap_type = 0 format(ready_CT_names,31,"%s.", _T("None",0)) format(ready_T_names,31,"%s.", _T("None",0)) players_ready[0] = 0 teams_ready = 0 clanCT[0] = 0 clanT[0] = 0 cfgfile[0] = 0 matchtype1 = 0 matchtype2 = 0 recdemo = 0 ct_score[0] = 0 t_score[0] = 0 ct_score[1] = 0 t_score[1] = 0 // (Re)set Hostname new hostname_type hostname_type = get_cvar_num("amx_match_hostname") if(hostname_type == 1) { set_cvar_string("hostname", old_servername) } // (Re)set Password new pass pass = get_cvar_num("amx_match_password") if(pass == 1) { set_cvar_string("sv_password", old_serverpass) } #if !defined NO_STEAM shield_type2 = get_cvar_num("amx_match_shield2") if ( shield_type2 == 0) { server_cmd("amx_restrict off shield") client_print(0,print_chat,"* [AMX MATCH] %s", _T("Tactical shield has been enabled")) } else { server_cmd("amx_restrict on shield") client_print(0,print_chat,"* [AMX MATCH] %s", _T("Tactical shield has been disabled")) } #endif back_to_ffa() } public back_to_ffa() { client_print(0,print_chat,"* [AMX MATCH] %s (ffa.cfg)", _T("Executing FFA config file")) server_cmd("exec ^"%s/amxmd/leagues/ffa.cfg^"", customdir) return PLUGIN_CONTINUE } public warmup_msg() { if ((match_inprogress == 1)||(match_inprogress == 3)) { set_hudmessage(255, 255, 255, -1.0, 0.01, 0, 2.0, 10.0, 0.8, 0.8, 6) new show = get_cvar_num("amx_match_screenshot") new warmup_demos[128] new warmup_time[128] new warmup_screenshots[128] new warmup_swapteams[128] format(warmup_time,127, "%s", _T("Warmup Time...",0)) format(warmup_screenshots,127, "%s", _T("Screenshots are also taken",0)) format(warmup_swapteams,127, "^n%s", _T("Teams will automatically swap after the 1st half",0)) if ((recdemo==1)||(recdemo==3)) { format (warmup_demos, 127, "--[ %s ]--^n%s", warmup_time, _T("Demos autorecorded on your PC (If you're not spectating..)",0)) show_hudmessage(0,warmup_demos) } else { format (warmup_demos, 127, "--[ %s ]--^n%s", warmup_time, _T("Remember to record demos if you want...",0)) show_hudmessage(0,warmup_demos) } set_hudmessage(255, 255, 255, -1.0, 0.08, 0, 2.0, 10.0, 0.8, 0.8, 5) show_hudmessage(0,"%s %s",(show > 0) ? warmup_screenshots : "", (swap_type==1) ? warmup_swapteams : "") if (cmdtype == 1) client_print(0,print_chat,"* [AMX MATCH] %s(CT) vs %s(T)",(match_inprogress == 1) ? clanCT : clanT,(match_inprogress == 1) ? clanT : clanCT) client_print(0,print_chat,"* [AMX MATCH] %s", _T("Warmup Time")) if (ready_type == 0) { if (teams_ready == 0) client_print(0,print_chat,"* [AMX MATCH] %s", _T("Both teams aren't ready.")) if (teams_ready == 4) { if (cmdtype == 1) client_print(0,print_chat,"* [AMX MATCH] %s %s %s %s",(match_inprogress==1) ? clanCT : clanT,_T("are ready. Waiting for"),(match_inprogress==1) ? clanT : clanCT, _T("to be ready.")) else client_print(0,print_chat,"* [AMX MATCH] CT %s T %s", _T("are ready. Waiting for"),_T("to be ready.")) } if (teams_ready == 8) { if (cmdtype == 1) client_print(0,print_chat,"* [AMX MATCH] %s %s %s %s", (match_inprogress==1) ? clanT : clanCT,_T("are ready. Waiting for"),(match_inprogress==1) ? clanCT : clanT, _T("to be ready.")) else client_print(0,print_chat,"* [AMX MATCH] T %s CT %s", _T("are ready. Waiting for"),_T("to be ready.")) } client_print(0,print_chat,"* [AMX MATCH] %s", _T("When your team is ready: say ready")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("If your team isn't ready anymore: say notready")) } else { if (ready_type == 1) { client_print(0,print_chat,"* [AMX MATCH] %s", _T("When you are ready: say ready")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("If you're not ready anymore: say notready")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("The match starts when everybody is ready")) } else client_print(0,print_chat,"* [AMX MATCH] %s", _T("The admin will start the match when needed (by saying ^"/start^"")) } set_task(90.0,"warmup_msg",1338) } return PLUGIN_CONTINUE } public start_warmup() { is_started = 0 restart_round("8") if ( in_overtime2 == 0 ) { client_print(0,print_chat,"* [AMX MATCH] %s (%s.cfg + default.cfg)", _T("Executing match config file"),cfgfile) server_cmd("exec ^"%s/amxmd/leagues/%s.cfg^"", customdir, cfgfile) server_cmd("exec ^"%s/amxmd/leagues/default.cfg^"", customdir) } else { new overtime_config = get_cvar_num("amx_match_overtimecfg") if(overtime_config == 0) { client_print(0,print_chat,"* [AMX MATCH] %s", _T("Executing match config file"),cfgfile) server_cmd("exec ^"%s/amxmd/leagues/%s.cfg^"", customdir, cfgfile) server_cmd("exec ^"%s/amxmd/leagues/default.cfg^"", customdir) } else { client_print(0,print_chat,"* [AMX MATCH] %s (%sot.cfg + default.cfg)", _T("Executing match overtime config file"),cfgfile) server_cmd("exec ^"%s/amxmd/leagues/%sot.cfg^"", customdir, cfgfile) server_cmd("exec ^"%s/amxmd/leagues/default.cfg^"", customdir) } } format(ready_CT_names,31,"%s.", _T("None",0)) format(ready_T_names,31,"%s.", _T("None",0)) players_ready[0] = 0 server_cmd("mp_timelimit ^"0^"") server_cmd("mp_winlimit ^"0^"") server_cmd("mp_maxrounds ^"0^"") server_cmd("mp_limitteams ^"0^"") server_cmd("mp_autoteambalance ^"0^"") set_task(10.0,"warmup_msg") if (ready_type == 1) set_task(9.0,"print_readylist") return PLUGIN_CONTINUE } // Timelimit functions public get_matchtimeleft() { return seconds; } public show_timer() { new timeleft = get_matchtimeleft() set_hudmessage(255,255,255,0.75,0.05,0, 1.0, 1.0, 0.1, 0.2, 13) show_hudmessage(0,"Time remaining: %d:%02d",timeleft / 60, timeleft % 60) } public start_timer() { set_task(1.0, "decrement_seconds",18+2,"",0,"b") set_task(1.0, "show_timer",18+3,"",0,"b") } public decrement_seconds() { new endtype = get_cvar_num("amx_match_endtype") if( seconds != 0 ) { seconds-- } else if( endtype == 0 ) // Switch this line for the default endtype (at end of round (1), or immediately (0) (default)) { new_score() } } //End of Timelimit functions public live_msg() { match_inprogress++ set_hudmessage(0, 255, 255, -1.0, 0.32, 0, 2.0, 6.0, 0.8, 0.8, 2) show_hudmessage(0,"--[ %s ]--^n--[ %s ]--^n--[ %s ]--",_T("LIVE !!! GL & HF"),_T("LIVE !!! GL & HF"),_T("LIVE !!! GL & HF")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("LIVE LIVE LIVE !!!")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("LIVE LIVE LIVE !!!")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("LIVE LIVE LIVE !!!")) return PLUGIN_CONTINUE } public set_rules() { if (matchtype1 == 1) { server_cmd("mp_maxrounds ^"%i^"",matchtype2+2) } else { seconds = ( matchtype2 * 60 ) + 1 } return PLUGIN_CONTINUE } public start_half() { teams_ready = 0 ct_score[1] = 0 t_score[1] = 0 if (recdemo > 0) { server_cmd("sv_voiceenable 0") set_task(2.0,"rec_demos") set_task(4.0,"voice_enable",0,"1",1) } if (match_inprogress == 1) { client_print(0,print_chat,"* [AMX MATCH] %s", _T("1st half starting")) } else { client_print(0,print_chat,"* [AMX MATCH] %s", _T("2nd half starting")) } client_print(0,print_chat,"* [AMX MATCH] %s", _T("Going Live, 3 RS Then LIVE!!")) client_print(0,print_chat,"* [AMX MATCH] %s", _T("Going Live, 3 RS Then LIVE!!")) set_task(2.0,"restart_round",0,"1",1) set_task(4.0,"set_rules") set_task(4.0,"restart_round",0,"1",1) set_task(6.0,"restart_round",0,"3",1) set_task(11.0,"live_msg") if (matchtype1 == 2) { set_task(8.0,"start_timer", 18+1) } return PLUGIN_CONTINUE } public print_readylist() { if ((match_inprogress == 1)||(match_inprogress == 3)) { new hudmessage[550] format(hudmessage,549,"CT %s: %s^nT %s: %s", _T("ready",0),ready_CT_names, _T("ready",0),ready_T_names) set_hudmessage(0, 255, 0, 0.01, 0.17, 0, 0.5, 5.0, 0.8, 0.8, 4) show_hudmessage(0,hudmessage) set_task(6.0,"print_readylist",1339) } return PLUGIN_CONTINUE } public add_readylist(ident) { new longueur = strlen(players_ready) new playername[32],playerteam[16] new i=0 while((i 0) { new show_score = get_cvar_num("amx_match_showscore") if (show_score) { new the_score[1024] the_score[0] = 0 if (match_inprogress == 1) { new temp[128] format(temp, 127, _T("Both teams have won %d rounds",0),overtime_score) format(the_score,1023,"* [AMX MATCH] %s", temp) } if (match_inprogress == 2) { if (ct_score[1] > t_score[1]) { new temp[128] format(temp, 127, _T("%s are winning %d to %d",0),clanCT,(ct_score[1] + overtime_score),(t_score[1] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } else { if (ct_score[1] < t_score[1]) { new temp[128] format(temp, 127, _T("%s are winning %d to %d",0),clanT,(t_score[1] + overtime_score),(ct_score[1] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } else { new temp[128] format(temp, 127, _T("Both teams have won %d rounds",0),(ct_score[1] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } } } if (match_inprogress == 3) { if (ct_score[0] > t_score[0]) { new temp[128] format(temp, 127, _T("%s are winning %d to %d",0),clanCT,(ct_score[0] + overtime_score),(t_score[0] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } else { if (ct_score[0] < t_score[0]) { new temp[128] format(temp, 127, _T("%s are winning %d to %d",0),clanT,(t_score[0] + overtime_score),(ct_score[0] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } else { new temp[128] format(temp, 127, _T("Both teams have won %d rounds",0),(ct_score[0] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } } } if (match_inprogress == 4) { new total[2] total[0] = ct_score[0] + t_score[1] total[1] = t_score[0] + ct_score[1] if (total[0] > total[1]) { new temp[128] format(temp, 127, _T("%s are winning %d to %d",0),(cmdtype==1) ? clanCT : "T",(total[0] + overtime_score),(total[1] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } else { if (total[0] < total[1]) { new temp[128] format(temp, 127, _T("%s are winning %d to %d",0),(cmdtype==1) ? clanT : "CT",(total[1] + overtime_score),(total[0] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } else { new temp[128] format(temp, 127, _T("Both teams have won %d rounds",0),(total[0] + overtime_score)) format(the_score,1023,"* [AMX MATCH] %s", temp) } } } #if defined NO_STEAM message_begin(MSG_ALL,StatusTextid,{0,0,0}) write_byte(0) write_string(the_score) message_end() #else set_hudmessage(255, 255, 0, 0.0, 0.90, 0, 2.0, 8.0, 0.8, 0.8, 3) show_hudmessage(0,the_score) #endif } } return PLUGIN_CONTINUE } public vote_playout(){ new menu_msg[256] format(menu_msg,255,"\y* [AMX MATCH] %s \w^n^n1. %s^n2. %s", _T("Play Out?",0),_T("Yes",0),_T("No",0)) new Float:vote_time = get_cvar_float("amx_vote_time") + 2.0 set_cvar_float("amx_last_voting", get_gametime() + vote_time ) show_menu(0,(1<<0)|(1<<1),menu_msg,floatround(vote_time),"\y* [AMX MATCH]") set_task(vote_time,"check_votes") client_print(0,print_chat,"* %s", _T("Voting has started...")) option[0]=option[1]=0 return PLUGIN_HANDLED } public vote_count(id,key){ if ( get_cvar_float("amx_vote_answers") ) { new name[32] get_user_name(id,name,31) new temp[128] format(temp, 127, _T("%s voted %s"), name, key ? _T("against") : _T("for")) client_print(0,print_chat,"* %s", temp) } ++option[key] return PLUGIN_HANDLED } public check_votes(id) { if (option[0] > option[1]) { end_type=0; new temp[128] format(temp, 127, _T("Voting outcome: Playout (yes ^"%d^") (no ^"%d^")."),option[0],option[1]) client_print(0,print_chat,"* %s", temp) } else { new temp[128] format(temp, 127, _T("Voting outcome: Do NOT Playout (yes ^"%d^") (no ^"%d^")."),option[0],option[1]) client_print(0,print_chat,"* %s", temp) new_score2() } return PLUGIN_CONTINUE } public new_score() { if ((match_inprogress == 2)||(match_inprogress == 4)) { // Playing a half new team[32] read_data(1,team,31) if (equal(team,"CT")) ct_score[1] = read_data(2) else { if (equal(team,"TERRORIST")) t_score[1] = read_data(2) } } show_the_score() if (matchtype1 == 1) //Playing mr { if ( (match_inprogress == 2) && ((ct_score[1] + t_score[1]) == matchtype2) ) { // Playing 1st half and it's finished ct_score[0] = ct_score[1] t_score[0] = t_score[1] ct_score[1] = 0 t_score[1] = 0 new hudmsg[256] format(hudmsg,255,"--[ %s ]--^n^n%s: %s %i / %i %s", _T("1st Half Finished",0),_T("Score is",0),clanCT,(in_overtime==1) ? (ct_score[0] + overtime_score) : ct_score[0],(in_overtime==1) ? (t_score[0] + overtime_score) : t_score[0],clanT) new show = get_cvar_num("amx_match_screenshot") if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.52, 0, 2.0, 8.0, 0.8, 0.8, 2) else set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 2.0, 8.0, 0.8, 0.8, 2) show_hudmessage(0,hudmsg) format(hudmsg,255,"%s^n%s",(swap_type==1) ? "%s" : "",_T("We are going back in warmup.",0),_T("DON'T CHANGE YOUR TEAM!",0)) if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.63, 0, 2.0, 8.0, 0.8, 0.8, 5) else set_hudmessage(255, 255, 255, -1.0, 0.43,0, 2.0, 8.0, 0.8, 0.8, 5) show_hudmessage(0,hudmsg) match_inprogress = 3 take_screenshot() set_task(2.0,"start_warmup") if (recdemo > 0) set_task(3.0,"stop_demo") if (swap_type == 1) set_task(5.0,"swap") g_isVoting = 0 } else { if (match_inprogress == 4) { // Playing 2nd half if ( ((ct_score[1] + t_score[1]) == matchtype2) || (((end_type == 1) || (end_type == 2)) && ( ((ct_score[0] + t_score[1]) == (matchtype2 + 1)) || ((t_score[0] + ct_score[1]) == (matchtype2 + 1)) )) ) // 2nd half is finished { new roundsPlayed = (ct_score[0] + t_score[1] + ct_score[1] + t_score[0]) if(end_type == 2 && (((matchtype2 * 2) - roundsPlayed) > (((matchtype2 * 2) / 5) - 1))) //Check if end type is 2 and check if rounds played is more than a (1/5) - 1 of the rounds away from end of match { // Vote... if (g_isVoting == 0)//if it's not voting { vote_playout() } } else { new_score2() } } } } } else if (matchtype1 == 2 && get_matchtimeleft() == 0) //Playing tl { if( match_inprogress == 2 ) { if ( task_exists( 18+2 ) ) { remove_task( 18+2 ) } if ( task_exists( 18+3 ) ) { remove_task( 18+3 ) } ct_score[0] = ct_score[1] t_score[0] = t_score[1] ct_score[1] = 0 t_score[1] = 0 new hudmsg[256] format(hudmsg,255,"--[ %s ]--^n^n%s: %s %i / %i %s", _T("1st Half Finished",0),_T("Score is",0),clanCT,(in_overtime==1) ? (ct_score[0] + overtime_score) : ct_score[0],(in_overtime==1) ? (t_score[0] + overtime_score) : t_score[0],clanT) new show = get_cvar_num("amx_match_screenshot") if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.52, 0, 2.0, 8.0, 0.8, 0.8, 2) else set_hudmessage(255, 255, 255, -1.0, 0.32, 0, 2.0, 8.0, 0.8, 0.8, 2) show_hudmessage(0,hudmsg) format(hudmsg,255,"%s^n%s",(swap_type==1) ? "%s" : "",_T("We are going back in warmup.",0),_T("DON'T CHANGE YOUR TEAM!",0)) if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.63, 0, 2.0, 8.0, 0.8, 0.8, 5) else set_hudmessage(255, 255, 255, -1.0, 0.43,0, 2.0, 8.0, 0.8, 0.8, 5) show_hudmessage(0,hudmsg) match_inprogress = 3 take_screenshot() set_task(2.0,"start_warmup") if (recdemo > 0) set_task(3.0,"stop_demo") if (swap_type == 1) set_task(5.0,"swap") } else if ( match_inprogress == 4 && get_matchtimeleft() == 0) { if ( task_exists( 18+2 ) ) { remove_task( 18+2 ) } if ( task_exists( 18+3 ) ) { remove_task( 18+3 ) } ct_score[0] += t_score[1] t_score[0] += ct_score[1] new hudmsg[200] format(hudmsg,199,"--[ %s ]--^n^n%s",_T("Match Finished. GG all",0),_T("And the winner of the map is...",0)) new show = get_cvar_num("amx_match_screenshot") if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.50, 0, 2.0, 8.0, 0.8, 0.8, 2) else set_hudmessage(255, 255, 255, -1.0, 0.30, 0, 2.0, 8.0, 0.8, 0.8, 2) show_hudmessage(0,hudmsg) if (ct_score[0] > t_score[0]) { format(hudmsg,199,"%s %s %i/%i",(cmdtype==1) ? clanCT : "TERRORISTS",_T("with the score of",0),(in_overtime==1) ? (ct_score[0] + overtime_score) : ct_score[0],(in_overtime==1) ? (t_score[0] + overtime_score) : t_score[0]) in_overtime = 0 } else { if (t_score[0] > ct_score[0]) { format(hudmsg,199,"%s %s %i/%i",(cmdtype==1) ? clanT : "COUNTER-TERRORISTS",_T("with the score of",0),(in_overtime==1) ? (t_score[0] + overtime_score) : t_score[0],(in_overtime==1) ? (ct_score[0] + overtime_score) : ct_score[0]) in_overtime = 0 } else { format(hudmsg,199,"%s %i/%i",_T("NO ONE!!!^nDraw match with the score of",0),ct_score[0],t_score[0]) } } if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.60, 0, 2.0, 8.0, 0.8, 0.8, 5) else set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 2.0, 8.0, 0.8, 0.8, 5) show_hudmessage(0,hudmsg) take_screenshot() if (recdemo > 0) set_task(3.0,"stop_demo") match_inprogress = 0 set_task(2.0,"uninit") } } return PLUGIN_CONTINUE } public new_score2() { ct_score[0] += t_score[1] t_score[0] += ct_score[1] new hudmsg[200] format(hudmsg,199,"--[ %s ]--^n^n%s",_T("Match Finished. GG all",0),_T("And the winner of the map is...",0)) new show = get_cvar_num("amx_match_screenshot") if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.50, 0, 2.0, 8.0, 0.8, 0.8, 2) else set_hudmessage(255, 255, 255, -1.0, 0.30, 0, 2.0, 8.0, 0.8, 0.8, 2) show_hudmessage(0,hudmsg) if (ct_score[0] > t_score[0]) { format(hudmsg,199,"%s %s %i/%i",(cmdtype==1) ? clanCT : "TERRORISTS",_T("with the score of",0),(in_overtime==1) ? (ct_score[0] + overtime_score) : ct_score[0],(in_overtime==1) ? (t_score[0] + overtime_score) : t_score[0]) in_overtime = 0 } else { if (t_score[0] > ct_score[0]) { format(hudmsg,199,"%s %s %i/%i",(cmdtype==1) ? clanT : "COUNTER-TERRORISTS",_T("with the score of",0),(in_overtime==1) ? (t_score[0] + overtime_score) : t_score[0],(in_overtime==1) ? (ct_score[0] + overtime_score) : ct_score[0]) in_overtime = 0 } else { in_overtime = get_cvar_num("amx_match_overtime") if (in_overtime) { match_inprogress = 1 overtime_score += matchtype2 matchtype2 = get_cvar_num("amx_match_otrounds") format(hudmsg,199,"%s %i/%i^n^n%s (mr%i)",_T("NO ONE!!!^nDraw match with the score of",0),(ct_score[0] + overtime_score),(t_score[0] + overtime_score),_T("Let's play OVERTIME",0),matchtype2) } else format(hudmsg,199,"%s %i/%i",_T("NO ONE!!!^nDraw match with the score of",0),ct_score[0],t_score[0]) } } if (show == 2) set_hudmessage(255, 255, 255, -1.0, 0.60, 0, 2.0, 8.0, 0.8, 0.8, 5) else set_hudmessage(255, 255, 255, -1.0, 0.40, 0, 2.0, 8.0, 0.8, 0.8, 5) show_hudmessage(0,hudmsg) take_screenshot() if (recdemo > 0) set_task(3.0,"stop_demo") if (in_overtime) { in_overtime2 = 1 set_task(2.0,"start_warmup") if (swap_type == 1) set_task(5.0,"swap") } else { match_inprogress = 0 set_task(2.0,"uninit") } return PLUGIN_CONTINUE } /**********************************/ /* AMX Match Menu */ /**********************************/ public addtypetolist(id,level,cid) { if (!cmd_access(id,level,cid,2)) return PLUGIN_HANDLED new matched new arg[32] new argc = read_argc() for(new i = 1; i < argc; i++) { if (typelistpos < MAX_VARS) { read_argv(i,arg,31) matched = 0 for(new j = 0; j < typelistpos; j++) { if(equal(typelist[j], arg)) { matched = 1 break } } if(matched == 0) { typelist[typelistpos++] = arg } } else { console_print(id,"[amx_match_deluxe] %s",_T("Too many match types added")) break } } return PLUGIN_CONTINUE } public addconfigtolist(id,level,cid) { if (!cmd_access(id,level,cid,3)) return PLUGIN_HANDLED if (configlistpos < MAX_VARS) { new arg[32] new matched = 0 read_argv(1,arg,31) for(new i = 0; i < configlistpos; i++) { if(equali(confignamelist[i], arg)) { matched = 1 break } } if(matched == 0) { confignamelist[configlistpos] = arg read_argv(2,arg,31) configfilelist[configlistpos++] = arg } } else console_print(id,"[amx_match_deluxe] %s", _T("Too many match config files added.")) return PLUGIN_CONTINUE } public get_CTclantags(id) { format(CT_tags[0],31,"%s", _T("Don't use Tags",0)) CT_tagspos = 1 for(new i = 1;i < MAX_TAGS;i++) { CT_tags[i] = "" } new players[32], nbr new player_name1[32], player_name2[32] get_players(players,nbr,"e","CT") for(new i=0;i MIN_TAG_LENGTH) { // it's added to the Tags table after checking doubles new l = 0 while(l < CT_tagspos) { if (!equal(CT_tags[l],player_name1,max(strlen(CT_tags[l]),k-1))) l++ else { l = CT_tagspos+1 } } if (l == CT_tagspos) { copy(CT_tags[CT_tagspos],k-1,player_name1) CT_tagspos++ } } k = l_max } } } } } if (CT_tagspos == 1) { client_print(id,print_chat,"* [AMX MATCH] %s", _T("No Counter-Terrorist clantag found :/")) client_print(id,print_chat,"* [AMX MATCH] %s", _T("Try using the console to start the match instead")) } return PLUGIN_CONTINUE } public get_Tclantags(id) { T_tagspos = 0 for(new i = 1;i < MAX_TAGS;i++) { T_tags[i] = "" } new players[32], nbr new player_name1[32], player_name2[32] get_players(players,nbr,"e","TERRORIST") for(new i=0;i MIN_TAG_LENGTH) { // it's added to the Tags table after checking doubles new l = 0 while(l < T_tagspos) { if (!equal(T_tags[l],player_name1,max(strlen(T_tags[l]),k-1))) l++ else { l = T_tagspos+1 } } if (l == T_tagspos) { copy(T_tags[T_tagspos],k-1,player_name1) T_tagspos++ } } k = l_max } } } } } if (T_tagspos == 0) { client_print(id,print_chat,"* [AMX MATCH] %s", _T("No Terrorist clantag found :/")) client_print(id,print_chat,"* [AMX MATCH] %s", _T("Try using the console to start the match instead")) } return PLUGIN_CONTINUE } // Main Menu public match_menu(id,level,cid) { if (!cmd_access(id,level,cid,1)) return PLUGIN_HANDLED show_main_menu(id) return PLUGIN_CONTINUE } show_main_menu(id) { menu_position[id] = 0 menu_selections[id][0] = 0 menu_selections[id][1] = 0 menu_selections[id][2] = 0 menu_selections[id][3] = 0 menu_selections[id][4] = 0 // Init variable and exec AMXMD.cfg format(cfgfile2,63,"%s/amxmd/amxmd.cfg", customdir) if (file_exists(cfgfile2)) { server_cmd("exec %s", cfgfile2) } if ((match_inprogress == 1)||(match_inprogress == 3)) // Warmup { format(menuBody,511,"\yAMX Match Menu:\w^n^n1. %s^n2. %s^n3. %s^n4. %s^n5. %s^n^n0. %s",_T("Stop the match",id),_T("Force the start of the half",id),_T("Restart match",id),_T("Swap Teams",id),_T("Plugin settings",id),_T("Exit",id)) show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<4)|(1<<9),menuBody,-1,"AMX Match Menu") } else if ((match_inprogress == 2)||(match_inprogress == 4)) // Half { format(menuBody,511,"\yAMX Match Menu:\w^n^n1. %s^n2. %s^n3. %s^n^n0. %s",_T("Stop the match",id),_T("Restart match",id),_T("Swap Teams",id),_T("Exit",id)) show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<9),menuBody,-1,"AMX Match Menu") } else // No Match { format(menuBody,511,"\yAMX Match Menu:\w^n^n1. %s^n2. %s^n3. %s^n^n0. %s",_T("Start a match",id),_T("Swap Teams",id),_T("Plugin settings",id),_T("Exit",id)) show_menu(id,(1<<0)|(1<<1)|(1<<2)|(1<<9),menuBody,-1,"AMX Match Menu") } return PLUGIN_CONTINUE } public action_main_menu(id,key) { if ((match_inprogress == 1)||(match_inprogress == 3)) // Warmup { // 0. "STOP_MATCH" (1) // 1. "FORCE_START" (2) // 2. "RESTART_MATCH" (3) // 3. "SWAP TEAMS" (4) // 4. "PLUGIN_SETTINGS" (5) // N/A. "EXIT" (0) switch(key) { case 0: { // Stop the match server_cmd("amx_matchstop") } case 1: { // Force start force_start(id) } case 2: { // Restart match restart_match(id, ADMIN_LEVEL_A) } case 3: { // Swap teams server_cmd("amx_swapteams") } case 4: { // Show plugin settings g_menuPosition[id] = 0 show_settings_menu(id) } } } else if ((match_inprogress == 2)||(match_inprogress == 4)) // Half { // 0. "STOP_MATCH" (1) // 1. "RESTART_MATCH" (2) // 2. "SWAP TEAMS" (3) // N/A. "EXIT" (0) switch(key) { case 0: { // Stop the match server_cmd("amx_matchstop") } case 1: { // Restart the match restart_match(id, ADMIN_LEVEL_A) } case 2: { // Swap teams server_cmd("amx_swapteams") } } } else // No Match { // 0. "START_MATCH" (1) // 1. "SWAP TEAMS" (2) // 2. "PLUGIN_SETTINGS" (3) // N/A. "EXIT" (0) switch(key) { case 0: { // Start a match get_CTclantags(id) get_Tclantags(id) if ((CT_tagspos > 0) && (T_tagspos > 0)) { show_CTtags_menu(id,0) // Show CT clantags } else { show_type_menu(id,0) // Show type choices } } case 1: { // Swap teams server_cmd("amx_swapteams") } case 2: { // Show plugin settings g_menuPosition[id] = 0 show_settings_menu(id) } } } return PLUGIN_CONTINUE } // CT Tags Menu show_CTtags_menu(id,pos) { new menu_body[512], formatPos new keys = (1<<9) formatPos = format(menu_body,511,"\yAMX Match CT ClanTag:\R%d/%d^n\w^n",pos+1,(CT_tagspos/8)+((CT_tagspos%8)?1:0)) new start = pos * 8 new end = start + 8 if (end>CT_tagspos) end = CT_tagspos new j = 1 for(new i=start; i < end; i++) { formatPos += format(menu_body[formatPos],511-formatPos,"%d. %s^n",j,CT_tags[i]) keys |=(1<<(j-1)) j++ } if (end != CT_tagspos) { format(menu_body[formatPos],511-formatPos,"^n9. %s^n0. %s",_T("More",id),_T("Back",id)) keys |= (1<<8) } else format(menu_body[formatPos],511-formatPos,"^n0. %s",_T("Back",id)) show_menu(id,keys,menu_body,-1,"AMX Match CT ClanTag") return PLUGIN_CONTINUE } public action_CTtags_menu(id,key) { if (key == 9) { // goes back if (menu_position[id] == 0) show_main_menu(id) else { (menu_position[id])-- show_CTtags_menu(id,menu_position[id]) } } else { if ((key == 0)&&(menu_position[id] == 0)) show_type_menu(id,0) else { if (key == 8) { // show next clantags (menu_position[id])++ show_CTtags_menu(id,menu_position[id]) } else { client_print(id,print_chat,"* Tag selected = %s", CT_tags[key + (menu_position[id] * 8)]) menu_selections[id][0] = key + (menu_position[id] * 8) menu_position[id] = 0 show_Ttags_menu(id,0) } } } return PLUGIN_CONTINUE } // T Tags Menu show_Ttags_menu(id,pos) { new menu_body[512], formatPos new keys = (1<<9) formatPos = format(menu_body,511,"\yAMX Match T ClanTag:\R%d/%d^n\w^n",pos+1,(T_tagspos/8)+((T_tagspos%8)?1:0)) new start = pos * 8 new end = start + 8 if (end>T_tagspos) end = T_tagspos new j = 1 for(new i=start; itypelistpos) end = typelistpos new j = 1 for(new i=start; i configlistpos) { end = configlistpos } for(new i=start; i // MENU */ new temp[128] format(temp, 127, "// %s^n", _T("Amx Match Mod Config",id)) if (!write_file(filename, temp)) { return 0 } new pos new text[1024] new cvars[16][32] = { "amx_match_endtype", "amx_match_hostname", "amx_match_hltvdelay", "amx_match_overtime", "amx_match_overtimecfg", "amx_match_otrounds", "amx_match_password", "amx_match_password2", "amx_match_playerneed", "amx_match_readytype", "amx_match_swaptype", "amx_match_screenshot", "amx_match_screenshot2", "amx_match_showscore" #if !defined NO_STEAM , "amx_match_shield", "amx_match_shield2" #endif } // Print Cvars for(new i = 0; i < 15; i++) { get_cvar_string(cvars[i], temp, 31) format(text,1023,"%s ^"%s^"", cvars[i],temp) write_file(filename,text) } format(temp, 127, "^n^n// %s^n", _T("MENU",id)) if (!write_file(filename,temp)) { return 0 } // Print Types format(temp, 127, "// %s^n", _T("TYPES",id)) if (!write_file(filename,temp)) { return 0 } if ( typelistpos > 0) { pos = format(text,1023,"amx_match_tmenu ") for(new i = 0; i < typelistpos; i++) { pos += format(text[pos],1023 - pos,"^"%s^" ", typelist[i]) if( ((i + 1) % 8) == 7 && (i + 1) < typelistpos) { pos += format(text[pos],1023 - pos,"^namx_match_tmenu ") } } write_file(filename,text) } // Print Configs format(temp, 127, "^n^n// %s^n", _T("CONFIGS",id)) if (!write_file(filename,temp)) { return 0 } if ( configlistpos > 0) { for(new i = 0; i < configlistpos; i++) { format(text,1023,"amx_match_cmenu ^"%s^" ^"%s^"", confignamelist[i],configfilelist[i]) write_file(filename,text) } } client_print(id,print_chat,"* [AMX MATCH] %s ...",_T("Settings saved")) return 1 } public plugin_init() { register_plugin("AMX Match Deluxe","6.01","Infra and Shromilder") register_cvar("amx_match_deluxe", "6.01",FCVAR_SERVER) // Language files load_translations("amx_match_deluxe") // Console commands #if defined USE_HLTV_SECTION register_concmd("amx_match","start_match",ADMIN_LEVEL_A," [recdemo|rechltv|recboth]") register_concmd("amx_match2","start_match",ADMIN_LEVEL_A," [recdemo|rechltv|recboth]") #else register_concmd("amx_match","start_match",ADMIN_LEVEL_A," [recdemo]") register_concmd("amx_match2","start_match",ADMIN_LEVEL_A," [recdemo]") #endif // Start...Stop...Restart register_concmd("amx_matchrestart","restart_match",ADMIN_LEVEL_A," - Restart a match") register_concmd("amx_matchstart","check_start",ADMIN_LEVEL_A," - Force a match to start") register_concmd("amx_matchstop","stop_match",ADMIN_LEVEL_A," - Stop a match") // Swap teams register_concmd("amx_swapteams","swap_teams",ADMIN_LEVEL_A," - Swap teams") // Save current cvar config register_concmd("amx_matchsave","con_savesettings",ADMIN_LEVEL_A," - Save your current match cvar config") // Client commands register_clcmd("say ready","check_ready") register_clcmd("say notready","check_notready") register_clcmd("say /start","check_start", ADMIN_LEVEL_A, "check_start") register_clcmd("say /stop","stop_match", ADMIN_LEVEL_A, "stop_match") // Menu register_concmd("amx_matchmenu","match_menu",ADMIN_LEVEL_A,"match menu") // Server commands register_srvcmd("amx_match_tmenu","addtypetolist") register_srvcmd("amx_match_cmenu","addconfigtolist") // Events register_event("TeamScore","new_score","a") register_event("ResetHUD", "show_the_score", "b") // Cvars register_cvar("amx_match_endtype","0") register_cvar("amx_match_hostname","1") register_cvar("amx_match_hltvdelay","30") register_cvar("amx_match_overtime","0") register_cvar("amx_match_overtimecfg","0") register_cvar("amx_match_otrounds","3") register_cvar("amx_match_password", "1") register_cvar("amx_match_password2", "scrim") register_cvar("amx_match_playerneed", "10") register_cvar("amx_match_readytype", "1") register_cvar("amx_match_swaptype","1") register_cvar("amx_match_screenshot","1") register_cvar("amx_match_screenshot2","1") register_cvar("amx_match_showscore","1") #if !defined NO_STEAM register_cvar("amx_match_shield","0") register_cvar("amx_match_shield2","1") #endif // Playout vote register_menucmd(register_menuid("[AMX Match] Play Out?") ,(1<<0)|(1<<1),"vote_count") // Init Custom Directory string build_path(customdir, 63, "$configdir") #if defined USE_HLTV_SECTION // Init HLTV file string format(hltv_file,63,"%s/amxmd/hltv.ini", customdir) if (file_exists(hltv_file)) { new left[64] new right[64] new hltv_rconLen read_file(hltv_file,4,hltv_rconPass,63,hltv_rconLen) parse(hltv_rconPass,left,63,right,63) copy(hltv_rconPass,63,right) } else { server_print("* [AMX MATCH] %s", _T("hltv.ini does not exist. Using default password.")) copy(hltv_rconPass,63,"hltvadminpassword") } #endif // Init variable and exec AMXMD.cfg format(cfgfile2,63,"%s/amxmd/amxmd.cfg", customdir) if (file_exists(cfgfile2)) { server_cmd("exec %s", cfgfile2) } // Add menu item to main menu server_cmd("amx_addmenuitem ^"amxmodmenu^" ^"amx_match_deluxe.amx^" ^"AMX Match Deluxe Menu^" ^"amx_matchmenu^" ^"b^" ^"m^"") // MENU register_menucmd(register_menuid("AMX Match Menu"),(1<<0)|(1<<1)|(1<<2)|(1<<3)|(1<<9),"action_main_menu") register_menucmd(register_menuid("AMX Match CT ClanTag"),1023,"action_CTtags_menu") register_menucmd(register_menuid("AMX Match T ClanTag"),1023,"action_Ttags_menu") register_menucmd(register_menuid("AMX Match Settings"),1023,"action_setting_menu") register_menucmd(register_menuid("AMX Match Type"),1023,"action_type_menu") register_menucmd(register_menuid("AMX Match Config File"),1023,"action_config_menu") #if defined USE_HLTV_SECTION register_menucmd(register_menuid("AMX Match Record demo"),(1<<0)|(1<<1)|(1<<2)|(1<<9),"action_demo_menu") #else register_menucmd(register_menuid("AMX Match Record demo"),(1<<0)|(1<<1)|(1<<9),"action_demo_menu") #endif #if defined NO_STEAM StatusTextid = get_user_msgid("StatusText") #endif get_logfile(g_logFile, 15) return PLUGIN_CONTINUE }