public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc) { // update the own score if (attacker.HasField("bohud_created")) { attacker.AfterDelay(10, entity => { var scoreText = entity.GetField<HudElem[]>("bohud_messageText")[1]; scoreText.SetText(entity.GetField<int>("score").ToString()); }); } // update all players' ranking UpdateScores(); }
private void UpdateHUDAmmo(Entity player) { if (!player.HasField("bohud_created")) { return; } if (!player.IsAlive) { return; } var ammoStock = player.GetField<HudElem>("bohud_ammoStock"); var ammoClip = player.GetField<HudElem>("bohud_ammoClip"); var weaponName = player.GetField<HudElem>("bohud_weaponName"); var currentWeapon = player.CurrentWeapon; ammoStock.SetText(player.GetWeaponAmmoStock(currentWeapon).ToString()); ammoClip.SetText(player.GetWeaponAmmoClip(currentWeapon).ToString()); var weapon = player.CurrentWeapon; if ((MapEdit.weaponlist.Contains(weapon) || MapEdit.upgradeweaponlist.Contains(weapon)) || weapon == "iw5_usp45_mp_tactical") { if (weapon == "iw5_usp45_mp_tactical") { weaponName.SetText("^2Zombie's Knife"); } if (weapon == "iw5_usp45_mp") { weaponName.SetText("USP .45"); } if (weapon == "iw5_usp45_mp_akimbo_xmags") { weaponName.SetText("^1XM31 Akimbo"); } if (weapon == "iw5_p99_mp") { weaponName.SetText("P99"); } if (weapon == "iw5_p99_mp_akimbo_xmags") { weaponName.SetText("^1P99 Akimbo"); } if (weapon == "iw5_fnfiveseven_mp") { weaponName.SetText("FN FiveSeven"); } if (weapon == "iw5_fnfiveseven_mp_akimbo_xmags") { weaponName.SetText("^1FN FiveSeven Akimbo"); } if (weapon == "iw5_deserteagle_mp") { weaponName.SetText("Desert Eagle"); } if (weapon == "iw5_deserteagle_mp_akimbo_xmags") { weaponName.SetText("^1Desert Eagle Akimbo"); } if (weapon == "iw5_mp412_mp") { weaponName.SetText("MP412"); } if (weapon == "iw5_mp412_mp_akimbo_xmags") { weaponName.SetText("^1MP412 Akimbo"); } if (weapon == "iw5_44magnum_mp") { weaponName.SetText(".44 Magnum"); } if (weapon == "iw5_44magnum_mp_akimbo_xmags") { weaponName.SetText("^1.44 Magnum Akimbo"); } if (weapon == "iw5_fmg9_mp") { weaponName.SetText("FMG9"); } if (weapon == "iw5_fmg9_mp_akimbo_eotechsmg_xmags") { weaponName.SetText("^1FMG9 Akimbo"); } if (weapon == "iw5_g18_mp") { weaponName.SetText("Glock 18"); } if (weapon == "iw5_g18_mp_akimbo_eotechsmg_xmags") { weaponName.SetText("^1Glock 18 Akimbo"); } if (weapon == "iw5_skorpion_mp") { weaponName.SetText("Skorpion"); } if (weapon == "iw5_skorpion_mp_akimbo_xmags") { weaponName.SetText("^1Skorpion Akimbo"); } if (weapon == "iw5_mp9_mp") { weaponName.SetText("MP9"); } if (weapon == "iw5_mp9_mp_akimbo_xmags") { weaponName.SetText("^1MP9 Akimbo"); } if (weapon == "iw5_mp9_mp_eotechsmg_silencer02") { weaponName.SetText("^2The Dyer"); } if (weapon == "iw5_mp9_mp_eotechsmg_silencer02_xmags") { weaponName.SetText("^1New Millenium"); } if (weapon == "iw5_smaw_mp") { weaponName.SetText("SMAW"); } if (weapon == "rpg_mp") { weaponName.SetText("^2RPG-27"); } if (weapon == "xm25_mp") { weaponName.SetText("XM25"); } if (weapon == "uav_strike_marker_mp") { weaponName.SetText("^2War Machine"); } if (weapon == "iw5_m4_mp") { weaponName.SetText("M4A1"); } if (weapon == "iw5_m4_mp_eotech_xmags_camo09") { weaponName.SetText("^1SC 845"); } if (weapon == "iw5_m16_mp") { weaponName.SetText("M16"); } if (weapon == "iw5_m16_mp_eotech_xmags_camo09") { weaponName.SetText("^1SC 2010"); } if (weapon == "iw5_cm901_mp") { weaponName.SetText("CM901"); } if (weapon == "iw5_cm901_mp_eotech_xmags_camo09") { weaponName.SetText("^1Crush Manager 991"); } if (weapon == "iw5_type95_mp") { weaponName.SetText("QBZ-95-1"); } if (weapon == "iw5_type95_mp_reflex_xmags_camo09") { weaponName.SetText("^1QBZ-190"); } if (weapon == "iw5_acr_mp_camo13") { weaponName.SetText("Adaptive Combat Rifle"); } if (weapon == "iw5_acr_mp_xmags_camo12") { weaponName.SetText("^1Masada 7.62"); } if (weapon == "iw5_mk14_mp") { weaponName.SetText("M39"); } if (weapon == "iw5_mk14_mp_rof_xmags_camo09") { weaponName.SetText("^1Massive Killer"); } if (weapon == "iw5_ak47_mp") { weaponName.SetText("AK-100"); } if (weapon == "iw5_ak47_mp_xmags_camo09") { weaponName.SetText("^1AK-12"); } if (weapon == "iw5_g36c_mp") { weaponName.SetText("HK G36C"); } if (weapon == "iw5_g36c_mp_hybrid_xmags_camo09") { weaponName.SetText("^1Blaster"); } if (weapon == "iw5_scar_mp_camo13") { weaponName.SetText("SCAR-L"); } if (weapon == "iw5_scar_mp_xmags_camo12") { weaponName.SetText("^1SCAR-H"); } if (weapon == "iw5_fad_mp") { weaponName.SetText("FAD"); } if (weapon == "iw5_fad_mp_xmags_camo09") { weaponName.SetText("^1Functional Annihilation Device"); } if (weapon == "iw5_mp5_mp") { weaponName.SetText("MP5A4"); } if (weapon == "iw5_mp5_mp_rof_xmags_camo09") { weaponName.SetText("^1MP5SD"); } if (weapon == "iw5_ump45_mp") { weaponName.SetText("HK UMP45"); } if (weapon == "iw5_ump45_mp_rof_xmags_camo09") { weaponName.SetText("^1U45 Hologram"); } if (weapon == "iw5_pp90m1_mp") { weaponName.SetText("PP90M1"); } if (weapon == "iw5_pp90m1_mp_rof_xmags_camo09") { weaponName.SetText("^1Buffalo"); } if (weapon == "iw5_p90_mp") { weaponName.SetText("FN P90"); } if (weapon == "iw5_p90_mp_rof_xmags_camo09") { weaponName.SetText("^1Passive Aggressor"); } if (weapon == "iw5_m9_mp") { weaponName.SetText("PM-9"); } if (weapon == "iw5_m9_mp_rof_xmags_camo09") { weaponName.SetText("^1CBJ"); } if (weapon == "iw5_m9_mp_eotechsmg_camo08") { weaponName.SetText("^2Ray Gun"); } if (weapon == "iw5_m9_mp_eotechsmg_xmags_camo08") { weaponName.SetText("^1Porter's X2 Ray Gun"); } if (weapon == "iw5_mp7_mp") { weaponName.SetText("MP7A1"); } if (weapon == "iw5_mp7_mp_rof_xmags_camo09") { weaponName.SetText("^1Mortal Punisher"); } if (weapon == "iw5_dragunov_mp_dragunovscope") { weaponName.SetText("Dragunov"); } if (weapon == "iw5_dragunov_mp_acog_xmags_camo09") { weaponName.SetText("^1SVD-12"); } if (weapon == "iw5_barrett_mp_barrettscope") { weaponName.SetText("M107"); } if (weapon == "iw5_barrett_mp_acog_xmags_camo09") { weaponName.SetText("^1Leopard Cat"); } if (weapon == "iw5_l96a1_mp_l96a1scope") { weaponName.SetText("L118A"); } if (weapon == "iw5_l96a1_mp_acog_xmags_camo09") { weaponName.SetText("^1L115"); } if (weapon == "iw5_as50_mp_as50scope") { weaponName.SetText("AS50"); } if (weapon == "iw5_as50_mp_acog_xmags_camo09") { weaponName.SetText("^1Adaptive Snipe Rifle"); } if (weapon == "iw5_rsass_mp_rsassscope") { weaponName.SetText("RSASS"); } if (weapon == "iw5_rsass_mp_acog_xmags_camo09") { weaponName.SetText("^1MK11 MOD2"); } if (weapon == "iw5_msr_mp_msrscope") { weaponName.SetText("Modular Sniper Rifle"); } if (weapon == "iw5_msr_mp_acog_xmags_camo09") { weaponName.SetText("^1MSR .50 BMG"); } if (weapon == "iw5_sa80_mp") { weaponName.SetText("L86A2"); } if (weapon == "iw5_sa80_mp_grip_xmags_camo09") { weaponName.SetText("^1Lasserator"); } if (weapon == "iw5_mg36_mp") { weaponName.SetText("MG36"); } if (weapon == "iw5_mg36_mp_grip_rof_xmags_camo09") { weaponName.SetText("^1Masseration Gun"); } if (weapon == "iw5_pecheneg_mp") { weaponName.SetText("PKP Pecheneg"); } if (weapon == "iw5_pecheneg_mp_grip_reflexlmg_xmags_camo09") { weaponName.SetText("^1Earthmover"); } if (weapon == "iw5_mk46_mp") { weaponName.SetText("MK48"); } if (weapon == "iw5_mk46_mp_grip_reflexlmg_xmags_camo09") { weaponName.SetText("^1Death Machine"); } if (weapon == "iw5_m60_mp") { weaponName.SetText("M60E4"); } if (weapon == "iw5_m60jugg_mp_eotechlmg_camo07") { weaponName.SetText("^2AUGA3 HBAR"); } if (weapon == "iw5_usas12_mp") { weaponName.SetText("USAS"); } if (weapon == "iw5_usas12_mp_grip_xmags_camo09") { weaponName.SetText("^1USedASs"); } if (weapon == "iw5_ksg_mp") { weaponName.SetText("KSG"); } if (weapon == "iw5_ksg_mp_grip_xmags_camo09") { weaponName.SetText("^1Keg Space Gun"); } if (weapon == "iw5_spas12_mp") { weaponName.SetText("SPAS"); } if (weapon == "iw5_spas12_mp_grip_xmags_camo09") { weaponName.SetText("^1S.P.A.Z.S.E."); } if (weapon == "iw5_striker_mp") { weaponName.SetText("Striker"); } if (weapon == "iw5_striker_mp_grip_xmags_camo09") { weaponName.SetText("^1S.T.A.R.K.E."); } if (weapon == "iw5_aa12_mp") { weaponName.SetText("AA12"); } if (weapon == "iw5_aa12_mp_grip_xmags_camo09") { weaponName.SetText("^1AutoAssassinator"); } if (weapon == "iw5_1887_mp") { weaponName.SetText("Model 1887"); } if (weapon == "iw5_1887_mp_camo09") { weaponName.SetText("^1Model 1337"); } if (weapon == "riotshield_mp") { weaponName.SetText("Riot Shield"); } if (weapon == "iw5_riotshieldjugg_mp") { weaponName.SetText("^1Reinforced Internal Optimal Tin Shield"); } if (weapon == "javelin_mp") { weaponName.SetText("Javelin"); } if (weapon == "stinger_mp") { weaponName.SetText("Stinger"); } if (weapon == "iw5_usp45_mp_silencer02") { weaponName.SetText("^2XM31"); } if (weapon == "iw5_striker_mp_grip_silencer03_camo09") { weaponName.SetText("^2M32 MGL"); } } else { weaponName.SetText("^0Unknown Weapon"); } }
private void createPlayerHud(Entity player) { HudElem money = HudElem.CreateFontString(player, "hudbig", 1.0f); money.SetPoint("TOP RIGHT", "TOP RIGHT", -10, 325); //25 original money.HideWhenInMenu = true; HudElem moneytext = HudElem.CreateFontString(player, "hudbig", 1.0f); moneytext.SetPoint("TOP RIGHT", "TOP RIGHT", -65, 325); //25 original moneytext.HideWhenInMenu = true; OnInterval(100, () => { if (player.GetField<string>("sessionteam") != "axis") { moneytext.SetText("$: "); money.Call("setvalue", player.GetField<int>("lsd_money")); } else { moneytext.SetText(""); money.SetText(""); money.Alpha = 0; } return true; }); if (player.HasField("bohud_created")) { return; } // ammo stuff var ammoSlash = HudElem.CreateFontString(player, "default", 1.25f); ammoSlash.SetPoint("bottom right", "bottom right", -85, -35); ammoSlash.GlowAlpha = 0; ammoSlash.HideWhenInMenu = true; ammoSlash.Archived = false; ammoSlash.SetText("/"); player.SetField("bohud_ammoSlash", new Parameter(ammoSlash)); var ammoStock = HudElem.CreateFontString(player, "default", 1.25f); ammoStock.Parent = ammoSlash; ammoStock.SetPoint("bottom left", "bottom left", 3, 0); ammoStock.GlowAlpha = 0; ammoStock.HideWhenInMenu = true; ammoStock.Archived = false; ammoStock.SetText("48"); player.SetField("bohud_ammoStock", new Parameter(ammoStock)); var ammoClip = HudElem.CreateFontString(player, "default", 1.95f); ammoClip.Parent = ammoSlash; ammoClip.SetPoint("right", "right", -7, -4); ammoClip.GlowAlpha = 0; ammoClip.HideWhenInMenu = true; ammoClip.Archived = false; ammoClip.SetText("12"); var weaponName = HudElem.CreateFontString(player, "default", 2f); weaponName.SetPoint("bottom right", "bottom right", -64, -15); weaponName.GlowAlpha = 0; weaponName.HideWhenInMenu = true; weaponName.Archived = false; weaponName.SetText(""); UpdateHUDAmmo(player); player.SetField("bohud_weaponName", new Parameter(weaponName)); player.SetField("bohud_ammoClip", new Parameter(ammoClip)); player.SetField("bohud_created", true); }
public void PrintRollNames(Entity player, string name, int index, int? roll) { player.Call("iPrintLnBold", string.Format("You rolled {0} - {1}", roll + 1, name)); Call(334, string.Format("{0} rolled [{1}] - {2}", player.GetField<string>("name"), roll + 1, name)); HudElem elem = player.HasField("rtd_rolls") ? player.GetField<HudElem>("rtd_rolls") : HudElem.CreateFontString(player, "bigfixed", 0.6f); elem.SetPoint("RIGHT", "RIGHT", -90, 165 - ((index - 1) * 13)); elem.SetText(string.Format("[{0}] {1}", roll + 1, name)); player.SetField("rtd_rolls", new Parameter(elem)); }
public void OnPlayerSpawned(Entity player) { if (Utility.GetPlayerTeam(player) == "axis") { if (PlayerStop.Contains(player.GetField<string>("name"))) PlayerStop.Remove(player.GetField<string>("name")); if (!player.HasField("rtd_canroll") || player.GetField<int>("rtd_canroll") == 1) { ResetPlayer(player); AfterDelay(50, () => DoRandom(player)); } } }
private void CreateHUD(Entity player) { if (player.HasField("bohud_created")) { return; } // background bars, left side var bars = new HudElem[2]; new[] { new { X = -20, Y = 15, i = 0 }, new { X = -20, Y = -4, i = 1 } }.ToList().ForEach(coord => { var bar = HudElem.NewClientHudElem(player); bar.X = coord.X; bar.Y = coord.Y; bar.AlignX = "left"; bar.AlignY = "bottom"; bar.HorzAlign = "left"; bar.VertAlign = "bottom"; bar.SetShader("white", 190, 15); bar.Alpha = 0.3f; bar.HideWhenInMenu = true; bar.Foreground = false; bars[coord.i] = bar; }); player.SetField("bohud_bars", new Parameter(bars)); // ranking background var circle = HudElem.CreateIcon(player, "cardicon_radiation", 60, 60); circle.SetPoint("bottom left", "bottom left", 15, -15); circle.HideWhenInMenu = true; circle.Foreground = true; circle.Alpha = 1; player.SetField("bohud_circle", new Parameter(circle)); // rank text/shadow var rankX = -26; player.SetField("bohud_rankX", rankX); var rankText = new HudElem[3]; new[] { new { X = rankX - 1, Sort = 3 }, new { X = rankX + 1, Sort = 4 }, new { X = rankX, Sort = 5 } }.ToList().ForEach(entry => { var text = HudElem.NewClientHudElem(player); text.X = entry.X; text.Y = 18; text.AlignX = "left"; text.AlignY = "bottom"; text.HorzAlign = "left"; text.VertAlign = "bottom"; text.FontScale = 5; text.Sort = entry.Sort; text.HideWhenInMenu = true; text.SetText((entry.Sort == 5) ? "1" : "^01"); rankText[entry.Sort - 3] = text; }); player.SetField("bohud_rankText", new Parameter(rankText)); // message texts var messageText = new HudElem[2]; new[] { new { X = 30, Y = 16, Text = "", i = 0 }, new { X = 30, Y = -3, Text = "0", i = 1 }, }.ToList().ForEach(entry => { var text = HudElem.NewClientHudElem(player); text.X = entry.X; text.Y = entry.Y; text.AlignX = "left"; text.AlignY = "bottom"; text.HorzAlign = "left"; text.VertAlign = "bottom"; text.FontScale = 1.5f; text.Alpha = 0.5f; text.HideWhenInMenu = true; text.Sort = 5; text.SetText(entry.Text); messageText[entry.i] = text; }); player.SetField("bohud_messageText", new Parameter(messageText)); // ammo stuff var ammoSlash = HudElem.CreateFontString(player, "default", 1.25f); ammoSlash.SetPoint("bottom right", "bottom right", -85, -35); ammoSlash.GlowAlpha = 0; ammoSlash.HideWhenInMenu = true; ammoSlash.Archived = false; ammoSlash.SetText("/"); player.SetField("bohud_ammoSlash", new Parameter(ammoSlash)); var ammoStock = HudElem.CreateFontString(player, "default", 1.25f); ammoStock.Parent = ammoSlash; ammoStock.SetPoint("bottom left", "bottom left", 3, 0); ammoStock.GlowAlpha = 0; ammoStock.HideWhenInMenu = true; ammoStock.Archived = false; ammoStock.SetText("48"); player.SetField("bohud_ammoStock", new Parameter(ammoStock)); var ammoClip = HudElem.CreateFontString(player, "default", 1.95f); ammoClip.Parent = ammoSlash; ammoClip.SetPoint("right", "right", -7, -4); ammoClip.GlowAlpha = 0; ammoClip.HideWhenInMenu = true; ammoClip.Archived = false; ammoClip.SetText("12"); player.SetField("bohud_ammoClip", new Parameter(ammoClip)); player.SetField("bohud_created", true); }
private void UpdateHUDAmmo(Entity player) { if (!player.HasField("bohud_created")) { return; } if (!player.IsAlive) { return; } var ammoStock = player.GetField<HudElem>("bohud_ammoStock"); var ammoClip = player.GetField<HudElem>("bohud_ammoClip"); var currentWeapon = player.CurrentWeapon; ammoStock.SetText(player.GetWeaponAmmoStock(currentWeapon).ToString()); ammoClip.SetText(player.GetWeaponAmmoClip(currentWeapon).ToString()); }
private void UpdateDisplayScore(Entity player, int rank) { if (!player.HasField("bohud_created")) { return; } var rankTexts = player.GetField<HudElem[]>("bohud_rankText"); rankTexts[0].SetText("^0" + rank.ToString()); rankTexts[1].SetText("^0" + rank.ToString()); rankTexts[2].SetText(rank.ToString()); if (rank > 9) { rankTexts[0].X = (-26 - 14); rankTexts[1].X = (-26 - 12); rankTexts[2].X = (-26 - 13); } else { rankTexts[0].X = (-26 - 1); rankTexts[1].X = (-26); rankTexts[2].X = (-26 + 1); } }