public ExtraServerFuncs() { fIsEnabled = false; fDebugLevel = 2; files = new TextDatei(); //PRoConPlugins = new PluginDictionary(); nm_Rules = new List<string>(); // NORMAL MODE RULES nm_Rules.Add("############## RULES ##############"); nm_Rules.Add("NO CHEATING / GLITCHING / BUGUSING"); pm_Rules = new List<string>(); // PRIVATE MODE RULES pm_Rules.Add("########## PRIVATE MODE ##########"); pm_Rules.Add("NO RULES ARE ACTIVE"); kom_Rules = new List<string>(); // KNIFE ONLY MODE RULES kom_Rules.Add("########### KNIFE ONLY ###########"); kom_Rules.Add("KNIFE ONLY! DO NOT USE ANY OTHER WEAPON"); pom_Rules = new List<string>(); // PISTOL ONLY MODE RULES pom_Rules.Add("########### PISTOL ONLY ###########"); pom_Rules.Add("PISTOL ONLY! DO NOT USE ANY OTHER WEAPON"); fm_Rules = new List<string>(); // FLAGRUN MODE RULES fm_Rules.Add("############# FLAGRUN #############"); fm_Rules.Add("DO NOT KILL - KILL = KICK or BAN"); fm_Rules.Add("NO FLAGCAMPING"); sm_Rules.Add("########### SHOTGUN ONLY ###########"); sm_Rules.Add("SHOTGUN ONLY! DO NOT USE ANY OTHER WEAPON"); bam_Rules.Add("########### BOLT ACTION ONLY ###########"); bam_Rules.Add("BOLT ACTION ONLY! DO NOT USE ANY OTHER WEAPON"); dmr_Rules.Add("########### AUTOSNIPER(DMR) ONLY ###########"); dmr_Rules.Add("AUTOSNIPER(DMR) ONLY! DO NOT USE ANY OTHER WEAPON"); g_prohibitedWeapons = new List<string>(); g_prohibitedWeapons.Add("READ PLUGIN DESCRIPTION"); g_prohibitedWeapons.Add("TO KNOW HOW U GET THE WEAPONCODES EASY"); nm_MapList = new List<string>(); // NORMAL MODE MAPLIST nm_MapList.Add("MP_Prison Domination0 2"); nm_MapList.Add("MP_Naval ConquestSmall0 2"); nm_MapList.Add("MP_Damage Elimination0 2"); nm_MapList.Add("MP_Resort Obliteration 2"); nm_MapList.Add("MP_Prison RushLarge0 2"); nm_MapList.Add("MP_Journey SquadDeathMatch0 2"); nm_MapList.Add("MP_TheDish TeamDeathMatch0 2"); nm_MapList.Add("XP1_001 AirSuperiority0 2"); pm_MapList = new List<string>(); // PRIVATE MODE MAPLIST pm_MapList.Add("MP_Journey TeamDeathMatch0 2"); // Goldmud pm_MapList.Add("MP_Prison TeamDeathMatch0 2"); // Spind pom_MapList = new List<string>(); // PISTOL ONLY MODE MAPLIST pom_MapList.Add("MP_Prison TeamDeathMatch0 2"); // Spind kom_MapList = new List<string>(); // KNIFE ONLY MODE MAPLIST kom_MapList.Add("MP_Prison TeamDeathMatch0 2"); // Spind fm_MapList = new List<string>(); // FLAGRUN MODE MAPLIST fm_MapList.Add("MP_Flooded ConquestLarge0 2"); // Floodzone fm_MapList.Add("MP_Journey ConquestLarge0 2"); // Goldmud sm_MapList.Add("MP_Prison TeamDeathMatch0 2"); // Spind bam_MapList.Add("MP_Prison TeamDeathMatch0 2"); // Spind dmr_MapList.Add("MP_Prison TeamDeathMatch0 2"); // Spind tmpPluginVariables = new Dictionary<string, string>(); MapFileNames = new Dictionary<string, string>(); // Map Names an Filenames m_ClanWhitelist = new List<string>(); // General Clan Whitelist m_PlayerWhitelist = new List<string>(); // General Player Whitelist pm_ClanWhitelist = new List<string>(); // PRIVATE MODE Clan Whitelist pm_PlayerWhitelist = new List<string>(); // PRIVATE MODE Player Whitelist fm_ClanWhitelist = new List<string>(); // FLAGRUN MODE Clan Whitelist fm_PlayerWhitelist = new List<string>(); // FLAGRUN MODE Player Whitelist kom_ClanWhitelist = new List<string>(); // KNIFE ONLY MODE Clan Whitelist kom_PlayerWhitelist = new List<string>(); // KNIFE MODE Player Whitelist pom_ClanWhitelist = new List<string>(); // KNIFE ONLY MODE Clan Whitelist pom_PlayerWhitelist = new List<string>(); // KNIFE MODE Player Whitelist }
public void Init(string Filename) { CSV_Filename = Filename; csv_Players = new List<CSV_PlayerInfo>(); CSV_PlayerInfo csv_Player; files = new TextDatei(); if (File.Exists(Filename)) { List<string> tmpList = files.ReadLines(Filename); int lineCount = 0; foreach (string line in tmpList) { lineCount++; string[] row = line.Split(';'); if (lineCount > 1) // Erste Zeile ??springen, da es sich um den Header handelt { csv_Player.PlayerName = row[0]; csv_Player.ClanTag = row[1]; csv_Player.fileline = lineCount; csv_Player.Visits = Convert.ToInt32(row[2]); csv_Player.Score = Convert.ToInt32(row[3]); csv_Player.Kills = Convert.ToInt32(row[4]); csv_Player.Death = Convert.ToInt32(row[5]); csv_Player.Suicides = Convert.ToInt32(row[6]); csv_Player.Warns = Convert.ToInt32(row[7]); csv_Player.Kicks = Convert.ToInt32(row[8]); csv_Player.Endrounds = Convert.ToInt32(row[9]); csv_Player.LastSeen = Convert.ToDateTime(row[10]); csv_Player.PlayedTime = Convert.ToDateTime(row[11]); csv_Players.Add(csv_Player); } } } if (!File.Exists(Filename)) files.WriteLine(Filename, csv_header); // Wenn CSV Datei nicht existiert dann schreibe den Header in die erste Zeile db_fileinit = true; }
public void InitPlugin() { try { Thread thread_PluginEnable = new Thread(new ThreadStart(delegate() { Thread.Sleep(2000); if (stop_init) return; // Chek if Plugin gets Disabled and stop working Enable_UMM(true); Thread.Sleep(500); isInstalledUMM = IsUMM_installed(); if (isInstalledUMM) Enable_UMM(false); Thread.Sleep(2000); if (stop_init) return; // Chek if Plugin gets Disabled and stop working if (thermsofuse == "YES") { WritePluginConsole("User acctepted the therms of use... run Plugin init...", "INFO", 0); } else { WritePluginConsole("You have to accept the therms of use before you can use this plugin", "WARN", 0); this.ExecuteCommand("procon.protected.plugins.enable", "ExtraServerFuncs", "false"); // Send Disable Command return; } WritePluginConsole("Init Plugin...", "INFO", 0); Thread.Sleep(2000); if (stop_init) return; // Chek if Plugin gets Disabled and stop working if (firstload_sleep) { serverMode = "first_start"; next_serverMode = "first_start"; WritePluginConsole("^1^bENABLE PLUGIN FIRST TIME! SLEEP FOR 30 SECONDS", "INFO", 2); Thread.Sleep(30000); // Wenn Procon das erste mal gestartet wird 30 sekunden Warten firstload_sleep = false; } if (stop_init) return; // Chek if Plugin gets Disabled and stop working WritePluginConsole("Set Startup Vars...", "INFO", 2); plugin_enabled = true; serverInfoloaded = false; players = new PlayerDB(); files = new TextDatei(); fIsEnabled = true; Thread.Sleep(1000); if (stop_init) return; // Chek if Plugin gets Disabled and stop working WritePluginConsole("Update Current Server Variables", "DEBUG", 10); UdateServerConfig(); Thread.Sleep(1000); if (stop_init) return; // Chek if Plugin gets Disabled and stop working serverMode = "plugin_init"; WritePluginConsole("startup_mode = " + startup_mode, "DEBUG", 10); if (startup_mode == "none") { serverMode = "normal"; next_serverMode = "normal"; } else if (startup_mode == "autodetect") // AUTODETECT CURRENT SERVER MODE { string tmp_Servermode = GetCurrentServermode(); if (tmp_Servermode == "unknown") { serverMode = "plugin_init"; next_serverMode = "normal"; } else { serverMode = tmp_Servermode; next_serverMode = tmp_Servermode; } } else { next_serverMode = startup_mode; // Setze den n?ten Servermode auf Startup mode } WritePluginConsole("^3Wait on: OnServerInfo()", "DEBUG", 10); while (!serverInfoloaded && !stop_init) { Thread.Sleep(500); } // Wait on Server Info if (stop_init) return; // Chek if Plugin gets Disabled and stop working WritePluginConsole("^2Recived: OnServerInfo()", "DEBUG", 10); WritePluginConsole("playerCount =" + playerCount, "DEBUG", 10); if (startup_mode != "none") { WritePluginConsole("startup mode is not 'none'", "DEBUG", 10); if (playerCount < 1) { WritePluginConsole("Player Count is less than 1", "DEBUG", 10); serverMode = "plugin_init"; PreSwitchServerMode(next_serverMode); StartSwitchCountdown(); } else if (agresive_startup == enumBoolYesNo.Yes) { WritePluginConsole("Aggresive Startup is ON", "DEBUG", 10); PreSwitchServerMode(next_serverMode); StartSwitchCountdown(); } } else { PreSwitchServerMode(next_serverMode); } WritePluginConsole("LOADED Startup Server Mode: " + next_serverMode, "INFO", 2); WritePluginConsole("Register Commands", "INFO", 10); RegisterAllCommands(); plugin_loaded = true; isNewVersion(GetPluginVersion()); // Check on Update SetPluginSetting("REFRESH PLUGIN VARIABLES", ""); // Refresh to get shown State Display after Init WritePluginConsole("....ready! Do my work now :)", "INFO", 2); return; })); thread_PluginEnable.Start(); } catch (Exception e) { WritePluginConsole("Caught Exception in InitPlugin()", "ERROR", 2); WritePluginConsole(e.Message, "ERROR", 2); throw; } }