public void Events_OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { UnturnedPlayer killer = UnturnedPlayer.FromCSteamID(murderer); switch (limb) { case ELimb.SKULL: GiveXP(Instance.Configuration.Instance.Skull_XP, killer, player, Translate("skull_name")); break; case ELimb.LEFT_ARM: GiveXP(Instance.Configuration.Instance.Arm_XP, killer, player, Translate("arm_name")); break; case ELimb.RIGHT_ARM: GiveXP(Instance.Configuration.Instance.Arm_XP, killer, player, Translate("arm_name")); break; case ELimb.LEFT_FOOT: GiveXP(Instance.Configuration.Instance.Foot_XP, killer, player, Translate("foot_name")); break; case ELimb.RIGHT_FOOT: GiveXP(Instance.Configuration.Instance.Foot_XP, killer, player, Translate("foot_name")); break; case ELimb.RIGHT_FRONT: GiveXP(Instance.Configuration.Instance.Front_XP, killer, player, Translate("front_name")); break; case ELimb.LEFT_FRONT: GiveXP(Instance.Configuration.Instance.Front_XP, killer, player, Translate("front_name")); break; case ELimb.SPINE: GiveXP(Instance.Configuration.Instance.Spine_XP, killer, player, Translate("spine_name")); break; case ELimb.LEFT_LEG: GiveXP(Instance.Configuration.Instance.Leg_XP, killer, player, Translate("leg_name")); break; case ELimb.RIGHT_LEG: GiveXP(Instance.Configuration.Instance.Leg_XP, killer, player, Translate("leg_name")); break; case ELimb.LEFT_BACK: GiveXP(Instance.Configuration.Instance.Back_XP, killer, player, Translate("back_name")); break; case ELimb.RIGHT_BACK: GiveXP(Instance.Configuration.Instance.Back_XP, killer, player, Translate("back_name")); break; } }
private void OnDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, CSteamID killer) { if (player.GetComponent <PlayerComponent>().dragging) { foreach (UnturnedPlayer jugadordic in player.GetComponent <PlayerComponent>().jugador) { foreach (UnturnedPlayer victimas in player.GetComponent <PlayerComponent>().victima) { // Don't ask me why i put this, pFunctions if (jugadordic != null || victimas != null) { player.GetComponent <PlayerComponent>().dragging = false; player.GetComponent <PlayerComponent>().victima.Remove(victimas); player.GetComponent <PlayerComponent>().jugador.Remove(jugadordic); } } } } }
private void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { UnturnedPlayer killer = Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer); string currentPath = System.IO.Directory.GetCurrentDirectory(); string filePath = currentPath + "\\Plugins\\StatKeeper\\Stats\\"; string playerStatFile = filePath + player.CSteamID + ".xml"; string killerStatFile = filePath + killer.CSteamID + ".xml"; XmlDocument playerDoc = new XmlDocument(); playerDoc.Load(playerStatFile); XmlElement playerPvPRoot = playerDoc.DocumentElement; XmlNodeList playerPvPNodes = playerPvPRoot.SelectNodes("/Stats/PvP"); XmlElement playerPvERoot = playerDoc.DocumentElement; XmlNodeList playerPvENodes = playerPvERoot.SelectNodes("/Stats/PvE"); XmlDocument killerDoc = new XmlDocument(); killerDoc.Load(killerStatFile); XmlElement killerPvPRoot = killerDoc.DocumentElement; XmlNodeList killerPvPNodes = killerPvPRoot.SelectNodes("/Stats/PvP"); XmlElement killerPvERoot = killerDoc.DocumentElement; XmlNodeList killerPvENodes = playerPvERoot.SelectNodes("/Stats/PvE"); if (cause.ToString() == "ZOMBIE") { foreach (XmlNode node in playerPvENodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int zDeaths = int.Parse(node["ZombieDeaths"].InnerText); int newtDeaths = tDeaths + 1; int newzDeaths = zDeaths + 1; XmlNode totDeaths = playerPvERoot.SelectSingleNode("TotalDeaths"); totDeaths.Value = newtDeaths + ""; XmlNode zomDeaths = playerPvERoot.SelectSingleNode("ZombieDeaths"); zomDeaths.Value = newzDeaths + ""; playerDoc.Save(playerStatFile); } } else if (cause.ToString() == "GUN") { foreach (XmlNode node in playerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int gDeaths = int.Parse(node["GunDeaths"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtDeaths = tDeaths + 1; int newgDeaths = gDeaths + 1; float newKDRatio; if (tKills > 0 && tDeaths == 0) { newKDRatio = tKills / 1; } else { newKDRatio = tKills / newtDeaths; } node["TotalDeaths"].InnerText = newtDeaths + ""; node["GunDeaths"].InnerText = newgDeaths + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(playerStatFile); } foreach (XmlNode node in killerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int gKills = int.Parse(node["GunKills"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtKills = tKills + 1; int newgKills = gKills + 1; float newKDRatio; if (newtKills > 0 && tDeaths == 0) { newKDRatio = newtKills / 1; } else { newKDRatio = newtKills / tDeaths; } node["TotalKills"].InnerText = newtKills + ""; node["GunKills"].InnerText = newgKills + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(killerStatFile); } } else if (cause.ToString() == "MELEE") { foreach (XmlNode node in playerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int mDeaths = int.Parse(node["MeleeDeaths"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtDeaths = tDeaths + 1; int newmDeaths = mDeaths + 1; float newKDRatio; if (tKills > 0 && tDeaths == 0) { newKDRatio = tKills / 1; } else { newKDRatio = tKills / newtDeaths; } node["TotalDeaths"].InnerText = newtDeaths + ""; node["MeleeDeaths"].InnerText = newmDeaths + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(playerStatFile); } foreach (XmlNode node in killerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int mKills = int.Parse(node["MeleeKills"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtKills = tKills + 1; int newmKills = mKills + 1; float newKDRatio; if (newtKills > 0 && tDeaths == 0) { newKDRatio = newtKills / 1; } else { newKDRatio = newtKills / tDeaths; } node["TotalKills"].InnerText = newtKills + ""; node["MeleeKills"].InnerText = newmKills + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(killerStatFile); } } else if (cause.ToString() == "PUNCH") { foreach (XmlNode node in playerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int pDeaths = int.Parse(node["PunchDeaths"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtDeaths = tDeaths + 1; int newpDeaths = pDeaths + 1; float newKDRatio; if (tKills > 0 && tDeaths == 0) { newKDRatio = tKills / 1; } else { newKDRatio = tKills / newtDeaths; } node["TotalDeaths"].InnerText = newtDeaths + ""; node["PunchDeaths"].InnerText = newpDeaths + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(playerStatFile); } foreach (XmlNode node in killerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int pKills = int.Parse(node["PunchKills"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtKills = tKills + 1; int newpKills = pKills + 1; float newKDRatio; if (newtKills > 0 && tDeaths == 0) { newKDRatio = newtKills / 1; } else { newKDRatio = newtKills / tDeaths; } node["TotalKills"].InnerText = newtKills + ""; node["PunchKills"].InnerText = newpKills + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(killerStatFile); } } else if (cause.ToString() == "ROADKILL") { foreach (XmlNode node in playerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int rDeaths = int.Parse(node["RoadDeaths"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtDeaths = tDeaths + 1; int newrDeaths = rDeaths + 1; float newKDRatio; if (tKills > 0 && tDeaths == 0) { newKDRatio = tKills / 1; } else { newKDRatio = tKills / newtDeaths; } node["TotalDeaths"].InnerText = newtDeaths + ""; node["RoadDeaths"].InnerText = newrDeaths + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(playerStatFile); } foreach (XmlNode node in killerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int rKills = int.Parse(node["RoadKills"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtKills = tKills + 1; int newrKills = rKills + 1; float newKDRatio; if (newtKills > 0 && tDeaths == 0) { newKDRatio = newtKills / 1; } else { newKDRatio = newtKills / tDeaths; } node["TotalKills"].InnerText = newtKills + ""; node["RoadKills"].InnerText = newrKills + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(killerStatFile); } } else if (cause.ToString() == "VEHICLE") { foreach (XmlNode node in playerPvENodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int vDeaths = int.Parse(node["VehicleDeaths"].InnerText); int newtDeaths = tDeaths + 1; int newvDeaths = vDeaths + 1; node["TotalDeaths"].InnerText = newtDeaths + ""; node["VehicleDeaths"].InnerText = newvDeaths + ""; playerDoc.Save(playerStatFile); } } else if (cause.ToString() == "FOOD") { foreach (XmlNode node in playerPvENodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int fDeaths = int.Parse(node["FoodDeaths"].InnerText); int newtDeaths = tDeaths + 1; int newfDeaths = fDeaths + 1; node["TotalDeaths"].InnerText = newtDeaths + ""; node["FoodDeaths"].InnerText = newfDeaths + ""; playerDoc.Save(playerStatFile); } } else if (cause.ToString() == "WATER") { foreach (XmlNode node in playerPvENodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int wDeaths = int.Parse(node["FoodDeaths"].InnerText); int newtDeaths = tDeaths + 1; int newwDeaths = wDeaths + 1; node["TotalDeaths"].InnerText = newtDeaths + ""; node["WaterDeaths"].InnerText = newwDeaths + ""; playerDoc.Save(playerStatFile); } } else if (cause.ToString() == "INFECTION") { foreach (XmlNode node in playerPvENodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int iDeaths = int.Parse(node["InfectionDeaths"].InnerText); int newtDeaths = tDeaths + 1; int newiDeaths = iDeaths + 1; node["TotalDeaths"].InnerText = newtDeaths + ""; node["InfectionDeaths"].InnerText = newiDeaths + ""; playerDoc.Save(playerStatFile); } } else if (cause.ToString() == "BLEEDING") { foreach (XmlNode node in playerPvENodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int bDeaths = int.Parse(node["BleedingDeaths"].InnerText); int newtDeaths = tDeaths + 1; int newbDeaths = bDeaths + 1; node["TotalDeaths"].InnerText = newtDeaths + ""; node["BleedingDeaths"].InnerText = newbDeaths + ""; playerDoc.Save(playerStatFile); } } else if (cause.ToString() == "SUICIDE") { foreach (XmlNode node in playerPvPNodes) { int tDeaths = int.Parse(node["TotalDeaths"].InnerText); int sDeaths = int.Parse(node["SuicideDeaths"].InnerText); int tKills = int.Parse(node["TotalKills"].InnerText); int kdRatio = int.Parse(node["KDRatio"].InnerText); int newtDeaths = tDeaths + 1; int newsDeaths = sDeaths + 1; float newKDRatio = tKills / newtDeaths; node["TotalDeaths"].InnerText = newtDeaths + ""; node["SuicideDeaths"].InnerText = newsDeaths + ""; node["KDRatio"].InnerText = newKDRatio + ""; playerDoc.Save(playerStatFile); } } }
private void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { UnturnedPlayer killer = UnturnedPlayer.FromCSteamID(murderer); string currentPath = System.IO.Directory.GetCurrentDirectory(); string playerSID = player.CSteamID + ".txt"; string murdererSID = Rocket.Unturned.Player.UnturnedPlayer.FromCSteamID(murderer) + ""; string player1SID = player.CSteamID + ""; string player2SID = killer.CSteamID + ""; string player1Name = player.CharacterName + ""; string player2Name = killer.CharacterName + ""; string player1File = player.CSteamID + ".txt"; string player2File = killer.CSteamID + ".txt"; string player3File = player.CharacterName + ".txt"; string player4File = killer.CharacterName + ".txt"; string fileName1 = currentPath + "\\Plugins\\CFire\\Players\\" + player1File; string fileName2 = currentPath + "\\Plugins\\CFire\\Players\\" + player2File; string fileName3 = currentPath + "\\Plugins\\CFire\\Players\\Characters\\" + player3File; string fileName4 = currentPath + "\\Plugins\\CFire\\Players\\Characters\\" + player4File; string line; System.IO.StreamReader file = new System.IO.StreamReader(currentPath + "\\Plugins\\CFire\\Players\\" + playerSID); while ((line = file.ReadLine()) != null) { if (line == murdererSID) { file.Close(); Execute(player, killer); deathPos = lastPos; tpDeaths.Add(player.CSteamID, deathPos); //remove ceasefire from first player SID List <string> cfList1 = File.ReadAllLines(fileName1).ToList(); cfList1.Remove(player2SID); File.WriteAllLines(fileName1, cfList1.ToArray()); //remove ceasefire from second player SID List <string> cfList2 = File.ReadAllLines(fileName2).ToList(); cfList2.Remove(player1SID); File.WriteAllLines(fileName2, cfList2.ToArray()); //remove ceasefire from first player Name List <string> cfList3 = File.ReadAllLines(fileName3).ToList(); cfList3.Remove(player2Name); File.WriteAllLines(fileName3, cfList3.ToArray()); //remove ceasefire from second player Name List <string> cfList4 = File.ReadAllLines(fileName4).ToList(); cfList4.Remove(player1Name); File.WriteAllLines(fileName4, cfList4.ToArray()); Rocket.Unturned.Chat.UnturnedChat.Say(player, killer.CharacterName + " " + CFire_Plugin.Instance.Translate("cf_kill"), Color.red); Rocket.Unturned.Chat.UnturnedChat.Say(killer, CFire_Plugin.Instance.Translate("cf_kill_1") + " " + player.CharacterName, Color.red); break; } } file.Close(); }
private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { ClearList(player); GetData(player); ClearHands(player); }
private void DA_OnPlayerDeath(RocketPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { if (!this.Loaded || !this.Configuration.Enabled) { return; } //TODO need proper steamid conversion, this is ugly if (murderer.ToString() == "90071992547409920") { murderer = (Steamworks.CSteamID) 0; } if (murderer == null) { murderer = (Steamworks.CSteamID) 0; } string Killer = string.Empty; if (murderer.ToString().Length > 1) { Killer = RocketPlayer.FromCSteamID(murderer)?.CharacterName; } string Message = ""; if (String.IsNullOrEmpty(Killer) && !String.IsNullOrEmpty(CauseLookup[cause].AltMessage)) { Message = CauseLookup[cause].AltMessage.Replace(@"%P", player.CharacterName); } else { Message = CauseLookup[cause].Message.Replace(@"%K", Killer); Message = Message.Replace(@"%P", player.CharacterName); } Say(Message, CauseLookup[cause].Color); }
public void ev_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { UnturnedPlayer killer = UnturnedPlayer.FromCSteamID(murderer); if (limb == ELimb.SKULL) { GiveXP(Instance.Configuration.Instance.Skull_XP, killer, player, Translate("skull_name")); } else if (limb == ELimb.LEFT_ARM || limb == ELimb.RIGHT_ARM) { GiveXP(Instance.Configuration.Instance.Arm_XP, killer, player, Translate("arm_name")); } else if (limb == ELimb.LEFT_FOOT || limb == ELimb.RIGHT_FOOT) { GiveXP(Instance.Configuration.Instance.Foot_XP, killer, player, Translate("foot_name")); } else if (limb == ELimb.RIGHT_FRONT || limb == ELimb.LEFT_FRONT) { GiveXP(Instance.Configuration.Instance.Front_XP, killer, player, Translate("front_name")); } else if (limb == ELimb.SPINE) { GiveXP(Instance.Configuration.Instance.Spine_XP, killer, player, Translate("spine_name")); } else if (limb == ELimb.LEFT_LEG || limb == ELimb.RIGHT_LEG) { GiveXP(Instance.Configuration.Instance.Leg_XP, killer, player, Translate("leg_name")); } else if (limb == ELimb.LEFT_BACK || limb == ELimb.RIGHT_BACK) { GiveXP(Instance.Configuration.Instance.Back_XP, killer, player, Translate("back_name")); } else { return; } }
private void PlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { UnturnedPlayer killer = UnturnedPlayer.FromCSteamID(murderer); if (killer != null) { VampirItem result = null; foreach (VampirItem item in Configuration.Instance.VampirItems) { if (item.ItemId == killer.Player.equipment.itemID) { result = item; break; } } if (result != null) { killer.Heal(result.heal); EffectManager.sendEffect(Configuration.Instance.EffectVampirId, 32, killer.Position); } } }
private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, CSteamID murderer) { try { LogThis(DateTime.Now.ToString("s") + ";" + player.CSteamID.ToString() + ";" + player.SteamGroupID.ToString() + ";" + cause.ToString() + ";" + murderer.ToString() + ";", instance.Configuration.Instance.fragLogFileName); if (!status.isActive) { return; } if (player.SteamGroupID.m_SteamID == instance.Configuration.Instance.teamASteamId && status.isActive) { status.teamBScore += 1; SaveStatus(); UnturnedChat.Say("SCORE: " + status.teamAScore.ToString() + " : " + status.teamBScore.ToString() + " - Team B scored a point!", TDM.instance.Configuration.Instance.scoreColor); } if (player.SteamGroupID.m_SteamID == instance.Configuration.Instance.teamBSteamId && status.isActive) { status.teamAScore += 1; SaveStatus(); UnturnedChat.Say("SCORE: " + status.teamAScore.ToString() + " : " + status.teamBScore.ToString() + " - Team A scored a point!", TDM.instance.Configuration.Instance.scoreColor); } } catch (Exception ex) { Rocket.Core.Logging.Logger.LogException(ex, ex.Message); } }
private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, CSteamID murderer) { if (instance.playerList.ContainsKey(murderer.m_SteamID)) { if (murderer.m_SteamID != player.CSteamID.m_SteamID) { try { UnturnedPlayer.FromCSteamID(murderer).Experience += instance.Configuration.Instance.killPlayerExperience; } catch (Exception) { throw; } } } }
void UnturnedPlayerEvents_OnPlayerDeath(Rocket.Unturned.Player.UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, Steamworks.CSteamID murderer) { ZaupClearInventoryLib.Instance.ClearInv(player); ZaupClearInventoryLib.Instance.ClearClothes(player); }