-352 Removals
+352 Additions
#pragma semicolon 1#pragma semicolon 1
#include <sourcemod>#include <sourcemod>
#include <sdktools>#include <sdktools>
#include <geoip>#include <geoip>
#include <cstrike>#include <cstrike>
#include <warmod>#include <warmod>
#include <warmod_configs>#include <warmod_configs>
#undef REQUIRE_PLUGIN#undef REQUIRE_PLUGIN
#include <adminmenu>#include <adminmenu>
#include <updater>#include <updater>
#include <tEasyFTP>#include <tEasyFTP>
#undef REQUIRE_EXTENSIONS#undef REQUIRE_EXTENSIONS
#include <bzip2>#include <bzip2>
#include <zip>#include <zip>
#pragma newdecls required#pragma newdecls required
bool SQL_DEBUG = false;bool SQL_DEBUG = false;
int g_player_list[MAXPLAYERS + 1];int g_player_list[MAXPLAYERS + 1];
bool g_cancel_list[MAXPLAYERS + 1];bool g_cancel_list[MAXPLAYERS + 1];
int g_scores[2][2];int g_scores[2][2];
int g_scores_overtime[2][256][2];int g_scores_overtime[2][256][2];
int g_overtime_count = 0;int g_overtime_count = 0;
/* miscellaneous *//* miscellaneous */
char g_map[64];char g_map[64];
char date[32];char date[32];
char startHour[4];char startHour[4];
char startMin[4];char startMin[4];
float g_match_start;float g_match_start;
/* SQL and Last Match settings *//* SQL and Last Match settings */
Handle hDatabase = INVALID_HANDLE;Handle hDatabase = INVALID_HANDLE;
ConVar wm_upload_results;ConVar wm_upload_results;
ConVar wm_table_name;ConVar wm_table_name;
//ConVar wm_table_name_players;//ConVar wm_table_name_players;
ConVar wm_table_round_stats;ConVar wm_table_round_stats;
int lt_match_length;int lt_match_length;
char lt_map[64];char lt_map[64];
int lt_max_rounds;int lt_max_rounds;
int lt_overtime_max_rounds;int lt_overtime_max_rounds;
int lt_overtime_count;int lt_overtime_count;
int lt_played_out;int lt_played_out;
char lt_t_name[64];char lt_t_name[64];
int lt_t_overall_score;int lt_t_overall_score;
int lt_t_first_half_score;int lt_t_first_half_score;
int lt_t_second_half_score;int lt_t_second_half_score;
int lt_t_overtime_score;int lt_t_overtime_score;
char lt_ct_name[64];char lt_ct_name[64];
int lt_ct_overall_score;int lt_ct_overall_score;
int lt_ct_first_half_score;int lt_ct_first_half_score;
int lt_ct_second_half_score;int lt_ct_second_half_score;
int lt_ct_overtime_score;int lt_ct_overtime_score;
char lt_log_file_name[128];char lt_log_file_name[128];
//char sql_steamid64[MAXPLAYERS + 1][64];//char sql_steamid64[MAXPLAYERS + 1][64];
//char sql_player_name[MAXPLAYERS + 1][64];//char sql_player_name[MAXPLAYERS + 1][64];
//int sql_player_team[MAXPLAYERS + 1];//int sql_player_team[MAXPLAYERS + 1];
//int sql_player_count;//int sql_player_count;
int match_id;int match_id;
// Offsets// Offsets
int g_iAccount = -1;int g_iAccount = -1;
/* stats *//* stats */
bool g_log_warmod_dir = false;bool g_log_warmod_dir = false;
char g_log_filename[128];char g_log_filename[128];
Handle g_log_file = INVALID_HANDLE;Handle g_log_file = INVALID_HANDLE;
char g_log_veto_filename[128];char g_log_veto_filename[128];
Handle g_log_veto_file = INVALID_HANDLE;Handle g_log_veto_file = INVALID_HANDLE;
char weapon_list[][] = {"ak47", "m4a1_silencer", "m4a1_silencer_off", "m4a1", "galilar", "famas", "awp", "p250", "cz75a", "glock", "hkp2000", "usp_silencer", "usp_silencer_off", "ump45", "p90", "bizon", "mp7", "nova", "knife", "elite", "fiveseven", "deagle", "revolver", "tec9", "ssg08", "scar20", "aug", "sg556", "g3sg1", "mac10", "mp9", "mag7", "negev", "m249", "sawedoff", "incgrenade", "flashbang", "smokegrenade", "hegrenade", "molotov", "decoy", "taser"};char weapon_list[][] = {"ak47", "m4a1_silencer", "m4a1_silencer_off", "m4a1", "galilar", "famas", "awp", "p250", "cz75a", "glock", "hkp2000", "usp_silencer", "usp_silencer_off", "ump45", "p90", "bizon", "mp7", "nova", "knife", "elite", "fiveseven", "deagle", "revolver", "tec9", "ssg08", "scar20", "aug", "sg556", "g3sg1", "mac10", "mp9", "mag7", "negev", "m249", "sawedoff", "incgrenade", "flashbang", "smokegrenade", "hegrenade", "molotov", "decoy", "taser"};
int weapon_stats[MAXPLAYERS + 1][NUM_WEAPONS][LOG_HIT_NUM];int weapon_stats[MAXPLAYERS + 1][NUM_WEAPONS][LOG_HIT_NUM];
int clutch_stats[MAXPLAYERS + 1][CLUTCH_NUM];int clutch_stats[MAXPLAYERS + 1][CLUTCH_NUM];
int assist_stats[MAXPLAYERS + 1][ASSIST_NUM];int assist_stats[MAXPLAYERS + 1][ASSIST_NUM];
int round_health[MAXPLAYERS + 1];int round_health[MAXPLAYERS + 1];
int g_round = 1;int g_round = 1;
char last_weapon[MAXPLAYERS + 1][64];char last_weapon[MAXPLAYERS + 1][64];
char force_team_t[10][64];char force_team_t[10][64];
char force_team_ct[10][64];char force_team_ct[10][64];
int force_team_t_count = 0;int force_team_t_count = 0;
int force_team_ct_count = 0;int force_team_ct_count = 0;
bool g_planted = false;bool g_planted = false;
Handle g_stats_trace_timer = INVALID_HANDLE;Handle g_stats_trace_timer = INVALID_HANDLE;
ConVar wm_competition;ConVar wm_competition;
ConVar wm_event;ConVar wm_event;
char g_competition[255];char g_competition[255];
char g_event[255];char g_event[255];
char g_server[255];char g_server[255];
/* forwards *//* forwards */
Handle g_f_on_lo3 = INVALID_HANDLE;Handle g_f_on_lo3 = INVALID_HANDLE;
Handle g_f_on_round_end = INVALID_HANDLE;Handle g_f_on_round_end = INVALID_HANDLE;
Handle g_f_on_half_time = INVALID_HANDLE;Handle g_f_on_half_time = INVALID_HANDLE;
Handle g_f_on_reset_half = INVALID_HANDLE;Handle g_f_on_reset_half = INVALID_HANDLE;
Handle g_f_on_reset_match = INVALID_HANDLE;Handle g_f_on_reset_match = INVALID_HANDLE;
Handle g_f_on_end_match = INVALID_HANDLE;Handle g_f_on_end_match = INVALID_HANDLE;
Handle g_f_livewire_log_event = INVALID_HANDLE;Handle g_f_livewire_log_event = INVALID_HANDLE;
/* cvars *//* cvars */
ConVar wm_active;ConVar wm_active;
ConVar wm_stats_enabled;ConVar wm_stats_enabled;
ConVar wm_stats_method;ConVar wm_stats_method;
ConVar wm_stats_trace;ConVar wm_stats_trace;
ConVar wm_stats_trace_delay;ConVar wm_stats_trace_delay;
ConVar wm_rcon_only;ConVar wm_rcon_only;
ConVar wm_lock_teams;ConVar wm_lock_teams;
ConVar wm_min_ready;ConVar wm_min_ready;
ConVar wm_max_players;ConVar wm_max_players;
ConVar wm_match_config;ConVar wm_match_config;
ConVar wm_reset_config;ConVar wm_reset_config;
ConVar wm_reset_config_delay;ConVar wm_reset_config_delay;
ConVar wm_warmup_config;ConVar wm_warmup_config;
ConVar wm_prac_config;ConVar wm_prac_config;
ConVar wm_playout_config;ConVar wm_playout_config;
ConVar wm_overtime_config;ConVar wm_overtime_config;
ConVar wm_default_config;ConVar wm_default_config;
ConVar wm_knife_config;ConVar wm_knife_config;
ConVar wm_half_time_break;ConVar wm_half_time_break;
ConVar wm_over_time_break;ConVar wm_over_time_break;
ConVar wm_round_money;ConVar wm_round_money;
ConVar wm_ingame_scores;ConVar wm_ingame_scores;
ConVar mp_maxrounds;ConVar mp_maxrounds;
ConVar wm_block_warm_up_grenades;ConVar wm_block_warm_up_grenades;
ConVar wm_knife_auto_start;ConVar wm_knife_auto_start;
ConVar wm_knife_hegrenade;ConVar wm_knife_hegrenade;
ConVar wm_knife_flashbang;ConVar wm_knife_flashbang;
ConVar wm_knife_smokegrenade;ConVar wm_knife_smokegrenade;
ConVar wm_knife_zeus;ConVar wm_knife_zeus;
ConVar wm_knife_armor;ConVar wm_knife_armor;
ConVar wm_knife_helmet;ConVar wm_knife_helmet;
ConVar wm_require_names;ConVar wm_require_names;
ConVar wm_require_logos;ConVar wm_require_logos;
ConVar wm_logos_menu_only;ConVar wm_logos_menu_only;
ConVar wm_show_info;ConVar wm_show_info;
ConVar wm_auto_ready;ConVar wm_auto_ready;
ConVar wm_auto_knife;ConVar wm_auto_knife;
ConVar mp_overtime_enable;ConVar mp_overtime_enable;
ConVar mp_overtime_maxrounds;ConVar mp_overtime_maxrounds;
ConVar tv_enable;ConVar tv_enable;
ConVar wm_auto_record;ConVar wm_auto_record;
ConVar wm_save_dir;ConVar wm_save_dir;
ConVar wm_prefix_logs;ConVar wm_prefix_logs;
ConVar wm_warmup_respawn;ConVar wm_warmup_respawn;
ConVar wm_chat_prefix;ConVar wm_chat_prefix;
ConVar mp_match_can_clinch;ConVar mp_match_can_clinch;
ConVar mp_teamname_1;ConVar mp_teamname_1;
ConVar mp_teamname_2;ConVar mp_teamname_2;
ConVar mp_teamlogo_1;ConVar mp_teamlogo_1;
ConVar mp_teamlogo_2;ConVar mp_teamlogo_2;
ConVar mp_teamflag_1;ConVar mp_teamflag_1;
ConVar mp_teamflag_2;ConVar mp_teamflag_2;
ConVar wm_ready_tag;ConVar wm_ready_tag;
ConVar wm_ready_panel;ConVar wm_ready_panel;
ConVar mp_startmoney;ConVar mp_startmoney;
ConVar hostname;ConVar hostname;
/* ready system *//* ready system */
Handle g_m_ready_up = INVALID_HANDLE;Handle g_m_ready_up = INVALID_HANDLE;
bool g_ready_enabled = false;bool g_ready_enabled = false;
/* switches *//* switches */
bool g_active = true;bool g_active = true;
bool g_start = false;bool g_start = false;
bool g_match = false;bool g_match = false;
bool g_max_lock = false;bool g_max_lock = false;
bool g_live = false;bool g_live = false;
bool g_log_live = false;bool g_log_live = false;
bool g_restore = false;bool g_restore = false;
bool g_half_swap = true;bool g_half_swap = true;
bool g_first_half = true;bool g_first_half = true;
bool g_overtime = false;bool g_overtime = false;
bool g_t_money = false;bool g_t_money = false;
bool g_t_score = false;bool g_t_score = false;
bool g_t_knife = true;bool g_t_knife = true;
bool g_t_had_knife = false;bool g_t_had_knife = false;
bool g_second_half_first = false;bool g_second_half_first = false;
bool g_setNameLimiter = true;bool g_setNameLimiter = true;
bool g_DispInfoLimiter = true;bool g_DispInfoLimiter = true;
bool LiveOn2 = false;bool LiveOn2 = false;
bool LiveOn1 = false;bool LiveOn1 = false;
bool LiveOn3Text = false;bool LiveOn3Text = false;
bool KnifeOn2 = false;bool KnifeOn2 = false;
bool KnifeOn1 = false;bool KnifeOn1 = false;
bool KnifeOn3Text = false;bool KnifeOn3Text = false;
bool g_p_ct_name = false;bool g_p_ct_name = false;
bool g_p_t_name = false;bool g_p_t_name = false;
int g_knife_winner = 0;int g_knife_winner = 0;
bool g_knife_vote = false;bool g_knife_vote = false;
bool captain_file_checked_t = false;bool captain_file_checked_t = false;
bool captain_file_checked_ct = false;bool captain_file_checked_ct = false;
/* FTP Auto upload code [By Thrawn from tAutoDemoUpload] *//* FTP Auto upload code [By Thrawn from tAutoDemoUpload] */
ConVar wm_autodemoupload_enable;ConVar wm_autodemoupload_enable;
ConVar wm_autodemoupload_bzip2;ConVar wm_autodemoupload_bzip2;
ConVar wm_autodemoupload_ftptargetdemo;ConVar wm_autodemoupload_ftptargetdemo;
ConVar wm_autodemoupload_ftptargetlog;ConVar wm_autodemoupload_ftptargetlog;
char g_sFtpTargetDemo[255];char g_sFtpTargetDemo[255];
char g_sFtpTargetLog[255];char g_sFtpTargetLog[255];
ConVar wm_autodemoupload_delete;ConVar wm_autodemoupload_delete;
char g_sDemoPath[PLATFORM_MAX_PATH];char g_sDemoPath[PLATFORM_MAX_PATH];
char g_sDemoName[64];char g_sDemoName[64];
char g_sLogPath[PLATFORM_MAX_PATH];char g_sLogPath[PLATFORM_MAX_PATH];
bool g_bRecording = false;bool g_bRecording = false;
ConVar wm_autodemoupload_completed;ConVar wm_autodemoupload_completed;
bool g_MatchComplete = false;bool g_MatchComplete = false;
/* Warmod safemode *//* Warmod safemode */
ConVar wm_warmod_safemode;ConVar wm_warmod_safemode;
/* modes *//* modes */
int g_overtime_mode = 0;int g_overtime_mode = 0;
/* chat prefix *//* chat prefix */
char CHAT_PREFIX[64];char CHAT_PREFIX[64];
/* teams *//* teams */
char g_t_name[64];char g_t_name[64];
char g_t_name_escaped[64]; // pre-escaped for warmod logschar g_t_name_escaped[64]; // pre-escaped for warmod logs
char g_ct_name[64];char g_ct_name[64];
char g_ct_name_escaped[64]; // pre-escaped for warmod logschar g_ct_name_escaped[64]; // pre-escaped for warmod logs
/* clan tag *//* clan tag */
char g_clanTags[MAXPLAYERS +1 ][MAX_NAME_LENGTH];char g_clanTags[MAXPLAYERS +1 ][MAX_NAME_LENGTH];
bool g_clanTagsChecked[MAXPLAYERS + 1] = false;bool g_clanTagsChecked[MAXPLAYERS + 1] = false;
/* Config Offers *//* Config Offers */
bool default_offer_ct = false;bool default_offer_ct = false;
bool default_offer_t = false;bool default_offer_t = false;
Handle g_h_stored_timer_def = INVALID_HANDLE;Handle g_h_stored_timer_def = INVALID_HANDLE;
bool overtime_offer_ct = false;bool overtime_offer_ct = false;
bool overtime_offer_t = false;bool overtime_offer_t = false;
Handle g_h_stored_timer_ot = INVALID_HANDLE;Handle g_h_stored_timer_ot = INVALID_HANDLE;
bool playout_offer_ct = false;bool playout_offer_ct = false;
bool playout_offer_t = false;bool playout_offer_t = false;
Handle g_h_stored_timer_pl = INVALID_HANDLE;Handle g_h_stored_timer_pl = INVALID_HANDLE;
/* Pause and Unpause *//* Pause and Unpause */
bool g_pause_freezetime = false;bool g_pause_freezetime = false;
bool g_pause_offered_t = false;bool g_pause_offered_t = false;
bool g_pause_offered_ct = false;bool g_pause_offered_ct = false;
bool g_auto_pause = false;bool g_auto_pause = false;
bool FreezeTime = false;bool FreezeTime = false;
ConVar sv_pausable;ConVar sv_pausable;
ConVar sv_matchpause_auto_5v5;ConVar sv_matchpause_auto_5v5;
ConVar wm_auto_pause;ConVar wm_auto_pause;
ConVar wm_auto_unpause;ConVar wm_auto_unpause;
ConVar wm_auto_unpause_delay;ConVar wm_auto_unpause_delay;
ConVar wm_pause_confirm;ConVar wm_pause_confirm;
ConVar wm_unpause_confirm;ConVar wm_unpause_confirm;
ConVar wm_pause_limit;ConVar wm_pause_limit;
int g_t_pause_count = 0;int g_t_pause_count = 0;
int g_ct_pause_count = 0;int g_ct_pause_count = 0;
Handle g_h_stored_timer = INVALID_HANDLE;Handle g_h_stored_timer = INVALID_HANDLE;
Handle g_h_stored_timer_p = INVALID_HANDLE;Handle g_h_stored_timer_p = INVALID_HANDLE;
char g_c_backup[128];char g_c_backup[128];
/* Veto Settings *//* Veto Settings */
ConVar wm_pugsetup_maplist_file;ConVar wm_pugsetup_maplist_file;
ConVar wm_pugsetup_randomize_maps;ConVar wm_pugsetup_randomize_maps;
Handle g_MapNames = INVALID_HANDLE;Handle g_MapNames = INVALID_HANDLE;
Handle g_MapVetoed = INVALID_HANDLE;Handle g_MapVetoed = INVALID_HANDLE;
ConVar wm_veto;ConVar wm_veto;
ConVar wm_veto_bo3;ConVar wm_veto_bo3;
ConVar wm_veto_random;ConVar wm_veto_random;
ConVar wm_veto_select;ConVar wm_veto_select;
ConVar wm_veto_knife;ConVar wm_veto_knife;
ConVar tv_delaymapchange;ConVar tv_delaymapchange;
ConVar tv_delay;ConVar tv_delay;
ConVar mp_match_end_restart;ConVar mp_match_end_restart;
ConVar wm_captain_from_file;ConVar wm_captain_from_file;
int g_bo3_count = -1;int g_bo3_count = -1;
int g_bo5_count = -1;int g_bo5_count = -1;
int g_ChosenMapBo2[2] = -1;int g_ChosenMapBo2[2] = -1;
int g_ChosenMapBo3[3] = -1;int g_ChosenMapBo3[3] = -1;
int g_ChosenMapBo5[5] = -1;int g_ChosenMapBo5[5] = -1;
int g_ChosenMap = -1;int g_ChosenMap = -1;
int g_MapListCount = 0;int g_MapListCount = 0;
bool g_veto_s = false;bool g_veto_s = false;
bool g_t_veto = false;bool g_t_veto = false;
bool g_veto_active = false;bool g_veto_active = false;
bool g_veto_bo5_active = false;bool g_veto_bo5_active = false;
bool g_veto_bo3_active = false;bool g_veto_bo3_active = false;
bool g_veto_bo2_active = false;bool g_veto_bo2_active = false;
int g_veto_map_number = 0;int g_veto_map_number = 0;
int g_veto_number = 0;int g_veto_number = 0;
int g_capt1 = -1;int g_capt1 = -1;
int g_capt2 = -1;int g_capt2 = -1;
bool veto_offer_ct = false;bool veto_offer_ct = false;
bool veto_offer_t = false;bool veto_offer_t = false;
Handle g_h_stored_timer_v = INVALID_HANDLE;Handle g_h_stored_timer_v = INVALID_HANDLE;
/* Print Damage *//* Print Damage */
int g_DamageDone[MAXPLAYERS+1][MAXPLAYERS+1];int g_DamageDone[MAXPLAYERS+1][MAXPLAYERS+1];
int g_DamageDoneHits[MAXPLAYERS+1][MAXPLAYERS+1];int g_DamageDoneHits[MAXPLAYERS+1][MAXPLAYERS+1];
bool g_GotKill[MAXPLAYERS+1][MAXPLAYERS+1];bool g_GotKill[MAXPLAYERS+1][MAXPLAYERS+1];
ConVar wm_damageprint_auto_color;ConVar wm_damageprint_auto_color;
ConVar wm_damageprint_enabled;ConVar wm_damageprint_enabled;
ConVar wm_damageprint_format;ConVar wm_damageprint_format;
/* Teams *//* Teams */
bool team_switch = false;bool team_switch = false;
ConVar wm_name_fix;ConVar wm_name_fix;
/* BanOn Disconnect *//* BanOn Disconnect */
bool g_disconnect[MAXPLAYERS + 1] = false;bool g_disconnect[MAXPLAYERS + 1] = false;
ConVar wm_ban_on_disconnect;ConVar wm_ban_on_disconnect;
ConVar wm_ban_percentage;ConVar wm_ban_percentage;
ConVar sv_kick_ban_duration;ConVar sv_kick_ban_duration;
/* Random Team Names and Logos *//* Random Team Names and Logos */
static char g_teamName[][] = {"3DMAX", "Astana Dragons", "Bravado Gaming", "Cloud9", "Counter Logic Gaming", "Clan Mystik", "compLexity", "Copenhagen Wolves", "dAT Team", "Team Dignitas", "Epsilon eSports", "ESC Gaming", "Flipsid3 Tactics", "fnatic", "HellRaisers", "iBUYPOWER", "Team Wolf", "Keyd Stars", "London Conspiracy", "Team LDLC.com", "LGB eSports", "mousesports", "MyXMG", "Natus Vincere", "Ninjas in Pyjamas", "Team EnVyUs", "PENTA Sports", "Planetkey Dynamics", "Reason Gaming", "Team SoloMid", "Titan", "Vox Eminor", "VeryGames", "Virtus.Pro"};static char g_teamName[][] = {"3DMAX", "Astana Dragons", "Bravado Gaming", "Cloud9", "Counter Logic Gaming", "Clan Mystik", "compLexity", "Copenhagen Wolves", "dAT Team", "Team Dignitas", "Epsilon eSports", "ESC Gaming", "Flipsid3 Tactics", "fnatic", "HellRaisers", "iBUYPOWER", "Team Wolf", "Keyd Stars", "London Conspiracy", "Team LDLC.com", "LGB eSports", "mousesports", "MyXMG", "Natus Vincere", "Ninjas in Pyjamas", "Team EnVyUs", "PENTA Sports", "Planetkey Dynamics", "Reason Gaming", "Team SoloMid", "Titan", "Vox Eminor", "VeryGames", "Virtus.Pro"};
static char g_teamTag[][] = {"3DMAX", "Astana Dragons", "Bravado", "Cloud9", "CLG", "Clan Mystik", "compLexity", "CPH Wolves", "dAT Team", "Dignitas", "Epsilon", "ESC", "Flipsid3", "fnatic", "HellRaisers", "iBUYPOWER", "Team Wolf", "Keyd Stars", "Ldn-Con", "Team LDLC", "LGB", "mousesports", "MyXMG", "Na`Vi", "NiP", "Team EnVyUs", "PENTA", "Planetkey", "Reason", "TSM", "Titan", "Vox Eminor", "VeryGames", "Virtus.Pro"};static char g_teamTag[][] = {"3DMAX", "Astana Dragons", "Bravado", "Cloud9", "CLG", "Clan Mystik", "compLexity", "CPH Wolves", "dAT Team", "Dignitas", "Epsilon", "ESC", "Flipsid3", "fnatic", "HellRaisers", "iBUYPOWER", "Team Wolf", "Keyd Stars", "Ldn-Con", "Team LDLC", "LGB", "mousesports", "MyXMG", "Na`Vi", "NiP", "Team EnVyUs", "PENTA", "Planetkey", "Reason", "TSM", "Titan", "Vox Eminor", "VeryGames", "Virtus.Pro"};
static char g_teamLogo[][] = {"3dm", "ad", "bravg", "c9", "clg", "cm", "col", "cw", "dat", "dig", "eps", "esc", "flip", "fntc", "hlr", "ibp", "indw", "keyd", "lc", "ldlc", "lgb", "mss", "myxmg", "navi", "nip", "nv", "penta", "pkd", "rgg", "tsm", "tit", "ve", "vg", "vp"};static char g_teamLogo[][] = {"3dm", "ad", "bravg", "c9", "clg", "cm", "col", "cw", "dat", "dig", "eps", "esc", "flip", "fntc", "hlr", "ibp", "indw", "keyd", "lc", "ldlc", "lgb", "mss", "myxmg", "navi", "nip", "nv", "penta", "pkd", "rgg", "tsm", "tit", "ve", "vg", "vp"};
int g_teamNumber_ct = 0;int g_teamNumber_ct = 0;
int g_teamNumber_t = 0;int g_teamNumber_t = 0;
bool g_tag_set = false;bool g_tag_set = false;
ConVar wm_random_team_names;ConVar wm_random_team_names;
bool g_first_load = true;bool g_first_load = true;
int g_map_loaded = 0;int g_map_loaded = 0;
/* admin menu *//* admin menu */
Handle g_h_menu = INVALID_HANDLE;Handle g_h_menu = INVALID_HANDLE;
/* Plugin info *//* Plugin info */
#define UPDATE_URL "https://warmod.bitbucket.io/updatefile.txt"#define UPDATE_URL "https://warmod.bitbucket.io/updatefile.txt"
#define WM_VERSION "18.05.24.0924"#define WM_VERSION "18.05.24.0924"
#define WM_DESCRIPTION "An automative service for CS:GO competition matches"#define WM_DESCRIPTION "An automative service for CS:GO competition matches"
public Plugin myinfo = {public Plugin myinfo = {
name = "[BFG] WarMod", name = "[BFG] WarMod",
author = "Versatile_BFG", author = "Versatile_BFG",
description = WM_DESCRIPTION, description = WM_DESCRIPTION,
version = WM_VERSION, version = WM_VERSION,
url = "www.sourcemod.net" url = "www.sourcemod.net"
};};
public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
{{
MarkNativeAsOptional("Zip_Open"); MarkNativeAsOptional("Zip_Open");
MarkNativeAsOptional("Zip_AddFile"); MarkNativeAsOptional("Zip_AddFile");
MarkNativeAsOptional("EasyFTP_UploadFile"); MarkNativeAsOptional("EasyFTP_UploadFile");
RegPluginLibrary("warmod"); RegPluginLibrary("warmod");
return APLRes_Success; return APLRes_Success;
}}
public void OnPluginStart()public void OnPluginStart()
{{
//auto update //auto update
if (LibraryExists("updater")) if (LibraryExists("updater"))
{ {
Updater_AddPlugin(UPDATE_URL); Updater_AddPlugin(UPDATE_URL);
} }
g_first_load = true; g_first_load = true;
CheckConFigFiles(WM_VERSION); CheckConFigFiles(WM_VERSION);
LoadTranslations("warmod.phrases"); LoadTranslations("warmod.phrases");
LoadTranslations("common.phrases"); LoadTranslations("common.phrases");
LoadTranslations("basebans.phrases"); LoadTranslations("basebans.phrases");
AutoExecConfig(); AutoExecConfig();
Handle topmenu; Handle topmenu;
if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE)) if (LibraryExists("adminmenu") && ((topmenu = GetAdminTopMenu()) != INVALID_HANDLE))
{ {
OnAdminMenuReady(topmenu); OnAdminMenuReady(topmenu);
} }
g_f_on_lo3 = CreateGlobalForward("OnLiveOn3", ET_Ignore); g_f_on_lo3 = CreateGlobalForward("OnLiveOn3", ET_Ignore);
g_f_on_round_end = CreateGlobalForward("OnRoundEnd", ET_Ignore, Param_String, Param_Cell, Param_Cell, Param_String); g_f_on_round_end = CreateGlobalForward("OnRoundEnd", ET_Ignore, Param_String, Param_Cell, Param_Cell, Param_String);
g_f_on_half_time = CreateGlobalForward("OnHalfTime", ET_Ignore, Param_String, Param_Cell, Param_Cell, Param_String); g_f_on_half_time = CreateGlobalForward("OnHalfTime", ET_Ignore, Param_String, Param_Cell, Param_Cell, Param_String);
g_f_on_reset_half = CreateGlobalForward("OnResetHalf", ET_Ignore); g_f_on_reset_half = CreateGlobalForward("OnResetHalf", ET_Ignore);
g_f_on_reset_match = CreateGlobalForward("OnResetMatch", ET_Ignore); g_f_on_reset_match = CreateGlobalForward("OnResetMatch", ET_Ignore);
g_f_on_end_match = CreateGlobalForward("OnEndMatch", ET_Ignore, Param_String, Param_Cell, Param_Cell, Param_String); g_f_on_end_match = CreateGlobalForward("OnEndMatch", ET_Ignore, Param_String, Param_Cell, Param_Cell, Param_String);
g_f_livewire_log_event = CreateGlobalForward("LiveWireLogEvent", ET_Ignore, Param_String); g_f_livewire_log_event = CreateGlobalForward("LiveWireLogEvent", ET_Ignore, Param_String);
AddCommandListener(Command_JoinTeam, "jointeam"); AddCommandListener(Command_JoinTeam, "jointeam");
AddCommandListener(UnpauseMatch, "mp_unpause_match"); AddCommandListener(UnpauseMatch, "mp_unpause_match");
AddCommandListener(MatchRestore, "mp_backup_restore_load_file"); AddCommandListener(MatchRestore, "mp_backup_restore_load_file");
RegConsoleCmd("score", ConsoleScore); RegConsoleCmd("score", ConsoleScore);
RegConsoleCmd("wm_version", WMVersion); RegConsoleCmd("wm_version", WMVersion);
RegConsoleCmd("buy", RestrictBuy); RegConsoleCmd("buy", RestrictBuy);
RegConsoleCmd("jointeam", ChooseTeam); RegConsoleCmd("jointeam", ChooseTeam);
RegConsoleCmd("spectate", ChooseTeam); RegConsoleCmd("spectate", ChooseTeam);
RegConsoleCmd("wm_readylist", ReadyList); RegConsoleCmd("wm_readylist", ReadyList);
RegConsoleCmd("wmrl", ReadyList); RegConsoleCmd("wmrl", ReadyList);
RegConsoleCmd("wm_cash", AskTeamMoney); RegConsoleCmd("wm_cash", AskTeamMoney);
RegConsoleCmd("sm_name", SetName, "Sets the name for the team. Only active when wm_require_names 1 and at start of match"); RegConsoleCmd("sm_name", SetName, "Sets the name for the team. Only active when wm_require_names 1 and at start of match");
RegConsoleCmd("sm_logo", SetLogo, "Sets the logo and name for the team. Only active when wm_require_logos 1 and at start of match"); RegConsoleCmd("sm_logo", SetLogo, "Sets the logo and name for the team. Only active when wm_require_logos 1 and at start of match");
RegConsoleCmd("sm_ready", ReadyUp, "Readies up the client"); RegConsoleCmd("sm_ready", ReadyUp, "Readies up the client");
RegConsoleCmd("sm_r", ReadyUp, "Readies up the client"); RegConsoleCmd("sm_r", ReadyUp, "Readies up the client");
RegConsoleCmd("sm_rdy", ReadyUp, "Readies up the client"); RegConsoleCmd("sm_rdy", ReadyUp, "Readies up the client");
RegConsoleCmd("sm_unready", ReadyDown, "Readies down the client"); RegConsoleCmd("sm_unready", ReadyDown, "Readies down the client");
RegConsoleCmd("sm_ur", ReadyDown, "Readies down the client"); RegConsoleCmd("sm_ur", ReadyDown, "Readies down the client");
RegConsoleCmd("sm_urdy", ReadyDown, "Readies down the client"); RegConsoleCmd("sm_urdy", ReadyDown, "Readies down the client");
RegConsoleCmd("sm_info", ReadyInfoPriv, "Shows ready info"); RegConsoleCmd("sm_info", ReadyInfoPriv, "Shows ready info");
RegConsoleCmd("sm_i", ReadyInfoPriv, "Shows ready info"); RegConsoleCmd("sm_i", ReadyInfoPriv, "Shows ready info");
RegConsoleCmd("sm_score", ShowScore, "Shows score to client"); RegConsoleCmd("sm_score", ShowScore, "Shows score to client");
RegConsoleCmd("sm_s", ShowScore, "Shows score to client"); RegConsoleCmd("sm_s", ShowScore, "Shows score to client");
RegConsoleCmd("sm_stay", Stay, "Stay command for knife round"); RegConsoleCmd("sm_stay", Stay, "Stay command for knife round");
RegConsoleCmd("sm_switch", Switch, "Switch command for knife round"); RegConsoleCmd("sm_switch", Switch, "Switch command for knife round");
RegConsoleCmd("sm_swap", Switch, "Switch command for knife round"); RegConsoleCmd("sm_swap", Switch, "Switch command for knife round");
RegConsoleCmd("sm_pause", Pause, "Pauses the match"); RegConsoleCmd("sm_pause", Pause, "Pauses the match");
RegConsoleCmd("sm_unpause", Unpause, "Resumes the match"); RegConsoleCmd("sm_unpause", Unpause, "Resumes the match");
RegConsoleCmd("sm_playout", PlayOut_Offer, "Sets the match to be in play out mode"); RegConsoleCmd("sm_playout", PlayOut_Offer, "Sets the match to be in play out mode");
RegConsoleCmd("sm_pl", PlayOut_Offer, "Sets the match to be in play out mode"); RegConsoleCmd("sm_pl", PlayOut_Offer, "Sets the match to be in play out mode");
RegConsoleCmd("sm_hardprac", PlayOut_Offer, "Sets the match to be in play out mode"); RegConsoleCmd("sm_hardprac", PlayOut_Offer, "Sets the match to be in play out mode");
RegConsoleCmd("sm_hp", PlayOut_Offer, "Sets the match to be in play out mode"); RegConsoleCmd("sm_hp", PlayOut_Offer, "Sets the match to be in play out mode");
RegConsoleCmd("sm_overtime", OverTime_Offer, "Sets the match to be in overtime mode"); RegConsoleCmd("sm_overtime", OverTime_Offer, "Sets the match to be in overtime mode");
RegConsoleCmd("sm_ot", OverTime_Offer, "Sets the match to be in overtime mode"); RegConsoleCmd("sm_ot", OverTime_Offer, "Sets the match to be in overtime mode");
RegConsoleCmd("sm_normal", Default_Offer, "Sets the match to be in default mode"); RegConsoleCmd("sm_normal", Default_Offer, "Sets the match to be in default mode");
RegConsoleCmd("sm_norm", Default_Offer, "Sets the match to be in default mode"); RegConsoleCmd("sm_norm", Default_Offer, "Sets the match to be in default mode");
RegConsoleCmd("sm_default", Default_Offer, "Sets the match to be in default mode"); RegConsoleCmd("sm_default", Default_Offer, "Sets the match to be in default mode");
RegConsoleCmd("sm_def", Default_Offer, "Sets the match to be in default mode"); RegConsoleCmd("sm_def", Default_Offer, "Sets the match to be in default mode");
/* Veto cmds */ /* Veto cmds */
RegConsoleCmd("sm_vetobo1", Veto_Bo1, "Ask for a Bo1 Veto"); RegConsoleCmd("sm_vetobo1", Veto_Bo1, "Ask for a Bo1 Veto");
RegConsoleCmd("sm_vetobo2", Veto_Bo2, "Ask for a Bo2 Veto"); RegConsoleCmd("sm_vetobo2", Veto_Bo2, "Ask for a Bo2 Veto");
RegConsoleCmd("sm_vetobo3", Veto_Bo3, "Ask for a Bo3 Veto"); RegConsoleCmd("sm_vetobo3", Veto_Bo3, "Ask for a Bo3 Veto");
RegConsoleCmd("sm_vetobo5", Veto_Bo5, "Ask for a Bo5 Veto"); RegConsoleCmd("sm_vetobo5", Veto_Bo5, "Ask for a Bo5 Veto");
RegConsoleCmd("sm_veto", Veto_Setup, "Ask for Veto"); RegConsoleCmd("sm_veto", Veto_Setup, "Ask for Veto");
RegConsoleCmd("sm_veto1", Veto_Bo1, "Ask for a Bo1 Veto"); RegConsoleCmd("sm_veto1", Veto_Bo1, "Ask for a Bo1 Veto");
RegConsoleCmd("sm_veto2", Veto_Bo2, "Ask for a Bo2 Veto"); RegConsoleCmd("sm_veto2", Veto_Bo2, "Ask for a Bo2 Veto");
RegConsoleCmd("sm_veto3", Veto_Bo3, "Ask for a Bo3 Veto"); RegConsoleCmd("sm_veto3", Veto_Bo3, "Ask for a Bo3 Veto");
RegConsoleCmd("sm_veto5", Veto_Bo5, "Ask for a Bo5 Veto"); RegConsoleCmd("sm_veto5", Veto_Bo5, "Ask for a Bo5 Veto");
RegConsoleCmd("sm_vetomaps", Veto_Bo3_Maps, "Veto Bo3 Maps"); RegConsoleCmd("sm_vetomaps", Veto_Bo3_Maps, "Veto Bo3 Maps");
/* admin commands */ /* admin commands */
RegAdminCmd("notlive", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round"); RegAdminCmd("notlive", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("nl", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round"); RegAdminCmd("nl", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("cancelhalf", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round"); RegAdminCmd("cancelhalf", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("ch", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round"); RegAdminCmd("ch", NotLive, ADMFLAG_CUSTOM1, "Declares half not live and restarts the round");
RegAdminCmd("cancelmatch", CancelMatch, ADMFLAG_CUSTOM1, "Declares match not live and restarts round"); RegAdminCmd("cancelmatch", CancelMatch, ADMFLAG_CUSTOM1, "Declares match not live and restarts round");
RegAdminCmd("cm", CancelMatch, ADMFLAG_CUSTOM1, "Declares match not live and restarts round"); RegAdminCmd("cm", CancelMatch, ADMFLAG_CUSTOM1, "Declares match not live and restarts round");
RegAdminCmd("readyup", ReadyToggle, ADMFLAG_CUSTOM1, "Starts or stops the ReadyUp System"); RegAdminCmd("readyup", ReadyToggle, ADMFLAG_CUSTOM1, "Starts or stops the ReadyUp System");
RegAdminCmd("ru", ReadyToggle, ADMFLAG_CUSTOM1, "Starts or stops the ReadyUp System"); RegAdminCmd("ru", ReadyToggle, ADMFLAG_CUSTOM1, "Starts or stops the ReadyUp System");
RegAdminCmd("t", ChangeT, ADMFLAG_CUSTOM1, "Team starting terrorists - Designed for score purposes"); RegAdminCmd("t", ChangeT, ADMFLAG_CUSTOM1, "Team starting terrorists - Designed for score purposes");
RegAdminCmd("ct", ChangeCT, ADMFLAG_CUSTOM1, "Team starting counter-terrorists - Designed for score purposes"); RegAdminCmd("ct", ChangeCT, ADMFLAG_CUSTOM1, "Team starting counter-terrorists - Designed for score purposes");
RegAdminCmd("sst", SetScoreT, ADMFLAG_CUSTOM1, "Setting terrorists score"); RegAdminCmd("sst", SetScoreT, ADMFLAG_CUSTOM1, "Setting terrorists score");
RegAdminCmd("ssct", SetScoreCT, ADMFLAG_CUSTOM1, "Setting counter-terrorists scores"); RegAdminCmd("ssct", SetScoreCT, ADMFLAG_CUSTOM1, "Setting counter-terrorists scores");
RegAdminCmd("aswap", SwapAll, ADMFLAG_CUSTOM1, "Swap all players to the opposite team"); RegAdminCmd("aswap", SwapAll, ADMFLAG_CUSTOM1, "Swap all players to the opposite team");
RegAdminCmd("prac", Practice, ADMFLAG_CUSTOM1, "Puts server into a practice mode state"); RegAdminCmd("prac", Practice, ADMFLAG_CUSTOM1, "Puts server into a practice mode state");
RegAdminCmd("warmup", WarmUp, ADMFLAG_CUSTOM1, "Puts server into a warm up state"); RegAdminCmd("warmup", WarmUp, ADMFLAG_CUSTOM1, "Puts server into a warm up state");
RegAdminCmd("pwd", ChangePassword, ADMFLAG_PASSWORD, "Set or display the sv_password console variable"); RegAdminCmd("pwd", ChangePassword, ADMFLAG_PASSWORD, "Set or display the sv_password console variable");
RegAdminCmd("pw", ChangePassword, ADMFLAG_PASSWORD, "Set or display the sv_password console variable"); RegAdminCmd("pw", ChangePassword, ADMFLAG_PASSWORD, "Set or display the sv_password console variable");
RegAdminCmd("active", ActiveToggle, ADMFLAG_CUSTOM1, "Toggle the wm_active console variable"); RegAdminCmd("active", ActiveToggle, ADMFLAG_CUSTOM1, "Toggle the wm_active console variable");
RegAdminCmd("minready", ChangeMinReady, ADMFLAG_CUSTOM1, "Set or display the wm_min_ready console variable"); RegAdminCmd("minready", ChangeMinReady, ADMFLAG_CUSTOM1, "Set or display the wm_min_ready console variable");
RegAdminCmd("maxrounds", ChangeMaxRounds, ADMFLAG_CUSTOM1, "Set or display the wm_max_rounds console variable"); RegAdminCmd("maxrounds", ChangeMaxRounds, ADMFLAG_CUSTOM1, "Set or display the wm_max_rounds console variable");
RegAdminCmd("knife", KnifeOn3, ADMFLAG_CUSTOM1, "Remove all weapons except knife and lo3"); RegAdminCmd("knife", KnifeOn3, ADMFLAG_CUSTOM1, "Remove all weapons except knife and lo3");
RegAdminCmd("ko3", KnifeOn3, ADMFLAG_CUSTOM1, "Remove all weapons except knife and lo3"); RegAdminCmd("ko3", KnifeOn3, ADMFLAG_CUSTOM1, "Remove all weapons except knife and lo3");
RegAdminCmd("cancelknife", CancelKnife, ADMFLAG_CUSTOM1, "Declares knife not live and restarts round"); RegAdminCmd("cancelknife", CancelKnife, ADMFLAG_CUSTOM1, "Declares knife not live and restarts round");
RegAdminCmd("ck", CancelKnife, ADMFLAG_CUSTOM1, "Declares knife not live and restarts round"); RegAdminCmd("ck", CancelKnife, ADMFLAG_CUSTOM1, "Declares knife not live and restarts round");
RegAdminCmd("forceallready", ForceAllReady, ADMFLAG_CUSTOM1, "Forces all players to become ready"); RegAdminCmd("forceallready", ForceAllReady, ADMFLAG_CUSTOM1, "Forces all players to become ready");
RegAdminCmd("far", ForceAllReady, ADMFLAG_CUSTOM1, "Forces all players to become ready"); RegAdminCmd("far", ForceAllReady, ADMFLAG_CUSTOM1, "Forces all players to become ready");
RegAdminCmd("forceallunready", ForceAllUnready, ADMFLAG_CUSTOM1, "Forces all players to become unready"); RegAdminCmd("forceallunready", ForceAllUnready, ADMFLAG_CUSTOM1, "Forces all players to become unready");
RegAdminCmd("faur", ForceAllUnready, ADMFLAG_CUSTOM1, "Forces all players to become unready"); RegAdminCmd("faur", ForceAllUnready, ADMFLAG_CUSTOM1, "Forces all players to become unready");
RegAdminCmd("forceallspectate", ForceAllSpectate, ADMFLAG_CUSTOM1, "Forces all players to become a spectator"); RegAdminCmd("forceallspectate", ForceAllSpectate, ADMFLAG_CUSTOM1, "Forces all players to become a spectator");
RegAdminCmd("fas", ForceAllSpectate, ADMFLAG_CUSTOM1, "Forces all players to become a spectator"); RegAdminCmd("fas", ForceAllSpectate, ADMFLAG_CUSTOM1, "Forces all players to become a spectator");
RegAdminCmd("lo3", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count"); RegAdminCmd("lo3", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count");
RegAdminCmd("forcestart", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count"); RegAdminCmd("forcestart", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count");
RegAdminCmd("fs", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count"); RegAdminCmd("fs", ForceStart, ADMFLAG_CUSTOM1, "Starts the match regardless of player and ready count");
RegAdminCmd("forceend", ForceEnd, ADMFLAG_CUSTOM1, "Ends the match regardless of status"); RegAdminCmd("forceend", ForceEnd, ADMFLAG_CUSTOM1, "Ends the match regardless of status");
RegAdminCmd("fe", ForceEnd, ADMFLAG_CUSTOM1, "Ends the match regardless of status"); RegAdminCmd("fe", ForceEnd, ADMFLAG_CUSTOM1, "Ends the match regardless of status");
RegAdminCmd("readyon", ReadyOn, ADMFLAG_CUSTOM1, "Turns on or restarts the ReadyUp System"); RegAdminCmd("readyon", ReadyOn, ADMFLAG_CUSTOM1, "Turns on or restarts the ReadyUp System");
RegAdminCmd("ron", ReadyOn, ADMFLAG_CUSTOM1, "Turns on or restarts the ReadyUp System"); RegAdminCmd("ron", ReadyOn, ADMFLAG_CUSTOM1, "Turns on or restarts the ReadyUp System");
RegAdminCmd("readyoff", ReadyOff, ADMFLAG_CUSTOM1, "Turns off the ReadyUp System if enabled"); RegAdminCmd("readyoff", ReadyOff, ADMFLAG_CUSTOM1, "Turns off the ReadyUp System if enabled");
RegAdminCmd("roff", ReadyOff, ADMFLAG_CUSTOM1, "Turns off the ReadyUp System if enabled"); RegAdminCmd("roff", ReadyOff, ADMFLAG_CUSTOM1, "Turns off the ReadyUp System if enabled");
RegAdminCmd("updatecfgs", UpdateCFGs, ADMFLAG_CUSTOM1, "Updates configs with the latest format"); RegAdminCmd("updatecfgs", UpdateCFGs, ADMFLAG_CUSTOM1, "Updates configs with the latest format");
// server commands // server commands
RegServerCmd("wm_status", WarMod_Status); RegServerCmd("wm_status", WarMod_Status);
RegServerCmd("wm_forceteam", ForceTeam, "Force the SteamID64 client to a team"); RegServerCmd("wm_forceteam", ForceTeam, "Force the SteamID64 client to a team");
RegServerCmd("wm_clear_forceteam_all", ClearForceTeamAll, "Clears the list for forced teams"); RegServerCmd("wm_clear_forceteam_all", ClearForceTeamAll, "Clears the list for forced teams");
RegServerCmd("wm_clear_forceteam_t", ClearForceTeamT, "Clears the list for forced terrorist team"); RegServerCmd("wm_clear_forceteam_t", ClearForceTeamT, "Clears the list for forced terrorist team");
RegServerCmd("wm_clear_forceteam_ct", ClearForceTeamCT, "Clears the list for forced counter-terrorist team"); RegServerCmd("wm_clear_forceteam_ct", ClearForceTeamCT, "Clears the list for forced counter-terrorist team");
RegServerCmd("wm_forcename", ForceClientName, "Force the SteamID64 client's name"); RegServerCmd("wm_forcename", ForceClientName, "Force the SteamID64 client's name");
/* Warmod Convars */ /* Warmod Convars */
wm_active = CreateConVar("wm_active", "1", "Enable or disable WarMod as active", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_active = CreateConVar("wm_active", "1", "Enable or disable WarMod as active", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_warmod_safemode = CreateConVar("wm_warmod_safemode", "0", "This disables features that usually break on a CS:GO update", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_warmod_safemode = CreateConVar("wm_warmod_safemode", "0", "This disables features that usually break on a CS:GO update", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_rcon_only = CreateConVar("wm_rcon_only", "0", "Enable or disable admin commands to be only executed via RCON or console", FCVAR_NONE, true, 0.0, true, 1.0); wm_rcon_only = CreateConVar("wm_rcon_only", "0", "Enable or disable admin commands to be only executed via RCON or console", FCVAR_NONE, true, 0.0, true, 1.0);
CreateConVar("wm_version_notify", WM_VERSION, WM_DESCRIPTION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD); CreateConVar("wm_version_notify", WM_VERSION, WM_DESCRIPTION, FCVAR_SPONLY|FCVAR_REPLICATED|FCVAR_NOTIFY|FCVAR_DONTRECORD);
wm_chat_prefix = CreateConVar("wm_chat_prefix", "WarMod_BFG", "Change the chat prefix. Default is WarMod_BFG", FCVAR_PROTECTED); wm_chat_prefix = CreateConVar("wm_chat_prefix", "GGA [LAN]", "Change the chat prefix. Default is GGA_LAN", FCVAR_PROTECTED);
wm_ready_panel = CreateConVar("wm_ready_panel", "1", "Enable Ready Panel or text based system, Text = 0, Panel = 1", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_ready_panel = CreateConVar("wm_ready_panel", "1", "Enable Ready Panel or text based system, Text = 0, Panel = 1", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_ready_tag = CreateConVar("wm_ready_tag", "1", "Enable or disable the ready & not ready clan tags", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_ready_tag = CreateConVar("wm_ready_tag", "1", "Enable or disable the ready & not ready clan tags", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_lock_teams = CreateConVar("wm_lock_teams", "1", "Enable or disable locked teams when a match is running", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_lock_teams = CreateConVar("wm_lock_teams", "1", "Enable or disable locked teams when a match is running", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_min_ready = CreateConVar("wm_min_ready", "10", "Sets the minimum required ready players to Live on 3", FCVAR_NOTIFY); wm_min_ready = CreateConVar("wm_min_ready", "10", "Sets the minimum required ready players to Live on 3", FCVAR_NOTIFY);
wm_max_players = CreateConVar("wm_max_players", "10", "Sets the maximum players allowed on both teams combined, others will be forced to spectator (0 = unlimited)", FCVAR_NOTIFY, true, 0.0); wm_max_players = CreateConVar("wm_max_players", "10", "Sets the maximum players allowed on both teams combined, others will be forced to spectator (0 = unlimited)", FCVAR_NOTIFY, true, 0.0);
wm_half_time_break = CreateConVar("wm_half_time_break", "0", "Pause game at halftime for a break, No break = 0, break = 1", FCVAR_NONE, true, 0.0, true, 1.0); wm_half_time_break = CreateConVar("wm_half_time_break", "0", "Pause game at halftime for a break, No break = 0, break = 1", FCVAR_NONE, true, 0.0, true, 1.0);
wm_over_time_break = CreateConVar("wm_over_time_break", "0", "Pause game at overtime for a break, No break = 0, break = 1", FCVAR_NONE, true, 0.0, true, 1.0); wm_over_time_break = CreateConVar("wm_over_time_break", "0", "Pause game at overtime for a break, No break = 0, break = 1", FCVAR_NONE, true, 0.0, true, 1.0);
wm_round_money = CreateConVar("wm_round_money", "1", "Enable or disable a client's team mates money to be displayed at the start of a round (to him only)", FCVAR_NONE, true, 0.0, true, 1.0); wm_round_money = CreateConVar("wm_round_money", "1", "Enable or disable a client's team mates money to be displayed at the start of a round (to him only)", FCVAR_NONE, true, 0.0, true, 1.0);
wm_ingame_scores = CreateConVar("wm_ingame_scores", "1", "Enable or disable ingame scores to be showed at the end of each round", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_ingame_scores = CreateConVar("wm_ingame_scores", "1", "Enable or disable ingame scores to be showed at the end of each round", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_require_names = CreateConVar("wm_require_names", "0", "Enable or disable the requirement of set team names for lo3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_require_names = CreateConVar("wm_require_names", "0", "Enable or disable the requirement of set team names for lo3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_require_logos = CreateConVar("wm_require_logos", "0", "Enable or disable the requirement of set team logos for lo3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_require_logos = CreateConVar("wm_require_logos", "0", "Enable or disable the requirement of set team logos for lo3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_logos_menu_only = CreateConVar("wm_logos_menu_only", "0", "Set to use the Menu only for Logo Selection", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_logos_menu_only = CreateConVar("wm_logos_menu_only", "0", "Set to use the Menu only for Logo Selection", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_random_team_names = CreateConVar("wm_random_team_names", "0", "Enable or disable the random set of a pro team name for the match", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_random_team_names = CreateConVar("wm_random_team_names", "0", "Enable or disable the random set of a pro team name for the match", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_show_info = CreateConVar("wm_show_info", "1", "Enable or disable the display of the Ready System to players", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_show_info = CreateConVar("wm_show_info", "1", "Enable or disable the display of the Ready System to players", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_auto_ready = CreateConVar("wm_auto_ready", "1", "Enable or disable the ready system being automatically enabled on map change", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_auto_ready = CreateConVar("wm_auto_ready", "1", "Enable or disable the ready system being automatically enabled on map change", FCVAR_NOTIFY, true, 0.0, true, 1.0);
/* Ban Convars */ /* Ban Convars */
wm_ban_on_disconnect = CreateConVar("wm_ban_on_disconnect", "0", "Enable or disable players banned on disconnect if match is live", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_ban_on_disconnect = CreateConVar("wm_ban_on_disconnect", "0", "Enable or disable players banned on disconnect if match is live", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_ban_percentage = CreateConVar("wm_ban_percentage", "0.75", "Percentage of wm_max_players that will be banned on disconnect", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_ban_percentage = CreateConVar("wm_ban_percentage", "0.75", "Percentage of wm_max_players that will be banned on disconnect", FCVAR_NOTIFY, true, 0.0, true, 1.0);
sv_kick_ban_duration = FindConVar("sv_kick_ban_duration"); sv_kick_ban_duration = FindConVar("sv_kick_ban_duration");
/* Stats & Demo Convars */ /* Stats & Demo Convars */
tv_enable = FindConVar("tv_enable"); tv_enable = FindConVar("tv_enable");
wm_stats_enabled = CreateConVar("wm_stats_enabled", "1", "Enable or disable statistical logging", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_stats_enabled = CreateConVar("wm_stats_enabled", "1", "Enable or disable statistical logging", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_stats_method = CreateConVar("wm_stats_method", "2", "Sets the stats logging method: 0 = UDP stream/server logs, 1 = WarMod logs, 2 = both", FCVAR_NOTIFY, true, 0.0, true, 2.0); wm_stats_method = CreateConVar("wm_stats_method", "2", "Sets the stats logging method: 0 = UDP stream/server logs, 1 = WarMod logs, 2 = both", FCVAR_NOTIFY, true, 0.0, true, 2.0);
wm_stats_trace = CreateConVar("wm_stats_trace", "0", "Enable or disable updating all player positions, every wm_stats_trace_delay seconds", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_stats_trace = CreateConVar("wm_stats_trace", "0", "Enable or disable updating all player positions, every wm_stats_trace_delay seconds", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_stats_trace_delay = CreateConVar("wm_stats_trace_delay", "5", "The amount of time between sending player position updates", FCVAR_NOTIFY, true, 0.0); wm_stats_trace_delay = CreateConVar("wm_stats_trace_delay", "5", "The amount of time between sending player position updates", FCVAR_NOTIFY, true, 0.0);
wm_auto_record = CreateConVar("wm_auto_record", "1", "Enable or disable auto SourceTV demo record on Live on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_auto_record = CreateConVar("wm_auto_record", "1", "Enable or disable auto SourceTV demo record on Live on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_save_dir = CreateConVar("wm_save_dir", "warmod", "Directory to store SourceTV demos and WarMod logs"); wm_save_dir = CreateConVar("wm_save_dir", "warmod", "Directory to store SourceTV demos and WarMod logs");
wm_prefix_logs = CreateConVar("wm_prefix_logs", "1", "Enable or disable the prefixing of \"_\" to uncompleted match SourceTV demos and WarMod logs", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_prefix_logs = CreateConVar("wm_prefix_logs", "1", "Enable or disable the prefixing of \"_\" to uncompleted match SourceTV demos and GGA logs", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_competition = CreateConVar("wm_competition", "WarMod BFG", "Name of host for a competition. eg. ESEA, Cybergamer, CEVO, ESL"); wm_competition = CreateConVar("wm_competition", "WarMod BFG", "Name of host for a competition. eg. ESEA, Cybergamer, CEVO, ESL");
wm_event = CreateConVar("wm_event", "scrim", "Name of event. eg. Season #, ODC #, Ladder"); wm_event = CreateConVar("wm_event", "scrim", "Name of event. eg. Season #, ODC #, Ladder");
/* SQL Settings */ /* SQL Settings */
wm_upload_results = CreateConVar("wm_upload_results", "0", "Enable or disable the uploading of match results via MySQL", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_upload_results = CreateConVar("wm_upload_results", "0", "Enable or disable the uploading of match results via MySQL", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_table_name = CreateConVar("wm_table_name", "wm_results", "The MySQL table name to store match results in"); wm_table_name = CreateConVar("wm_table_name", "wm_results", "The MySQL table name to store match results in");
//wm_table_name_players = CreateConVar("wm_table_name_players", "wm_players", "The MySQL table name to store match players in"); //wm_table_name_players = CreateConVar("wm_table_name_players", "wm_players", "The MySQL table name to store match players in");
wm_table_round_stats = CreateConVar("wm_table_round_stats", "wm_round_stats", "The MySQL table name to store round stats in"); wm_table_round_stats = CreateConVar("wm_table_round_stats", "wm_round_stats", "The MySQL table name to store round stats in");
/* Config Convars */ /* Config Convars */
wm_match_config = CreateConVar("wm_match_config", "warmod/ruleset_default.cfg", "Sets the match config to load on Live on 3"); wm_match_config = CreateConVar("wm_match_config", "warmod/ruleset_default.cfg", "Sets the match config to load on Live on 3");
wm_reset_config = CreateConVar("wm_reset_config", "warmod/on_match_end.cfg", "Sets the config to load at the end/reset of a match"); wm_reset_config = CreateConVar("wm_reset_config", "warmod/on_match_end.cfg", "Sets the config to load at the end/reset of a match");
wm_reset_config_delay = CreateConVar("wm_reset_config_delay", "1", "The amount of time before executing the reset config after a match", FCVAR_NOTIFY, true, 0.0); wm_reset_config_delay = CreateConVar("wm_reset_config_delay", "1", "The amount of time before executing the reset config after a match", FCVAR_NOTIFY, true, 0.0);
wm_prac_config = CreateConVar("wm_prac_config", "warmod/prac.cfg", "Sets the config to load up for practice"); wm_prac_config = CreateConVar("wm_prac_config", "warmod/prac.cfg", "Sets the config to load up for practice");
wm_playout_config = CreateConVar("wm_playout_config", "warmod/ruleset_playout.cfg", "Sets the play out match config to load on Live on 3"); wm_playout_config = CreateConVar("wm_playout_config", "warmod/ruleset_playout.cfg", "Sets the play out match config to load on Live on 3");
wm_overtime_config = CreateConVar("wm_overtime_config", "warmod/ruleset_overtime.cfg", "Sets the overtime match config to load on Live on 3"); wm_overtime_config = CreateConVar("wm_overtime_config", "warmod/ruleset_overtime.cfg", "Sets the overtime match config to load on Live on 3");
wm_default_config = CreateConVar("wm_default_config", "warmod/ruleset_default.cfg", "Sets the default match config to load on Live on 3"); wm_default_config = CreateConVar("wm_default_config", "warmod/ruleset_default.cfg", "Sets the default match config to load on Live on 3");
wm_knife_config = CreateConVar("wm_knife_config", "warmod/ruleset_knife.cfg", "Sets the knife config to load on Knife on 3"); wm_knife_config = CreateConVar("wm_knife_config", "warmod/ruleset_knife.cfg", "Sets the knife config to load on Knife on 3");
/* Warmup Convars */ /* Warmup Convars */
wm_warmup_config = CreateConVar("wm_warmup_config", "warmod/ruleset_warmup.cfg", "Sets the config to load up for warmup"); wm_warmup_config = CreateConVar("wm_warmup_config", "warmod/ruleset_warmup.cfg", "Sets the config to load up for warmup");
wm_block_warm_up_grenades = CreateConVar("wm_block_warm_up_grenades", "0", "Enable or disable grenade blocking in warmup", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_block_warm_up_grenades = CreateConVar("wm_block_warm_up_grenades", "0", "Enable or disable grenade blocking in warmup", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_warmup_respawn = CreateConVar("wm_warmup_respawn", "0", "Enable or disable the respawning of players in warmup", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_warmup_respawn = CreateConVar("wm_warmup_respawn", "0", "Enable or disable the respawning of players in warmup", FCVAR_NOTIFY, true, 0.0, true, 1.0);
/* Knife Convars */ /* Knife Convars */
wm_auto_knife = CreateConVar("wm_auto_knife", "0", "Enable or disable the knife round before going live", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_auto_knife = CreateConVar("wm_auto_knife", "0", "Enable or disable the knife round before going live", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_knife_auto_start = CreateConVar("wm_knife_auto_start", "0", "Enable or disable after knife round to be forced lived", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_knife_auto_start = CreateConVar("wm_knife_auto_start", "0", "Enable or disable after knife round to be forced lived", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_knife_hegrenade = CreateConVar("wm_knife_hegrenade", "0", "Enable or disable giving a player a hegrenade on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_knife_hegrenade = CreateConVar("wm_knife_hegrenade", "0", "Enable or disable giving a player a hegrenade on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_knife_flashbang = CreateConVar("wm_knife_flashbang", "0", "Sets how many flashbangs to give a player on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 2.0); wm_knife_flashbang = CreateConVar("wm_knife_flashbang", "0", "Sets how many flashbangs to give a player on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 2.0);
wm_knife_smokegrenade = CreateConVar("wm_knife_smokegrenade", "0", "Enable or disable giving a player a smokegrenade on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_knife_smokegrenade = CreateConVar("wm_knife_smokegrenade", "0", "Enable or disable giving a player a smokegrenade on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_knife_zeus = CreateConVar("wm_knife_zeus", "0", "Enable or disable giving a player a zeus on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_knife_zeus = CreateConVar("wm_knife_zeus", "0", "Enable or disable giving a player a zeus on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_knife_armor = CreateConVar("wm_knife_armor", "1", "Enable or disable giving a player Armor on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_knife_armor = CreateConVar("wm_knife_armor", "1", "Enable or disable giving a player Armor on Knife on 3", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_knife_helmet = CreateConVar("wm_knife_helmet", "0", "Enable or disable giving a player a Helmet on Knife on 3 [requires armor active]", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_knife_helmet = CreateConVar("wm_knife_helmet", "0", "Enable or disable giving a player a Helmet on Knife on 3 [requires armor active]", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_name_fix = CreateConVar("wm_name_fix", "0", "Fix name swap after knife round", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_name_fix = CreateConVar("wm_name_fix", "0", "Fix name swap after knife round", FCVAR_NOTIFY, true, 0.0, true, 1.0);
/* FTP Upload Convars */ /* FTP Upload Convars */
wm_autodemoupload_enable = CreateConVar("wm_autodemoupload_enable", "1", "Automatically upload demos when finished recording.", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_autodemoupload_enable = CreateConVar("wm_autodemoupload_enable", "1", "Automatically upload demos when finished recording.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_autodemoupload_bzip2 = CreateConVar("wm_autodemoupload_bzip2", "9", "Compression level. If set > 0 demos will be compressed before uploading. (Requires bzip2 extension.)", FCVAR_NOTIFY, true, 0.0, true, 9.0); wm_autodemoupload_bzip2 = CreateConVar("wm_autodemoupload_bzip2", "9", "Compression level. If set > 0 demos will be compressed before uploading. (Requires bzip2 extension.)", FCVAR_NOTIFY, true, 0.0, true, 9.0);
wm_autodemoupload_delete = CreateConVar("wm_autodemoupload_delete", "0", "Delete the demo (and the bz2) if upload was successful.", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_autodemoupload_delete = CreateConVar("wm_autodemoupload_delete", "0", "Delete the demo (and the bz2) if upload was successful.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_autodemoupload_ftptargetdemo = CreateConVar("wm_autodemoupload_ftptargetdemo", "demos", "The ftp target to use for demo uploads."); wm_autodemoupload_ftptargetdemo = CreateConVar("wm_autodemoupload_ftptargetdemo", "demos", "The ftp target to use for demo uploads.");
wm_autodemoupload_ftptargetlog = CreateConVar("wm_autodemoupload_ftptargetlog", "logs", "The ftp target to use for log uploads."); wm_autodemoupload_ftptargetlog = CreateConVar("wm_autodemoupload_ftptargetlog", "logs", "The ftp target to use for log uploads.");
wm_autodemoupload_completed = CreateConVar("wm_autodemoupload_completed", "1", "Only upload demos when match is completed.", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_autodemoupload_completed = CreateConVar("wm_autodemoupload_completed", "1", "Only upload demos when match is completed.", FCVAR_NOTIFY, true, 0.0, true, 1.0);
/* Pause Convars */ /* Pause Convars */
sv_pausable = FindConVar("sv_pausable"); sv_pausable = FindConVar("sv_pausable");
sv_matchpause_auto_5v5 = FindConVar("sv_matchpause_auto_5v5"); sv_matchpause_auto_5v5 = FindConVar("sv_matchpause_auto_5v5");
wm_auto_pause = CreateConVar("wm_auto_pause", "0", "Will pause server if team players equals less than half of wm_max_players: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_auto_pause = CreateConVar("wm_auto_pause", "0", "Will pause server if team players equals less than half of wm_max_players: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_pause_confirm = CreateConVar("wm_pause_confirm", "1", "Wait for other team to confirm pause: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_pause_confirm = CreateConVar("wm_pause_confirm", "1", "Wait for other team to confirm pause: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_unpause_confirm = CreateConVar("wm_unpause_confirm", "1", "Wait for other team to confirm unpause: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_unpause_confirm = CreateConVar("wm_unpause_confirm", "1", "Wait for other team to confirm unpause: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_auto_unpause = CreateConVar("wm_auto_unpause", "1", "Sets auto unpause: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_auto_unpause = CreateConVar("wm_auto_unpause", "1", "Sets auto unpause: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_auto_unpause_delay = CreateConVar("wm_auto_unpause_delay", "180", "Sets the seconds to wait before auto unpause", FCVAR_NOTIFY, true, 0.0); wm_auto_unpause_delay = CreateConVar("wm_auto_unpause_delay", "180", "Sets the seconds to wait before auto unpause", FCVAR_NOTIFY, true, 0.0);
wm_pause_limit = CreateConVar("wm_pause_limit", "1", "Sets max pause count per team per half", FCVAR_NOTIFY, true, 0.0); wm_pause_limit = CreateConVar("wm_pause_limit", "1", "Sets max pause count per team per half", FCVAR_NOTIFY, true, 0.0);
/* Veto Convars */ /* Veto Convars */
wm_pugsetup_maplist_file = CreateConVar("wm_pugsetup_maplist_file", "warmod/veto_maps_list.txt", "Veto Map List to read from", FCVAR_NOTIFY); wm_pugsetup_maplist_file = CreateConVar("wm_pugsetup_maplist_file", "warmod/veto_maps_list.txt", "Veto Map List to read from", FCVAR_NOTIFY);
wm_pugsetup_randomize_maps = CreateConVar("wm_pugsetup_randomize_maps", "1", "When maps are shown in the map vote/veto, should their order be randomized?", FCVAR_NOTIFY); wm_pugsetup_randomize_maps = CreateConVar("wm_pugsetup_randomize_maps", "1", "When maps are shown in the map vote/veto, should their order be randomized?", FCVAR_NOTIFY);
wm_veto = CreateConVar("wm_veto", "1", "Veto Style: 0 = off, 1 = Bo1, 2 = Bo2, 3 = Bo3, 5 = Bo5", FCVAR_NOTIFY, true, 0.0, true, 5.0); wm_veto = CreateConVar("wm_veto", "1", "Veto Style: 0 = off, 1 = Bo1, 2 = Bo2, 3 = Bo3, 5 = Bo5", FCVAR_NOTIFY, true, 0.0, true, 5.0);
wm_veto_knife = CreateConVar("wm_veto_knife", "1", "Requires a knife round to determine who votes first: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_veto_knife = CreateConVar("wm_veto_knife", "1", "Requires a knife round to determine who votes first: 0 = off, 1 = on", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_veto_bo3 = CreateConVar("wm_veto_bo3", "0", "Veto Style: 0 = Normal, 1 = New", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_veto_bo3 = CreateConVar("wm_veto_bo3", "0", "Veto Style: 0 = Normal, 1 = New", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_veto_random = CreateConVar("wm_veto_random", "0", "After the vetoing is done, will a map be picked at random?", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_veto_random = CreateConVar("wm_veto_random", "0", "After the vetoing is done, will a map be picked at random?", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_veto_select = CreateConVar("wm_veto_select", "1", "On last two maps of Veto Bo1 will it be select map to play: 0 = No, 1 = Yes", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_veto_select = CreateConVar("wm_veto_select", "1", "On last two maps of Veto Bo1 will it be select map to play: 0 = No, 1 = Yes", FCVAR_NOTIFY, true, 0.0, true, 1.0);
wm_captain_from_file = CreateConVar("wm_captain_from_file", "0", "Get team captains from file? 0 = No, 1 = Yes", FCVAR_NOTIFY, true, 0.0, true, 1.0); wm_captain_from_file = CreateConVar("wm_captain_from_file", "0", "Get team captains from file? 0 = No, 1 = Yes", FCVAR_NOTIFY, true, 0.0, true, 1.0);
/* Damage Printer */ /* Damage Printer */
wm_damageprint_auto_color = CreateConVar("wm_damageprint_auto_color", "1", "Whether colors are automatically inserted for damage values, changing depending on if the damage resulted in a kill"); wm_damageprint_auto_color = CreateConVar("wm_damageprint_auto_color", "1", "Whether colors are automatically inserted for damage values, changing depending on if the damage resulted in a kill");
wm_damageprint_enabled = CreateConVar("wm_damageprint_enabled", "0", "Whether to enabled damage print to client on round end"); wm_damageprint_enabled = CreateConVar("wm_damageprint_enabled", "0", "Whether to enabled damage print to client on round end");
wm_damageprint_format = CreateConVar("wm_damageprint_format", "--> ({DMG_TO} dmg / {HITS_TO} hits) to ({DMG_FROM} dmg / {HITS_FROM} hits) from {NAME} ({HEALTH} HP)", "Format of the damage output string. Avaliable tags are in the default, color tags such as {LIGHT_RED} and {GREEN} also work."); wm_damageprint_format = CreateConVar("wm_damageprint_format", "--> ({DMG_TO} dmg / {HITS_TO} hits) to ({DMG_FROM} dmg / {HITS_FROM} hits) from {NAME} ({HEALTH} HP)", "Format of the damage output string. Avaliable tags are in the default, color tags such as {LIGHT_RED} and {GREEN} also work.");
g_MapNames = CreateArray(PLATFORM_MAX_PATH); g_MapNames = CreateArray(PLATFORM_MAX_PATH);
g_iAccount = FindSendPropInfo("CCSPlayer", "m_iAccount"); g_iAccount = FindSendPropInfo("CCSPlayer", "m_iAccount");
hostname = FindConVar("hostname"); hostname = FindConVar("hostname");
mp_startmoney = FindConVar("mp_startmoney"); mp_startmoney = FindConVar("mp_startmoney");
mp_match_can_clinch = FindConVar("mp_match_can_clinch"); mp_match_can_clinch = FindConVar("mp_match_can_clinch");
mp_maxrounds = FindConVar("mp_maxrounds"); mp_maxrounds = FindConVar("mp_maxrounds");
mp_overtime_enable = FindConVar("mp_overtime_enable"); mp_overtime_enable = FindConVar("mp_overtime_enable");
mp_overtime_maxrounds = FindConVar("mp_overtime_maxrounds"); mp_overtime_maxrounds = FindConVar("mp_overtime_maxrounds");
mp_teamname_1 = FindConVar("mp_teamname_1"); mp_teamname_1 = FindConVar("mp_teamname_1");
mp_teamname_2 = FindConVar("mp_teamname_2"); mp_teamname_2 = FindConVar("mp_teamname_2");
mp_teamlogo_1 = FindConVar("mp_teamlogo_1"); mp_teamlogo_1 = FindConVar("mp_teamlogo_1");
mp_teamlogo_2 = FindConVar("mp_teamlogo_2"); mp_teamlogo_2 = FindConVar("mp_teamlogo_2");
mp_teamflag_1 = FindConVar("mp_teamflag_1"); mp_teamflag_1 = FindConVar("mp_teamflag_1");
mp_teamflag_2 = FindConVar("mp_teamflag_2"); mp_teamflag_2 = FindConVar("mp_teamflag_2");
tv_delaymapchange = FindConVar("tv_delaymapchange"); tv_delaymapchange = FindConVar("tv_delaymapchange");
tv_delay = FindConVar("tv_delay"); tv_delay = FindConVar("tv_delay");
mp_match_end_restart = FindConVar("mp_match_end_restart"); mp_match_end_restart = FindConVar("mp_match_end_restart");
HookConVarChange(wm_active, OnActiveChange); HookConVarChange(wm_active, OnActiveChange);
HookConVarChange(wm_min_ready, OnMinReadyChange); HookConVarChange(wm_min_ready, OnMinReadyChange);
HookConVarChange(wm_stats_trace, OnStatsTraceChange); HookConVarChange(wm_stats_trace, OnStatsTraceChange);
HookConVarChange(wm_stats_trace_delay, OnStatsTraceDelayChange); HookConVarChange(wm_stats_trace_delay, OnStatsTraceDelayChange);
HookConVarChange(wm_auto_ready, OnAutoReadyChange); HookConVarChange(wm_auto_ready, OnAutoReadyChange);
HookConVarChange(mp_teamname_2, OnTChange); HookConVarChange(mp_teamname_2, OnTChange);
HookConVarChange(mp_teamname_1, OnCTChange); HookConVarChange(mp_teamname_1, OnCTChange);
HookConVarChange(sv_matchpause_auto_5v5, Cvar_Changed); HookConVarChange(sv_matchpause_auto_5v5, Cvar_Changed);
HookConVarChange(wm_autodemoupload_ftptargetdemo, Cvar_Changed); HookConVarChange(wm_autodemoupload_ftptargetdemo, Cvar_Changed);
HookConVarChange(wm_autodemoupload_ftptargetlog, Cvar_Changed); HookConVarChange(wm_autodemoupload_ftptargetlog, Cvar_Changed);
HookConVarChange(wm_chat_prefix, Cvar_Changed); HookConVarChange(wm_chat_prefix, Cvar_Changed);
HookConVarChange(wm_competition, Cvar_Changed); HookConVarChange(wm_competition, Cvar_Changed);
HookConVarChange(wm_event, Cvar_Changed); HookConVarChange(wm_event, Cvar_Changed);
HookConVarChange(hostname, Cvar_Changed); HookConVarChange(hostname, Cvar_Changed);
HookConVarChange(FindConVar("mp_restartgame"), Event_Round_Restart); HookConVarChange(FindConVar("mp_restartgame"), Event_Round_Restart);
HookEvent("round_start", Event_Round_Start); HookEvent("round_start", Event_Round_Start);
HookEvent("round_end", Event_Round_End); HookEvent("round_end", Event_Round_End);
HookEvent("round_freeze_end", Event_Round_Freeze_End); HookEvent("round_freeze_end", Event_Round_Freeze_End);
HookEvent("player_blind", Event_Player_Blind); HookEvent("player_blind", Event_Player_Blind);
HookEvent("player_hurt", Event_Player_Hurt); HookEvent("player_hurt", Event_Player_Hurt);
HookEvent("player_death", Event_Player_Death); HookEvent("player_death", Event_Player_Death);
HookEvent("player_changename", Event_Player_Name); HookEvent("player_changename", Event_Player_Name);
HookEvent("player_disconnect", Event_Player_Disc_Pre, EventHookMode_Pre); HookEvent("player_disconnect", Event_Player_Disc_Pre, EventHookMode_Pre);
HookEvent("player_team", Event_Player_Team); HookEvent("player_team", Event_Player_Team);
HookEvent("player_team", Event_Player_Team_Post, EventHookMode_Post); HookEvent("player_team", Event_Player_Team_Post, EventHookMode_Post);
HookEvent("player_spawned", Event_Player_Spawned); HookEvent("player_spawned", Event_Player_Spawned);
HookEvent("bomb_pickup", Event_Bomb_PickUp); HookEvent("bomb_pickup", Event_Bomb_PickUp);
HookEvent("bomb_dropped", Event_Bomb_Dropped); HookEvent("bomb_dropped", Event_Bomb_Dropped);
HookEvent("bomb_beginplant", Event_Bomb_Plant_Begin); HookEvent("bomb_beginplant", Event_Bomb_Plant_Begin);
HookEvent("bomb_abortplant", Event_Bomb_Plant_Abort); HookEvent("bomb_abortplant", Event_Bomb_Plant_Abort);
HookEvent("bomb_planted", Event_Bomb_Planted); HookEvent("bomb_planted", Event_Bomb_Planted);
HookEvent("bomb_begindefuse", Event_Bomb_Defuse_Begin); HookEvent("bomb_begindefuse", Event_Bomb_Defuse_Begin);
HookEvent("bomb_abortdefuse", Event_Bomb_Defuse_Abort); HookEvent("bomb_abortdefuse", Event_Bomb_Defuse_Abort);
HookEvent("bomb_defused", Event_Bomb_Defused); HookEvent("bomb_defused", Event_Bomb_Defused);
HookEvent("weapon_fire", Event_Weapon_Fire); HookEvent("weapon_fire", Event_Weapon_Fire);
HookEvent("flashbang_detonate", Event_Detonate_Flash); HookEvent("flashbang_detonate", Event_Detonate_Flash);
HookEvent("smokegrenade_detonate", Event_Detonate_Smoke); HookEvent("smokegrenade_detonate", Event_Detonate_Smoke);
HookEvent("hegrenade_detonate", Event_Detonate_HeGrenade); HookEvent("hegrenade_detonate", Event_Detonate_HeGrenade);
HookEvent("molotov_detonate", Event_Detonate_Molotov); HookEvent("molotov_detonate", Event_Detonate_Molotov);
HookEvent("decoy_detonate", Event_Detonate_Decoy); HookEvent("decoy_detonate", Event_Detonate_Decoy);
HookEvent("item_pickup", Event_Item_Pickup); HookEvent("item_pickup", Event_Item_Pickup);
CreateTimer(15.0, HelpText, 0, TIMER_REPEAT); CreateTimer(15.0, HelpText, 0, TIMER_REPEAT);
}}
public void OnLibraryAdded(const char[]name)public void OnLibraryAdded(const char[]name)
{{
if (StrEqual(name, "updater")) if (StrEqual(name, "updater"))
{ {
Updater_AddPlugin(UPDATE_URL); Updater_AddPlugin(UPDATE_URL);
} }
}}
public void OnConfigsExecuted()public void OnConfigsExecuted()
{{
GetConVarString(wm_chat_prefix, CHAT_PREFIX, sizeof(CHAT_PREFIX)); GetConVarString(wm_chat_prefix, (CHAT_PREFIX),sizeof(CHAT_PREFIX));
GetConVarString(wm_event, g_event, sizeof(g_event)); GetConVarString(wm_event, g_event, sizeof(g_event));
GetConVarString(wm_competition, g_competition, sizeof(g_competition)); GetConVarString(wm_competition, g_competition, sizeof(g_competition));
GetConVarString(hostname, g_server, sizeof(g_server)); GetConVarString(hostname, g_server, sizeof(g_server));
GetConVarString(wm_autodemoupload_ftptargetdemo, g_sFtpTargetDemo, sizeof(g_sFtpTargetDemo)); GetConVarString(wm_autodemoupload_ftptargetdemo, g_sFtpTargetDemo, sizeof(g_sFtpTargetDemo));
GetConVarString(wm_autodemoupload_ftptargetlog, g_sFtpTargetLog, sizeof(g_sFtpTargetLog)); GetConVarString(wm_autodemoupload_ftptargetlog, g_sFtpTargetLog, sizeof(g_sFtpTargetLog));
if (GetConVarBool(sv_matchpause_auto_5v5)) if (GetConVarBool(sv_matchpause_auto_5v5))
{ {
ServerCommand("wm_auto_pause 1"); ServerCommand("wm_auto_pause 1");
ServerCommand("sv_matchpause_auto_5v5 0"); ServerCommand("sv_matchpause_auto_5v5 0");
} }
}}
public void OnMapStart()public void OnMapStart()
{{
g_map_loaded++; g_map_loaded++;
ServerCommand("exec warmod/on_map_load.cfg"); ServerCommand("exec warmod/on_map_load.cfg");
AddTeamLogosToDownloadTable(); AddTeamLogosToDownloadTable();
char g_MapName[64]; char g_MapName[64];
char g_WorkShopID[64]; char g_WorkShopID[64];
char g_CurMap[128]; char g_CurMap[128];
GetCurrentMap(g_CurMap, sizeof(g_CurMap)); GetCurrentMap(g_CurMap, sizeof(g_CurMap));
if (StrContains(g_CurMap, "workshop", false) != -1) if (StrContains(g_CurMap, "workshop", false) != -1)
{ {
GetCurrentWorkshopMap(g_MapName, sizeof(g_MapName), g_WorkShopID, sizeof(g_WorkShopID)); GetCurrentWorkshopMap(g_MapName, sizeof(g_MapName), g_WorkShopID, sizeof(g_WorkShopID));
LogMessage("Current Map: %s, Workshop ID: %s, Warmod Version: %s", g_MapName, g_WorkShopID, WM_VERSION); LogMessage("Current Map: %s, Workshop ID: %s, Warmod Version: %s", g_MapName, g_WorkShopID, WM_VERSION);
} }
else else
{ {
strcopy(g_map, sizeof(g_map), g_CurMap); strcopy(g_map, sizeof(g_map), g_CurMap);
LogMessage("Current Map: %s, Warmod Version: %s", g_CurMap, WM_VERSION); LogMessage("Current Map: %s, Warmod Version: %s", g_CurMap, WM_VERSION);
} }
StringToLower(g_map, sizeof(g_map)); StringToLower(g_map, sizeof(g_map));
if (!GetConVarBool(mp_match_end_restart) && ((g_veto_bo3_active && g_veto_map_number < 3) || (g_veto_bo5_active && g_veto_map_number < 5) || (g_veto_bo2_active && g_veto_map_number < 2))) if (!GetConVarBool(mp_match_end_restart) && ((g_veto_bo3_active && g_veto_map_number < 3) || (g_veto_bo5_active && g_veto_map_number < 5) || (g_veto_bo2_active && g_veto_map_number < 2)))
{ {
if (g_veto_bo3_active) if (g_veto_bo3_active)
{ {
g_ChosenMap = g_ChosenMapBo3[g_veto_map_number]; g_ChosenMap = g_ChosenMapBo3[g_veto_map_number];
} }
else if (g_veto_bo5_active) else if (g_veto_bo5_active)
{ {
g_ChosenMap = g_ChosenMapBo5[g_veto_map_number]; g_ChosenMap = g_ChosenMapBo5[g_veto_map_number];
} }
else else
{ {
g_ChosenMap = g_ChosenMapBo2[g_veto_map_number]; g_ChosenMap = g_ChosenMapBo2[g_veto_map_number];
} }
g_veto_map_number++; g_veto_map_number++;
char map[PLATFORM_MAX_PATH]; char map[PLATFORM_MAX_PATH];
GetArrayString(g_MapNames, g_ChosenMap, map, sizeof(map)); GetArrayString(g_MapNames, g_ChosenMap, map, sizeof(map));
ServerCommand("nextlevel %s", map); ServerCommand("nextlevel %s", map);
} }
if (GetConVarBool(wm_stats_trace)) if (GetConVarBool(wm_stats_trace))
{ {
// start trace timer // start trace timer
g_stats_trace_timer = CreateTimer(GetConVarFloat(wm_stats_trace_delay), Stats_Trace, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE); g_stats_trace_timer = CreateTimer(GetConVarFloat(wm_stats_trace_delay), Stats_Trace, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
} }
if (hDatabase == INVALID_HANDLE) { if (hDatabase == INVALID_HANDLE) {
StartSQL(0); StartSQL(0);
} }
// reset any matches // reset any matches
ResetMatch(true, false); ResetMatch(true, false);
g_bRecording = false; g_bRecording = false;
// Veto // Veto
g_MapVetoed = CreateArray(); g_MapVetoed = CreateArray();
g_veto_s = false; g_veto_s = false;
g_veto_number = 0; g_veto_number = 0;
g_t_knife = false; g_t_knife = false;
}}
public void OnMapEnd()public void OnMapEnd()
{{
CloseHandle(g_MapVetoed); CloseHandle(g_MapVetoed);
}}
public void OnLibraryRemoved(const char[]name)public void OnLibraryRemoved(const char[]name)
{{
if (StrEqual(name, "adminmenu")) if (StrEqual(name, "adminmenu"))
{ {
g_h_menu = INVALID_HANDLE; g_h_menu = INVALID_HANDLE;
} }
}}
public void OnAdminMenuReady(Handle topmenu)public void OnAdminMenuReady(Handle topmenu)
{{
if (topmenu == g_h_menu) if (topmenu == g_h_menu)
{ {
return; return;
} }
g_h_menu = topmenu; g_h_menu = topmenu;
TopMenuObject new_menu = AddToTopMenu(g_h_menu, "WarModCommands", TopMenuObject_Category, MenuHandler, INVALID_TOPMENUOBJECT); TopMenuObject new_menu = AddToTopMenu(g_h_menu, "WarModCommands", TopMenuObject_Category, MenuHandler, INVALID_TOPMENUOBJECT);
if (new_menu == INVALID_TOPMENUOBJECT) if (new_menu == INVALID_TOPMENUOBJECT)
{ {
return; return;
} }
// add menu items // add menu items
AddToTopMenu(g_h_menu, "forcestart", TopMenuObject_Item, MenuHandler, new_menu, "forcestart", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "forcestart", TopMenuObject_Item, MenuHandler, new_menu, "forcestart", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "readyup", TopMenuObject_Item, MenuHandler, new_menu, "readyup", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "readyup", TopMenuObject_Item, MenuHandler, new_menu, "readyup", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "knife", TopMenuObject_Item, MenuHandler, new_menu, "knife", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "knife", TopMenuObject_Item, MenuHandler, new_menu, "knife", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "cancelhalf", TopMenuObject_Item, MenuHandler, new_menu, "cancelhalf", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "cancelhalf", TopMenuObject_Item, MenuHandler, new_menu, "cancelhalf", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "cancelmatch", TopMenuObject_Item, MenuHandler, new_menu, "cancelmatch", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "cancelmatch", TopMenuObject_Item, MenuHandler, new_menu, "cancelmatch", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "forceallready", TopMenuObject_Item, MenuHandler, new_menu, "forceallready", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "forceallready", TopMenuObject_Item, MenuHandler, new_menu, "forceallready", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "forceallunready", TopMenuObject_Item, MenuHandler, new_menu, "forceallunready", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "forceallunready", TopMenuObject_Item, MenuHandler, new_menu, "forceallunready", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "forceallspectate", TopMenuObject_Item, MenuHandler, new_menu, "forceallspectate", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "forceallspectate", TopMenuObject_Item, MenuHandler, new_menu, "forceallspectate", ADMFLAG_CUSTOM1);
AddToTopMenu(g_h_menu, "toggleactive", TopMenuObject_Item, MenuHandler, new_menu, "toggleactive", ADMFLAG_CUSTOM1); AddToTopMenu(g_h_menu, "toggleactive", TopMenuObject_Item, MenuHandler, new_menu, "toggleactive", ADMFLAG_CUSTOM1);
}}
public Action UpdateCFGs(int client, int args)public Action UpdateCFGs(int client, int args)
{{
Update_Configs(WM_VERSION); Update_Configs(WM_VERSION);
return Plugin_Handled; return Plugin_Handled;
}}
public void OnClientPostAdminCheck(int client)public void OnClientPostAdminCheck(int client)
{{
if (client == 0) if (client == 0)
{ {
return; return;
} }
char ip_address[32]; char ip_address[32];
GetClientIP(client, ip_address, sizeof(ip_address)); GetClientIP(client, ip_address, sizeof(ip_address));
IsFakeClient(client); IsFakeClient(client);
if (!IsActive(0, true)) if (!IsActive(0, true))
{ {
// warmod is disabled // warmod is disabled
return; return;
} }
if (GetConVarBool(wm_stats_enabled) && client != 0) if (GetConVarBool(wm_stats_enabled) && client != 0)
{ {
char log_string[384]; char log_string[384];
CS_GetLogString(client, log_string, sizeof(log_string)); CS_GetLogString(client, log_string, sizeof(log_string));
char country[4]; char country[4];
GeoipCode2(ip_address, country); GeoipCode2(ip_address, country);
EscapeString(ip_address, sizeof(ip_address)); EscapeString(ip_address, sizeof(ip_address));
LogEvent("{\"event\": \"player_connect\", \"player\": %s, \"address\": \"%s\", \"country\": \"%s\"}", log_string, ip_address, country); LogEvent("{\"event\": \"player_connect\", \"player\": %s, \"address\": \"%s\", \"country\": \"%s\"}", log_string, ip_address, country);
} }
}}
public void OnClientPutInServer(int client)public void OnClientPutInServer(int client)
{{
// reset client state // reset client state
g_player_list[client] = PLAYER_DISC; g_player_list[client] = PLAYER_DISC;
g_cancel_list[client] = false; g_cancel_list[client] = false;
g_disconnect[client] = false; g_disconnect[client] = false;
g_clanTagsChecked[client] = false; g_clanTagsChecked[client] = false;
//int count = CS_GetPlayerListCount(); //int count = CS_GetPlayerListCount();
//if (count == 0) { //if (count == 0) {
// checksafe(client); // checksafe(client);
//} //}
}}
public void OnClientDisconnect(int client)public void OnClientDisconnect(int client)
{{
// reset client state // reset client state
g_player_list[client] = PLAYER_DISC; g_player_list[client] = PLAYER_DISC;
g_cancel_list[client] = false; g_cancel_list[client] = false;
g_clanTagsChecked[client] = false; g_clanTagsChecked[client] = false;
// log player stats // log player stats
if (g_live && GameRules_GetProp("m_bFreezePeriod") == 0 && (GetTTotalScore() + GetCTTotalScore()) != 0) { if (g_live && GameRules_GetProp("m_bFreezePeriod") == 0 && (GetTTotalScore() + GetCTTotalScore()) != 0) {
LogPlayerStats(client); LogPlayerStats(client);
} }
if (!IsActive(client, true)) if (!IsActive(client, true))
{ {
// warmod is disabled // warmod is disabled
return; return;
} }
if (g_ready_enabled && !g_live) if (g_ready_enabled && !g_live)
{ {
// display ready system // display ready system
ShowInfo(client, true, false, 0); ShowInfo(client, true, false, 0);
} }
if ((g_match) && GetConVarBool(wm_auto_pause)) if ((g_match) && GetConVarBool(wm_auto_pause))
{ {
AutoPause(); AutoPause();
} }
if ((g_match || g_t_knife) && GetConVarBool(wm_ban_on_disconnect) && g_disconnect[client] == true) if ((g_match || g_t_knife) && GetConVarBool(wm_ban_on_disconnect) && g_disconnect[client] == true)
{ {
int count = CS_GetPlayerListCount(); int count = CS_GetPlayerListCount();
float percent = GetConVarFloat(wm_ban_percentage); float percent = GetConVarFloat(wm_ban_percentage);
if (count > (GetConVarInt(wm_max_players) * percent)) if (count > (GetConVarInt(wm_max_players) * percent))
{ {
char reason[32] = "Disconnected from live match"; char reason[32] = "Disconnected from live match";
char authid[32]; char authid[32];
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid)); GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
ServerCommand("sm_addban %i %s %s", GetConVarInt(sv_kick_ban_duration), authid, reason); ServerCommand("sm_addban %i %s %s", GetConVarInt(sv_kick_ban_duration), authid, reason);
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Banned player reason", authid, GetConVarInt(sv_kick_ban_duration), reason); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %t", "CHAT_PREFIX", "Banned player reason", authid, GetConVarInt(sv_kick_ban_duration), reason);
g_disconnect[client] = false; g_disconnect[client] = false;
} }
} }
}}
void ResetMatch(bool silent, bool complete) {void ResetMatch(bool silent, bool complete) {
if (g_match) { if (g_match) {
Call_StartForward(g_f_on_reset_match); Call_StartForward(g_f_on_reset_match);
Call_Finish(); Call_Finish();
if (GetConVarBool(wm_stats_enabled)) { if (GetConVarBool(wm_stats_enabled)) {
char event_name[] = "match_reset"; char event_name[] = "match_reset";
LogSimpleEvent(event_name, sizeof(event_name)); LogSimpleEvent(event_name, sizeof(event_name));
} }
// end of log // end of log
char event_name[] = "log_end"; char event_name[] = "log_end";
LogSimpleEvent(event_name, sizeof(event_name)); LogSimpleEvent(event_name, sizeof(event_name));
} }
if (!complete) { if (!complete) {
//stop demo from uploading //stop demo from uploading
g_MatchComplete = false; g_MatchComplete = false;
} }
if (g_match) { if (g_match) {
// execute relevant server config // execute relevant server config
CreateTimer(GetConVarFloat(wm_reset_config_delay), Timer_DelayedResetConfig); CreateTimer(GetConVarFloat(wm_reset_config_delay), Timer_DelayedResetConfig);
} }
if (g_log_file != INVALID_HANDLE) { if (g_log_file != INVALID_HANDLE) {
// close log file // close log file
FlushFile(g_log_file); FlushFile(g_log_file);
CloseHandle(g_log_file); CloseHandle(g_log_file);
g_log_file = INVALID_HANDLE; g_log_file = INVALID_HANDLE;
} }
if (g_log_veto_file != INVALID_HANDLE) { if (g_log_veto_file != INVALID_HANDLE) {
// close log file // close log file
FlushFile(g_log_veto_file); FlushFile(g_log_veto_file);
CloseHandle(g_log_veto_file); CloseHandle(g_log_veto_file);
g_log_veto_file = INVALID_HANDLE; g_log_veto_file = INVALID_HANDLE;
} }
// reset state // reset state
g_start = false; g_start = false;
g_match = false; g_match = false;
g_max_lock = false; g_max_lock = false;
g_live = false; g_live = false;
g_log_live = false; g_log_live = false;
g_half_swap = true; g_half_swap = true;
g_first_half = true; g_first_half = true;
g_second_half_first = false; g_second_half_first = false;
g_t_money = false; g_t_money = false;
g_t_score = false; g_t_score = false;
g_t_knife = false; g_t_knife = false;
g_t_had_knife = false; g_t_had_knife = false;
g_tag_set = false; g_tag_set = false;
g_setNameLimiter = true; g_setNameLimiter = true;
g_DispInfoLimiter = true; g_DispInfoLimiter = true;
SetAllCancelled(false); SetAllCancelled(false);
ReadyChangeAll(0, false, true); ReadyChangeAll(0, false, true);
ResetMatchScores(); ResetMatchScores();
if (!g_first_load && g_map_loaded > 2) { if (!g_first_load && g_map_loaded > 2) {
ResetTeams(); ResetTeams();
} }
g_first_load = false; g_first_load = false;
g_overtime = false; g_overtime = false;
g_overtime_count = 0; g_overtime_count = 0;
g_t_pause_count = 0; g_t_pause_count = 0;
g_ct_pause_count = 0; g_ct_pause_count = 0;
g_round = 1; g_round = 1;
LiveOn2 = false; LiveOn2 = false;
LiveOn1 = false; LiveOn1 = false;
LiveOn3Text = false; LiveOn3Text = false;
KnifeOn2 = false; KnifeOn2 = false;
KnifeOn1 = false; KnifeOn1 = false;
KnifeOn3Text = false; KnifeOn3Text = false;
g_t_veto = false; g_t_veto = false;
veto_offer_ct = false; veto_offer_ct = false;
veto_offer_t = false; veto_offer_t = false;
g_veto_active = false; g_veto_active = false;
default_offer_ct = false; default_offer_ct = false;
default_offer_t = false; default_offer_t = false;
overtime_offer_ct = false; overtime_offer_ct = false;
overtime_offer_t = false; overtime_offer_t = false;
playout_offer_ct = false; playout_offer_ct = false;
playout_offer_t = false; playout_offer_t = false;
team_switch = false; team_switch = false;
g_auto_pause = false; g_auto_pause = false;
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
if (g_h_stored_timer != INVALID_HANDLE) if (g_h_stored_timer != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer); KillTimer(g_h_stored_timer);
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
} }
if (g_h_stored_timer_p != INVALID_HANDLE) if (g_h_stored_timer_p != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_p); KillTimer(g_h_stored_timer_p);
g_h_stored_timer_p = INVALID_HANDLE; g_h_stored_timer_p = INVALID_HANDLE;
} }
if (g_h_stored_timer_pl != INVALID_HANDLE) if (g_h_stored_timer_pl != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_pl); KillTimer(g_h_stored_timer_pl);
g_h_stored_timer_pl = INVALID_HANDLE; g_h_stored_timer_pl = INVALID_HANDLE;
} }
if (g_h_stored_timer_ot != INVALID_HANDLE) if (g_h_stored_timer_ot != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_ot); KillTimer(g_h_stored_timer_ot);
g_h_stored_timer_ot = INVALID_HANDLE; g_h_stored_timer_ot = INVALID_HANDLE;
} }
if (g_h_stored_timer_def != INVALID_HANDLE) if (g_h_stored_timer_def != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_def); KillTimer(g_h_stored_timer_def);
g_h_stored_timer_def = INVALID_HANDLE; g_h_stored_timer_def = INVALID_HANDLE;
} }
UpdateStatus(); UpdateStatus();
// stop tv recording after 5 seconds // stop tv recording after 5 seconds
CreateTimer(5.0, StopRecord); CreateTimer(5.0, StopRecord);
CreateTimer(5.0, LogFileUpload); CreateTimer(5.0, LogFileUpload);
// CreateTimer(10.0, SQL_Player_Info_Clear);// CreateTimer(10.0, SQL_Player_Info_Clear);
if (GetConVarBool(wm_auto_ready)) if (GetConVarBool(wm_auto_ready))
{ {
// enable ready system // enable ready system
ReadySystem(true); ReadySystem(true);
ShowInfo(0, true, false, 0); ShowInfo(0, true, false, 0);
// update status code // update status code
UpdateStatus(); UpdateStatus();
} }
else if (g_ready_enabled) else if (g_ready_enabled)
{ {
// disable ready system // disable ready system
ReadySystem(false); ReadySystem(false);
ShowInfo(0, false, false, 1); ShowInfo(0, false, false, 1);
} }
if (!silent) if (!silent)
{ {
// message display to players // message display to players
for (int x = 1; x <= 3; x++) for (int x = 1; x <= 3; x++)
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Match Reset"); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %t", "CHAT_PREFIX", "Match Reset");
} }
// restart round // restart round
ServerCommand("mp_restartgame 1"); ServerCommand("mp_restartgame 1");
} }
}}
void ResetHalf(bool silent)void ResetHalf(bool silent)
{{
if (g_match) if (g_match)
{ {
Call_StartForward(g_f_on_reset_half); Call_StartForward(g_f_on_reset_half);
Call_Finish(); Call_Finish();
if (GetConVarBool(wm_stats_enabled)) if (GetConVarBool(wm_stats_enabled))
{ {
char event_name[] = "match_half_reset"; char event_name[] = "match_half_reset";
LogSimpleEvent(event_name, sizeof(event_name)); LogSimpleEvent(event_name, sizeof(event_name));
} }
} }
if (!g_first_half) if (!g_first_half)
{ {
g_half_swap = true; g_half_swap = true;
} }
// reset half state // reset half state
g_live = false; g_live = false;
g_t_money = false; g_t_money = false;
g_t_score = false; g_t_score = false;
g_t_knife = false; g_t_knife = false;
SetAllCancelled(false); SetAllCancelled(false);
ReadyChangeAll(0, false, true); ReadyChangeAll(0, false, true);
ResetHalfScores(); ResetHalfScores();
UpdateStatus(); UpdateStatus();
g_t_pause_count = 0; g_t_pause_count = 0;
g_ct_pause_count = 0; g_ct_pause_count = 0;
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
if (g_h_stored_timer != INVALID_HANDLE) if (g_h_stored_timer != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer); KillTimer(g_h_stored_timer);
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
} }
if (g_h_stored_timer_p != INVALID_HANDLE) if (g_h_stored_timer_p != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_p); KillTimer(g_h_stored_timer_p);
g_h_stored_timer_p = INVALID_HANDLE; g_h_stored_timer_p = INVALID_HANDLE;
} }
if (GetConVarBool(wm_auto_ready)) if (GetConVarBool(wm_auto_ready))
{ {
// display ready system // display ready system
ReadySystem(true); ReadySystem(true);
ShowInfo(0, true, false, 0); ShowInfo(0, true, false, 0);
UpdateStatus(); UpdateStatus();
} }
else else
{ {
// disable ready system // disable ready system
ReadySystem(false); ReadySystem(false);
ShowInfo(0, false, false, 1); ShowInfo(0, false, false, 1);
} }
if (!silent) if (!silent)
{ {
// display message for players // display message for players
for (int x = 1; x <= 3; x++) for (int x = 1; x <= 3; x++)
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Half Reset"); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %t", "CHAT_PREFIX", "Half Reset");
} }
// restart round // restart round
ServerCommand("mp_restartgame 1"); ServerCommand("mp_restartgame 1");
} }
}}
void ResetTeams()void ResetTeams()
{{
// set team names to default // set team names to default
Format(g_t_name, sizeof(g_t_name), DEFAULT_T_NAME); Format(g_t_name, sizeof(g_t_name), DEFAULT_T_NAME);
Format(g_t_name_escaped, sizeof(g_t_name_escaped), g_t_name); Format(g_t_name_escaped, sizeof(g_t_name_escaped), g_t_name);
EscapeString(g_t_name_escaped, sizeof(g_t_name_escaped)); EscapeString(g_t_name_escaped, sizeof(g_t_name_escaped));
Format(g_ct_name, sizeof(g_ct_name), DEFAULT_CT_NAME); Format(g_ct_name, sizeof(g_ct_name), DEFAULT_CT_NAME);
Format(g_ct_name_escaped, sizeof(g_ct_name_escaped), g_ct_name); Format(g_ct_name_escaped, sizeof(g_ct_name_escaped), g_ct_name);
EscapeString(g_ct_name_escaped, sizeof(g_ct_name_escaped)); EscapeString(g_ct_name_escaped, sizeof(g_ct_name_escaped));
ServerCommand("mp_teamname_2 %s", g_t_name); ServerCommand("mp_teamname_2 %s", g_t_name);
ServerCommand("mp_teamname_1 %s", g_ct_name); ServerCommand("mp_teamname_1 %s", g_ct_name);
}}
void ResetMatchScores()void ResetMatchScores()
{{
// reset match scores // reset match scores
g_scores[SCORE_T][SCORE_FIRST_HALF] = 0; g_scores[SCORE_T][SCORE_FIRST_HALF] = 0;
g_scores[SCORE_T][SCORE_SECOND_HALF] = 0; g_scores[SCORE_T][SCORE_SECOND_HALF] = 0;
g_scores[SCORE_CT][SCORE_FIRST_HALF] = 0; g_scores[SCORE_CT][SCORE_FIRST_HALF] = 0;
g_scores[SCORE_CT][SCORE_SECOND_HALF] = 0; g_scores[SCORE_CT][SCORE_SECOND_HALF] = 0;
// reset overtime scores // reset overtime scores
for (int i = 0; i <= g_overtime_count; i++) for (int i = 0; i <= g_overtime_count; i++)
{ {
g_scores_overtime[SCORE_T][i][SCORE_FIRST_HALF] = 0; g_scores_overtime[SCORE_T][i][SCORE_FIRST_HALF] = 0;
g_scores_overtime[SCORE_T][i][SCORE_SECOND_HALF] = 0; g_scores_overtime[SCORE_T][i][SCORE_SECOND_HALF] = 0;
g_scores_overtime[SCORE_CT][i][SCORE_FIRST_HALF] = 0; g_scores_overtime[SCORE_CT][i][SCORE_FIRST_HALF] = 0;
g_scores_overtime[SCORE_CT][i][SCORE_SECOND_HALF] = 0; g_scores_overtime[SCORE_CT][i][SCORE_SECOND_HALF] = 0;
} }
}}
void ResetHalfScores()void ResetHalfScores()
{{
// reset scores for the current half // reset scores for the current half
if (!g_overtime) if (!g_overtime)
{ {
// not overtime // not overtime
if (g_first_half) if (g_first_half)
{ {
// first half // first half
g_scores[SCORE_T][SCORE_FIRST_HALF] = 0; g_scores[SCORE_T][SCORE_FIRST_HALF] = 0;
g_scores[SCORE_CT][SCORE_FIRST_HALF] = 0; g_scores[SCORE_CT][SCORE_FIRST_HALF] = 0;
} }
else else
{ {
// second half // second half
g_scores[SCORE_T][SCORE_SECOND_HALF] = 0; g_scores[SCORE_T][SCORE_SECOND_HALF] = 0;
g_scores[SCORE_CT][SCORE_SECOND_HALF] = 0; g_scores[SCORE_CT][SCORE_SECOND_HALF] = 0;
} }
} }
else else
{ {
// overtime // overtime
if (g_first_half) if (g_first_half)
{ {
// first half overtime // first half overtime
g_scores_overtime[SCORE_T][g_overtime_count][SCORE_FIRST_HALF] = 0; g_scores_overtime[SCORE_T][g_overtime_count][SCORE_FIRST_HALF] = 0;
g_scores_overtime[SCORE_CT][g_overtime_count][SCORE_FIRST_HALF] = 0; g_scores_overtime[SCORE_CT][g_overtime_count][SCORE_FIRST_HALF] = 0;
} }
else else
{ {
// second half overtime // second half overtime
g_scores_overtime[SCORE_T][g_overtime_count][SCORE_SECOND_HALF] = 0; g_scores_overtime[SCORE_T][g_overtime_count][SCORE_SECOND_HALF] = 0;
g_scores_overtime[SCORE_CT][g_overtime_count][SCORE_SECOND_HALF] = 0; g_scores_overtime[SCORE_CT][g_overtime_count][SCORE_SECOND_HALF] = 0;
} }
} }
}}
public Action ReadyToggle(int client, int args)public Action ReadyToggle(int client, int args)
{{
if (!IsActive(client, false)) if (!IsActive(client, false))
{ {
// warmod is disabled // warmod is disabled
return Plugin_Handled; return Plugin_Handled;
} }
if (!IsAdminCmd(client, false)) if (!IsAdminCmd(client, false))
{ {
// not allowed, rcon only // not allowed, rcon only
return Plugin_Handled; return Plugin_Handled;
} }
if (IsLive(client, false)) if (IsLive(client, false))
{ {
// match is live // match is live
return Plugin_Handled; return Plugin_Handled;
} }
// change ready state // change ready state
ReadyChangeAll(client, false, true); ReadyChangeAll(client, false, true);
SetAllCancelled(false); SetAllCancelled(false);
if (!IsReadyEnabled(client, true)) if (!IsReadyEnabled(client, true))
{ {
// display ready system // display ready system
ReadySystem(true); ReadySystem(true);
ShowInfo(client, true, false, 0); ShowInfo(client, true, false, 0);
if (client != 0) if (client != 0)
{ {
PrintToConsole(client, "[%s] %t", CHAT_PREFIX, "Ready System Enabled"); PrintToConsole(client, "[%s] %t", "CHAT_PREFIX", "GOOD GAME ARENA READY");
} }
else else
{ {
PrintToServer("[%s] %T", CHAT_PREFIX, "Ready System Enabled", LANG_SERVER); PrintToServer("[%s] %T", "CHAT_PREFIX", "GOOD GAME ARENA ON", LANG_SERVER);
} }
// check if anyone is ready // check if anyone is ready
CheckReady(); CheckReady();
} }
else else
{ {
// disable ready system // disable ready system
ShowInfo(client, false, false, 1); ShowInfo(client, false, false, 1);
ReadySystem(false); ReadySystem(false);
if (client != 0) if (client != 0)
{ {
PrintToConsole(client, "[%s] %t", CHAT_PREFIX, "Ready System Disabled"); PrintToConsole(client, "[%s] %t", "CHAT_PREFIX", "Ready System Disabled");
} }
else else
{ {
PrintToServer("[%s] %T", CHAT_PREFIX, "Ready System Disabled", LANG_SERVER); PrintToServer("[%s] %T", "CHAT_PREFIX", "Ready System Disabled", LANG_SERVER);
} }
} }
LogAction(client, -1, "\"ready_toggle\" (player \"%L\")", client); LogAction(client, -1, "\"ready_toggle\" (player \"%L\")", client);
return Plugin_Handled; return Plugin_Handled;
}}
public Action ActiveToggle(int client, int args)public Action ActiveToggle(int client, int args)
{{
if (!IsAdminCmd(client, false)) if (!IsAdminCmd(client, false))
{ {
// not allowed, rcon only // not allowed, rcon only
return Plugin_Handled; return Plugin_Handled;
} }
if (GetConVarBool(wm_active)) if (GetConVarBool(wm_active))
{ {
// disable warmod // disable warmod
SetConVarBool(wm_active, false); SetConVarBool(wm_active, false);
if (client != 0) if (client != 0)
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Set Inactive"); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %t", "CHAT_PREFIX", "Set Inactive");
} }
else else
{ {
PrintToServer("[%s] %T", CHAT_PREFIX, "Set Inactive", LANG_SERVER); PrintToServer("[%s] %T", "CHAT_PREFIX", "Set Inactive", LANG_SERVER);
} }
} }
else else
{ {
// enable warmod // enable warmod
SetConVarBool(wm_active, true); SetConVarBool(wm_active, true);
if (client != 0) if (client != 0)
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %t", CHAT_PREFIX, "Set Active"); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %t", "CHAT_PREFIX", "Set Active");
} }
else else
{ {
PrintToServer("[%s] %T", CHAT_PREFIX, "Set Active", LANG_SERVER); PrintToServer("[%s] %T", "CHAT_PREFIX", "Set Active", LANG_SERVER);
} }
} }
LogAction(client, -1, "\"active_toggle\" (player \"%L\")", client); LogAction(client, -1, "\"active_toggle\" (player \"%L\")", client);
return Plugin_Handled; return Plugin_Handled;
}}
//Pause and Unpause Commands + timers//Pause and Unpause Commands + timers
static void AutoPause()static void AutoPause()
{{
if (g_match && !g_auto_pause) if (g_match && !g_auto_pause)
{ {
if (GetTeamClientCount(CS_TEAM_CT) < (GetConVarInt(wm_max_players)/2)) if (GetTeamClientCount(CS_TEAM_CT) < (GetConVarInt(wm_max_players)/2))
{ {
char name[64]; char name[64];
if (StrEqual(g_ct_name, "")) if (StrEqual(g_ct_name, ""))
{ {
Format(name, sizeof(name), DEFAULT_CT_NAME); Format(name, sizeof(name), DEFAULT_CT_NAME);
} }
else else
{ {
Format(name, sizeof(name), g_ct_name); Format(name, sizeof(name), g_ct_name);
} }
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Auto Pause Notice", LANG_SERVER, name); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Auto Pause Notice", LANG_SERVER, name);
if (GameRules_GetProp("m_bFreezePeriod") == 1) if (GameRules_GetProp("m_bFreezePeriod") == 1)
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Auto Unpause Notice", LANG_SERVER, name); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Auto Unpause Notice", LANG_SERVER, name);
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Notice", LANG_SERVER);
ServerCommand("mp_pause_match 1"); ServerCommand("mp_pause_match 1");
g_auto_pause = false; g_auto_pause = false;
} }
else else
{ {
g_auto_pause = true; g_auto_pause = true;
} }
} }
else if (GetTeamClientCount(CS_TEAM_T) < (GetConVarInt(wm_max_players)/2)) else if (GetTeamClientCount(CS_TEAM_T) < (GetConVarInt(wm_max_players)/2))
{ {
char name[64]; char name[64];
if (StrEqual(g_t_name, "")) if (StrEqual(g_t_name, ""))
{ {
Format(name, sizeof(name), DEFAULT_T_NAME); Format(name, sizeof(name), DEFAULT_T_NAME);
} }
else else
{ {
Format(name, sizeof(name), g_t_name); Format(name, sizeof(name), g_t_name);
} }
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Auto Pause Notice", LANG_SERVER, name); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Auto Pause Notice", LANG_SERVER, name);
if (GameRules_GetProp("m_bFreezePeriod") == 1) if (GameRules_GetProp("m_bFreezePeriod") == 1)
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Auto Unpause Notice", LANG_SERVER, name); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Auto Unpause Notice", LANG_SERVER, name);
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Notice", LANG_SERVER);
ServerCommand("mp_pause_match 1"); ServerCommand("mp_pause_match 1");
g_auto_pause = false; g_auto_pause = false;
} }
else else
{ {
g_auto_pause = true; g_auto_pause = true;
} }
} }
} }
}}
public Action Pause(int client, int args)public Action Pause(int client, int args)
{{
if (client == 0){ if (client == 0){
return Plugin_Handled; return Plugin_Handled;
} }
if (GetConVarBool(sv_pausable) && g_live) if (GetConVarBool(sv_pausable) && g_live)
{ {
if (GetConVarBool(wm_pause_confirm)) if (GetConVarBool(wm_pause_confirm))
{ {
if (GetClientTeam(client) == 2 && g_pause_offered_ct == true) if (GetClientTeam(client) == 2 && g_pause_offered_ct == true)
{ {
if (g_h_stored_timer_p != INVALID_HANDLE) if (g_h_stored_timer_p != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_p); KillTimer(g_h_stored_timer_p);
g_h_stored_timer_p = INVALID_HANDLE; g_h_stored_timer_p = INVALID_HANDLE;
} }
g_pause_offered_ct = false; g_pause_offered_ct = false;
g_ct_pause_count++; g_ct_pause_count++;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Freeze Time", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Freeze Time", LANG_SERVER);
g_pause_freezetime = true; g_pause_freezetime = true;
if (FreezeTime) if (FreezeTime)
{ {
//Pause command fire on round end May change to on round start //Pause command fire on round end May change to on round start
if (g_pause_freezetime == true) if (g_pause_freezetime == true)
{ {
g_pause_freezetime = false; g_pause_freezetime = false;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Notice", LANG_SERVER);
if (GetConVarBool(wm_auto_unpause)) if (GetConVarBool(wm_auto_unpause))
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", "CHAT_PREFIX", GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer); g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer);
} }
ServerCommand("mp_pause_match 1"); ServerCommand("mp_pause_match 1");
} }
} }
return Plugin_Handled; return Plugin_Handled;
} }
else if (GetClientTeam(client) == 3 && g_pause_offered_t == true) else if (GetClientTeam(client) == 3 && g_pause_offered_t == true)
{ {
if (g_h_stored_timer_p != INVALID_HANDLE) if (g_h_stored_timer_p != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer_p); KillTimer(g_h_stored_timer_p);
g_h_stored_timer_p = INVALID_HANDLE; g_h_stored_timer_p = INVALID_HANDLE;
} }
g_pause_offered_t = false; g_pause_offered_t = false;
g_t_pause_count++; g_t_pause_count++;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Round End", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Round End", LANG_SERVER);
g_pause_freezetime = true; g_pause_freezetime = true;
if (FreezeTime) if (FreezeTime)
{ {
//Pause command fire on round end May change to on round start //Pause command fire on round end May change to on round start
if (g_pause_freezetime == true) if (g_pause_freezetime == true)
{ {
g_pause_freezetime = false; g_pause_freezetime = false;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Notice", LANG_SERVER);
if (GetConVarBool(wm_auto_unpause)) if (GetConVarBool(wm_auto_unpause))
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", "CHAT_PREFIX", GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer); g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer);
} }
ServerCommand("mp_pause_match 1"); ServerCommand("mp_pause_match 1");
} }
} }
return Plugin_Handled; return Plugin_Handled;
} }
else if (GetClientTeam(client) == 2 && g_t_pause_count == GetConVarInt(wm_pause_limit)) else if (GetClientTeam(client) == 2 && g_t_pause_count == GetConVarInt(wm_pause_limit))
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Limit", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Limit", LANG_SERVER);
} }
else if (GetClientTeam(client) == 3 && g_ct_pause_count == GetConVarInt(wm_pause_limit)) else if (GetClientTeam(client) == 3 && g_ct_pause_count == GetConVarInt(wm_pause_limit))
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Limit", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Limit", LANG_SERVER);
} }
else if (GetClientTeam(client) < 2 ) else if (GetClientTeam(client) < 2 )
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Non-player", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Non-player", LANG_SERVER);
} }
else if (GetClientTeam(client) == 3 && g_ct_pause_count != GetConVarInt(wm_pause_limit) && g_pause_offered_ct == false) else if (GetClientTeam(client) == 3 && g_ct_pause_count != GetConVarInt(wm_pause_limit) && g_pause_offered_ct == false)
{ {
g_pause_offered_ct = true; g_pause_offered_ct = true;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", CHAT_PREFIX, g_ct_name, "Pause Offer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", "CHAT_PREFIX", g_ct_name, "Pause Offer", LANG_SERVER);
g_h_stored_timer_p = CreateTimer(30.0, PauseTimeout); g_h_stored_timer_p = CreateTimer(30.0, PauseTimeout);
} }
else if (GetClientTeam(client) == 2 && g_t_pause_count != GetConVarInt(wm_pause_limit) && g_pause_offered_t == false) else if (GetClientTeam(client) == 2 && g_t_pause_count != GetConVarInt(wm_pause_limit) && g_pause_offered_t == false)
{ {
g_pause_offered_t = true; g_pause_offered_t = true;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", CHAT_PREFIX, g_t_name, "Pause Offer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", "CHAT_PREFIX", g_t_name, "Pause Offer", LANG_SERVER);
g_h_stored_timer_p = CreateTimer(30.0, PauseTimeout); g_h_stored_timer_p = CreateTimer(30.0, PauseTimeout);
} }
} }
else if (GetClientTeam(client) == 3 && g_ct_pause_count != GetConVarInt(wm_pause_limit) && !GetConVarBool(wm_pause_confirm)) else if (GetClientTeam(client) == 3 && g_ct_pause_count != GetConVarInt(wm_pause_limit) && !GetConVarBool(wm_pause_confirm))
{ {
char player_name[64]; char player_name[64];
char authid[32]; char authid[32];
GetClientName(client, player_name, sizeof(player_name)); GetClientName(client, player_name, sizeof(player_name));
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid)); GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
EscapeString(player_name, sizeof(player_name)); EscapeString(player_name, sizeof(player_name));
EscapeString(authid, sizeof(authid)); EscapeString(authid, sizeof(authid));
g_ct_pause_count++; g_ct_pause_count++;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s has paused the match", CHAT_PREFIX, player_name, g_ct_name); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s has paused the match", "CHAT_PREFIX", player_name, g_ct_name);
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Freeze Time", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Freeze Time", LANG_SERVER);
g_pause_freezetime = true; g_pause_freezetime = true;
LogEvent("{\"event\": \"match_paused\", \"round\": %i, \"team\": 3, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid); LogEvent("{\"event\": \"match_paused\", \"round\": %i, \"team\": 3, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid);
if (FreezeTime) if (FreezeTime)
{ {
//Pause command fire on round end May change to on round start //Pause command fire on round end May change to on round start
if (g_pause_freezetime == true) if (g_pause_freezetime == true)
{ {
g_pause_freezetime = false; g_pause_freezetime = false;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Notice", LANG_SERVER);
if (GetConVarBool(wm_auto_unpause)) if (GetConVarBool(wm_auto_unpause))
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", "CHAT_PREFIX", GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer); g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer);
} }
ServerCommand("mp_pause_match 1"); ServerCommand("mp_pause_match 1");
} }
} }
return Plugin_Handled; return Plugin_Handled;
} }
else if (GetClientTeam(client) == 2 && g_t_pause_count != GetConVarInt(wm_pause_limit) && GetConVarBool(wm_pause_confirm) == false) else if (GetClientTeam(client) == 2 && g_t_pause_count != GetConVarInt(wm_pause_limit) && GetConVarBool(wm_pause_confirm) == false)
{ {
char player_name[64]; char player_name[64];
char authid[32]; char authid[32];
GetClientName(client, player_name, sizeof(player_name)); GetClientName(client, player_name, sizeof(player_name));
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid)); GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
EscapeString(player_name, sizeof(player_name)); EscapeString(player_name, sizeof(player_name));
EscapeString(authid, sizeof(authid)); EscapeString(authid, sizeof(authid));
g_t_pause_count++; g_t_pause_count++;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s has paused the match", CHAT_PREFIX, player_name, g_t_name); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s has paused the match", "CHAT_PREFIX", player_name, g_t_name);
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Freeze Time", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Freeze Time", LANG_SERVER);
g_pause_freezetime = true; g_pause_freezetime = true;
LogEvent("{\"event\": \"match_paused\", \"round\": %i, \"team\": 2, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid); LogEvent("{\"event\": \"match_paused\", \"round\": %i, \"team\": 2, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid);
if (FreezeTime) if (FreezeTime)
{ {
//Pause command fire on round end May change to on round start //Pause command fire on round end May change to on round start
if (g_pause_freezetime == true) if (g_pause_freezetime == true)
{ {
g_pause_freezetime = false; g_pause_freezetime = false;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Notice", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Notice", LANG_SERVER);
if (GetConVarBool(wm_auto_unpause)) if (GetConVarBool(wm_auto_unpause))
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", CHAT_PREFIX, GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %i %T", "CHAT_PREFIX", GetConVarInt(wm_auto_unpause_delay), "Unpause Timer", LANG_SERVER);
g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer); g_h_stored_timer = CreateTimer(GetConVarFloat(wm_auto_unpause_delay), UnPauseTimer);
} }
ServerCommand("mp_pause_match 1"); ServerCommand("mp_pause_match 1");
} }
} }
return Plugin_Handled; return Plugin_Handled;
} }
else if (GetClientTeam(client) == 2 && g_t_pause_count == GetConVarInt(wm_pause_limit)) else if (GetClientTeam(client) == 2 && g_t_pause_count == GetConVarInt(wm_pause_limit))
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Limit", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Limit", LANG_SERVER);
} }
else if (GetClientTeam(client) == 3 && g_ct_pause_count == GetConVarInt(wm_pause_limit)) else if (GetClientTeam(client) == 3 && g_ct_pause_count == GetConVarInt(wm_pause_limit))
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Limit", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Limit", LANG_SERVER);
} }
else if (GetClientTeam(client) < 2) else if (GetClientTeam(client) < 2)
{ {
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Non-player", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Non-player", LANG_SERVER);
} }
} }
else if (!g_live) else if (!g_live)
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Match Not In Progress", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Match Not In Progress", LANG_SERVER);
} }
else else
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Not Enabled", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Not Enabled", LANG_SERVER);
} }
return Plugin_Handled; return Plugin_Handled;
}}
public Action Unpause(int client, int args)public Action Unpause(int client, int args)
{{
if (IsPaused() && client != 0) { if (IsPaused() && client != 0) {
if (GetConVarBool(wm_unpause_confirm)) if (GetConVarBool(wm_unpause_confirm))
{ {
if (GetClientTeam(client) == 3 && g_pause_offered_ct == false && g_pause_offered_t == false) if (GetClientTeam(client) == 3 && g_pause_offered_ct == false && g_pause_offered_t == false)
{ {
g_pause_offered_ct = true; g_pause_offered_ct = true;
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (IsValidClient(i)) if (IsValidClient(i))
{ {
PrintToConsole(i, "[%s] %s %T", CHAT_PREFIX, g_ct_name, "Unpause Offer", LANG_SERVER); PrintToConsole(i, "[%s] %s %T", "CHAT_PREFIX", g_ct_name, "Unpause Offer", LANG_SERVER);
} }
} }
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", CHAT_PREFIX, g_ct_name, "Unpause Offer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", "CHAT_PREFIX", g_ct_name, "Unpause Offer", LANG_SERVER);
} }
else if (GetClientTeam(client) == 2 && g_pause_offered_t == false && g_pause_offered_ct == false) else if (GetClientTeam(client) == 2 && g_pause_offered_t == false && g_pause_offered_ct == false)
{ {
g_pause_offered_t = true; g_pause_offered_t = true;
for (int i = 1; i <= MaxClients; i++) for (int i = 1; i <= MaxClients; i++)
{ {
if (IsValidClient(i)) if (IsValidClient(i))
{ {
PrintToConsole(i, "[%s] %s %T", CHAT_PREFIX, g_t_name, "Unpause Offer", LANG_SERVER); PrintToConsole(i, "[%s] %s %T", "CHAT_PREFIX", g_t_name, "Unpause Offer", LANG_SERVER);
} }
} }
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", CHAT_PREFIX, g_t_name, "Unpause Offer", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s %T", "CHAT_PREFIX", g_t_name, "Unpause Offer", LANG_SERVER);
} }
else if (GetClientTeam(client) == 2 && g_pause_offered_ct == true) else if (GetClientTeam(client) == 2 && g_pause_offered_ct == true)
{ {
g_pause_offered_ct = false; g_pause_offered_ct = false;
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
if (g_h_stored_timer != INVALID_HANDLE) if (g_h_stored_timer != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer); KillTimer(g_h_stored_timer);
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
} }
} }
else if (GetClientTeam(client) == 3 && g_pause_offered_t == true) else if (GetClientTeam(client) == 3 && g_pause_offered_t == true)
{ {
g_pause_offered_t = false; g_pause_offered_t = false;
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
if (g_h_stored_timer != INVALID_HANDLE) if (g_h_stored_timer != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer); KillTimer(g_h_stored_timer);
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
} }
} }
else if (GetClientTeam(client) < 2 ) else if (GetClientTeam(client) < 2 )
{ {
PrintToConsole(client, "[%s] %T", CHAT_PREFIX, "Unpause Non-player", LANG_SERVER); PrintToConsole(client, "[%s] %T", "CHAT_PREFIX", "Unpause Non-player", LANG_SERVER);
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Non-player", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Non-player", LANG_SERVER);
} }
} }
else else
{ {
if (GetClientTeam(client) == 2) if (GetClientTeam(client) == 2)
{ {
char player_name[64]; char player_name[64];
char authid[32]; char authid[32];
GetClientName(client, player_name, sizeof(player_name)); GetClientName(client, player_name, sizeof(player_name));
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid)); GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
EscapeString(player_name, sizeof(player_name)); EscapeString(player_name, sizeof(player_name));
EscapeString(authid, sizeof(authid)); EscapeString(authid, sizeof(authid));
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s %T", CHAT_PREFIX, player_name, g_t_name, "Unpaused Match", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s %T", "CHAT_PREFIX", player_name, g_t_name, "Unpaused Match", LANG_SERVER);
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
if (g_h_stored_timer != INVALID_HANDLE) if (g_h_stored_timer != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer); KillTimer(g_h_stored_timer);
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
} }
LogEvent("{\"event\": \"match_resumed\", \"round\": %i, \"team\": 2, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid); LogEvent("{\"event\": \"match_resumed\", \"round\": %i, \"team\": 2, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid);
} }
else if (GetClientTeam(client) == 3) else if (GetClientTeam(client) == 3)
{ {
char player_name[64]; char player_name[64];
char authid[32]; char authid[32];
GetClientName(client, player_name, sizeof(player_name)); GetClientName(client, player_name, sizeof(player_name));
GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid)); GetClientAuthId(client, AuthId_Steam2, authid, sizeof(authid));
EscapeString(player_name, sizeof(player_name)); EscapeString(player_name, sizeof(player_name));
EscapeString(authid, sizeof(authid)); EscapeString(authid, sizeof(authid));
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s %T", CHAT_PREFIX, player_name, g_ct_name, "Unpaused Match", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %s - %s %T", "CHAT_PREFIX", player_name, g_ct_name, "Unpaused Match", LANG_SERVER);
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
if (g_h_stored_timer != INVALID_HANDLE) if (g_h_stored_timer != INVALID_HANDLE)
{ {
KillTimer(g_h_stored_timer); KillTimer(g_h_stored_timer);
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
} }
LogEvent("{\"event\": \"match_resumed\", \"round\": %i, \"team\": 3, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid); LogEvent("{\"event\": \"match_resumed\", \"round\": %i, \"team\": 3, \"name\": \"%s\", \"steamId\": \"%s\"}", g_round, player_name, authid);
} }
else if (GetClientTeam(client) < 2 ) else if (GetClientTeam(client) < 2 )
{ {
PrintToConsole(client, "[%s] %T", CHAT_PREFIX, "Unpause Non-player", LANG_SERVER); PrintToConsole(client, "[%s] %T", "CHAT_PREFIX", "Unpause Non-player", LANG_SERVER);
PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Non-player", LANG_SERVER); PrintToChat(client, "\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Non-player", LANG_SERVER);
} }
} }
} }
return Plugin_Handled; return Plugin_Handled;
}}
public Action UnpauseMatch(int client, const char[]command, int args)public Action UnpauseMatch(int client, const char[]command, int args)
{{
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
g_pause_offered_ct = false; g_pause_offered_ct = false;
g_pause_offered_t = false; g_pause_offered_t = false;
return Plugin_Continue; return Plugin_Continue;
}}
public Action PauseTimeout(Handle timer)public Action PauseTimeout(Handle timer)
{{
g_h_stored_timer_p = INVALID_HANDLE; g_h_stored_timer_p = INVALID_HANDLE;
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Pause Not Confirmed", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Pause Not Confirmed", LANG_SERVER);
g_pause_offered_ct = false; g_pause_offered_ct = false;
g_pause_offered_t = false; g_pause_offered_t = false;
}}
public Action UnPauseTimer(Handle timer)public Action UnPauseTimer(Handle timer)
{{
g_h_stored_timer = INVALID_HANDLE; g_h_stored_timer = INVALID_HANDLE;
if (IsPaused()) if (IsPaused())
{ {
PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", CHAT_PREFIX, "Unpause Auto", LANG_SERVER); PrintToChatAll("\x01 \x09[\x04%s\x09]\x01 %T", "CHAT_PREFIX", "Unpause Auto", LANG_SERVER);
} }
ServerCommand("mp_unpause_match 1"); ServerCommand("mp_unpause_match 1");
g_pause_offered_ct = false; g_pause_offered_ct = false;
g_pause_offered_t = false; g_pause_offered_t = false;
}}
public Action ResetMatchTimer(Handle timer)public Action ResetMatchTimer(Handle timer)
{{
ResetMatch(true, true); ResetMatch(true, true);
}}
stock bool IsValidClient(int client)stock bool IsValidClient(int client)
{{
if (client <= 0 || client > MaxClients) if (client <= 0 || client > MaxClients)
{ {
return false; return false;
} }
if (!IsClientInGame(client)) if (!IsClientInGame(client))
{ {
return false; return false;
} }
if (IsFakeClient(client)) if (IsFakeClient(client))
{ {
return false; return false;
} }
if (!IsClientConnected(client)) if (!IsClientConnected(client))
{ {
return false; return false;
} }
if (IsClientSourceTV(client) || IsClientReplay(client)) if (IsClientSourceTV(client) || IsClientReplay(client))
{ {
return false; return false;
} }
return true; return true;
}}
public Action ChangeMinReady(int client, int args)public Action ChangeMinReady(int client, int args)
{{
if (!IsActive(client, false)) if (!IsActive(client, false))
{ {
// warmod is disabled // GGA is disabled
return Plugin_Handled; return Plugin_Handled;
} }
if (!IsAdminCmd(client, false)) if (!IsAdminCmd(client, false))
{ {
// not allowed, rcon only // not allowed, rcon only
return Plugin_Handled; return Plugin_Handled;
} }
char arg[128]; char arg[128];
int minready; int minready;
if (GetCmdArgs() > 0) if (GetCmdArgs() > 0)
{ {
// setter // setter
GetCmdArg(1, arg, sizeof(arg)); GetCmdArg(1, arg, sizeof(arg));