Hud Elements Tutorial
#1
Can Somebody make a tutorial for Grandma about How to make Hud elements and how to customize them? please? Happy cry

i just couldnt get enough in http://www.itsmods.com/forum/Thread-Rele...verAd.html
Reply

#2
Code:
using System.Threading; using System; using System.Collections.Generic; using System.Text; using Addon; namespace PimpItUp { class HUDManager { public static Dictionary<string, HudElem> HUDs = new Dictionary<string, HudElem>(); public static Dictionary<string, HudElem> Messages = new Dictionary<string, HudElem>(); public static Dictionary<string, HudElem> Icons = new Dictionary<string, HudElem>(); public static Dictionary<string, HudElem> Logos = new Dictionary<string, HudElem>(); public static Dictionary<string, HudElem> Taglines = new Dictionary<string, HudElem>(); public static void AddClient(ServerClient cl) { InitHUD(cl); } static HudElem DefaultProcedure(HudElem ele, ServerClient cl) { ele.Team = cl.Team; ele.ShowToEnt = cl.ClientNum; ele.HideInMenu = true; return ele; } public static void InitHUD(ServerClient cl) { //create 2 elements for this new user try { Debug.WriteLine("HUD init"); if (HUDs.ContainsKey(cl.XUID) && Messages.ContainsKey(cl.XUID) && Icons.ContainsKey(cl.XUID)) { Debug.WriteLine("Removing old HudElems for client " + cl.ClientNum); RemoveClient(cl); } HudElem HUD = Core.Main.CreateNewHudElem(); HUD = DefaultProcedure(HUD, cl); HUD.Font = HudElementFonts.HudMedium; HUD.Type = HudElementTypes.Text; HUD.SetLabel("Upgrade 0/5"); HUD.FontScale = 1.6f; HUD.PointType = 81; HUD.OriginY = 75f; HUD.OriginX = 10f; HUD.Color.R = 255; HUD.Color.GlowR = 255; HUD.Color.GlowA = 255; HudElem Icon = Core.Main.CreateNewHudElem(); Icon = DefaultProcedure(Icon, cl); Icon.Type = HudElementTypes.Icon; //Icon.SetIcon("iw5_cardicon_cat"); Icon.IconHeight = 64; Icon.IconWidth = 64; HudElem Logo = Core.Main.CreateNewHudElem(); Logo = DefaultProcedure(Icon, cl); Logo.Type = HudElementTypes.Text; Logo.Font = HudElementFonts.ModernBold; Logo.Color.GlowA = 200; //not that intense Logo.Color.GlowG = 200; Logo.FontScale = 1.6f; Logo.PointType = 123; Logo.OriginX = 255; Logo.SetLabel("PimpItUp"); HudElem Tagline = Core.Main.CreateNewHudElem(); Tagline = DefaultProcedure(Tagline, cl); Tagline.Type = HudElementTypes.Text; Tagline.PointType = 123; Tagline.OriginX = 255; Tagline.OriginY = 30; Tagline.Font = HudElementFonts.Modern; Tagline.FontScale = 0.8f; Tagline.SetLabel("by jariz - itsmods.com"); HudElem Message = Core.Main.CreateNewHudElem(); Message = DefaultProcedure(Message, cl); Message.HideInMenu = false; Message.PointType = 31; //Message.PointType = 113; Message.Type = HudElementTypes.Text; Message.Font = HudElementFonts.Modern; Message.OriginX = 245; //Message.OriginY = 180; Message.OriginY = 200; Message.FontScale = 1; Icons.Add(cl.XUID, Icon); HUDs.Add(cl.XUID, HUD); Messages.Add(cl.XUID, Message); Logos.Add(cl.XUID, Logo); Taglines.Add(cl.XUID, Tagline); } catch (Exception z) { Core.Main.ServerPrint("[PIU] Failed initializing HUD: " + z.ToString()); if (Debug.DEV) Core.Main.TellClient(cl.ClientNum, "Failed initializing HUD: ^1" + z.Message, true); } } public static void UpdateHUD(ServerClient cl, Upgrade.Rank rank) { int totalrank = 5; byte green = Convert.ToByte((255 / totalrank) * (int)rank); byte red = Convert.ToByte((255 - (255 / totalrank) * (int)rank)); Debug.WriteLine("green = " + green); HudElem HUD = HUDs[cl.XUID]; HUD.Color.GlowG = green; HUD.Color.GlowR = red; HUD.Color.GlowB = 0; HUD.Color.GlowA = 255; HUD.SetLabel("Upgrade " + Convert.ToInt32(rank) + "/5"); ShowMessage(cl, "WEAPON UPGRADED!"); } static void MessageThread(object rHUD) { HudElem HUD = (HudElem)rHUD; while (HUD.Color.A != 250) { HUD.Color.A += 25; Thread.Sleep(100); } HUD.Color.A = 255; Thread.Sleep(3000); HUD.SetLabel(""); } public static void RemoveClient(ServerClient cl) { Messages[cl.XUID].ShowToEnt = 255; HUDs[cl.XUID].ShowToEnt = 255; Icons[cl.XUID].ShowToEnt = 255; Logos[cl.XUID].ShowToEnt = 255; Taglines[cl.XUID].ShowToEnt = 255; Messages.Remove(cl.XUID); HUDs.Remove(cl.XUID); Icons.Remove(cl.XUID); Logos.Remove(cl.XUID); Taglines.Remove(cl.XUID); } public static void ShowMessage(ServerClient cl, string message) { HudElem HUD = Messages[cl.XUID]; HUD.SetLabel(message); HUD.FontScale = 1; HUD.Color.A = 0; HUD.Color.R = 240; HUD.Color.G = 214; HUD.Color.B = 106; ThreadPool.QueueUserWorkItem(new WaitCallback(MessageThread), HUD); } } }
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  TUTORIAL CHEAT ENGINE for mw3 [HARD] Tony. 5 6,799 10-24-2013, 15:22
Last Post: Tomsen1410
  How to delete HUD elements on death? camxxcore 6 7,162 08-21-2013, 08:54
Last Post: Yamato
Question Tutorial addon! [HARD] Tony. 2 4,207 04-30-2013, 13:55
Last Post: [HARD] Tony.
  [TUTORIAL] Various Statements KrypTiK 2 4,500 01-07-2013, 21:00
Last Post: kokole
  Help Game Programming Tutorial Ich1994 8 6,920 01-01-2013, 21:21
Last Post: Ich1994
  [TUTORIAL] C# Introduction KrypTiK 4 5,009 12-30-2012, 10:06
Last Post: KrypTiK
  [TUTORIAL] Basic Syntax KrypTiK 0 2,951 12-29-2012, 20:33
Last Post: KrypTiK
  [TUTORIAL] Handling Errors in VB.NET KrypTiK 0 3,113 12-29-2012, 20:28
Last Post: KrypTiK
  [TUTORIAL] Getting to know your way around the IDE KrypTiK 0 3,047 12-29-2012, 20:23
Last Post: KrypTiK
  [TUTORIAL] Introduction Into VB.NET KrypTiK 0 2,818 12-29-2012, 20:15
Last Post: KrypTiK

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.