[Release] Alive and Axis (*counter) on HUD
#1
Tongue 
Requirements:
1.413 version of Nukem's add-on

Code:
using System; using System.Collections.Generic; using Addon; namespace ShowAxis { public class Main : CPlugin { private Dictionary<int, int> Client_HudElem_Axis = new Dictionary<int,int>(); private Dictionary<int, int> Client_HudElem_Allies = new Dictionary<int, int>(); private IntPtr Axis { get { return (IntPtr)Convert.ToInt32(28438236); } } private IntPtr Allies { get { return (IntPtr)Convert.ToInt32(28438240); } } private unsafe int GetAxis() { return *(int*)Axis; } private unsafe int GetAllies() { return *(int*)Allies; } public override void OnPlayerConnect(ServerClient Client) { int Allies = CreateHud_Allies(Client.ClientNum); if (Client_HudElem_Allies.ContainsKey(Client.ClientNum)) { Client_HudElem_Allies[Client.ClientNum] = Allies; } else { Client_HudElem_Allies.Add(Client.ClientNum, Allies); } int Axis = CreateHud_Axis(Client.ClientNum); if (Client_HudElem_Axis.ContainsKey(Client.ClientNum)) { Client_HudElem_Axis[Client.ClientNum] = Axis; } else { Client_HudElem_Axis.Add(Client.ClientNum, Axis); } } public override void OnPlayerDisconnect(ServerClient Client) { if (Client_HudElem_Allies.ContainsKey(Client.ClientNum)) { HudElem al = GetHudElement(Client_HudElem_Allies[Client.ClientNum]); al.Type = HudElementTypes.None; Client_HudElem_Allies.Remove(Client.ClientNum); } if (Client_HudElem_Axis.ContainsKey(Client.ClientNum)) { HudElem ax = GetHudElement(Client_HudElem_Axis[Client.ClientNum]); ax.Type = HudElementTypes.None; Client_HudElem_Axis.Remove(Client.ClientNum); } } public override void OnAddonFrame() { List<ServerClient> clients; clients = GetClients(); if (clients != null) { foreach (ServerClient c in clients) { if (Client_HudElem_Allies.ContainsKey(c.ClientNum)) { HudElem allies = GetHudElement(Client_HudElem_Allies[c.ClientNum]); allies.Value = GetAllies(); } if (Client_HudElem_Axis.ContainsKey(c.ClientNum)) { HudElem axis = GetHudElement(Client_HudElem_Axis[c.ClientNum]); axis.Value = GetAxis(); } } } } private int CreateHud_Axis(int ClientNum) { HudElem hud = CreateNewHudElem(); hud.Type = HudElementTypes.Value; hud.ShowToEnt = ClientNum; hud.HideInMenu = true; hud.Font = HudElementFonts.Default; hud.FontScale = 1.3f; hud.PointType = 81; hud.OriginY = 200f; hud.OriginX = 10f; hud.SetLabel("^1Axis:^7 "); return hud.HudElementNum; } private int CreateHud_Allies(int ClientNum) { HudElem hud = CreateNewHudElem(); hud.Type = HudElementTypes.Value; hud.ShowToEnt = ClientNum; hud.HideInMenu = true; hud.Font = HudElementFonts.Default; hud.FontScale = 1.3f; hud.PointType = 81; hud.OriginY = 212f; hud.OriginX = 10f; hud.SetLabel("^2Allies:^7 "); return hud.HudElementNum; } } }

Show Screenshot Smile (Click to View)
[Image: 77c85afda648.gif]
Reply

#2
Nice plugin, maybe not that useful for infected but maybe for some other gametypes.
I don't really understand why you used memory addresses to get it, do they also work for other gametypes?
Btw why did you write the addresses in decimal?
Reply

#3
(10-01-2013, 20:01)8q4s8 Wrote: Nice plugin, maybe not that useful for infected but maybe for some other gametypes.
I don't really understand why you used memory addresses to get it, do they also work for other gametypes?
Btw why did you write the addresses in decimal?

use this...
Code:
int ALLIES = 0, AXIS = 0; ServerClient client = null; for (int i = 0; i < 18; i++) { client = GetClient(i); if (client != null) { if (client.Team == Teams.Allies) { ALLIES++; } else { AXIS++; } } }
[Image: 77c85afda648.gif]
Reply

#4
Yeah, it's better to don't use addresses. By the way, nice plugin. But too much code for this small thingy. :waesome:
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#5
i'd be interested in code for top richest + points
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply

#6
(10-01-2013, 20:38)hillbilly Wrote: i'd be interested in code for top richest

if you have Stats.cs by @Ich1994 ....
Code:
SELECT * FROM Statistics ORDER BY Points DESC LIMIT 0,5

Nyan Cat
[Image: 77c85afda648.gif]
Reply

#7
(10-01-2013, 20:47)xtreme2010 Wrote:
(10-01-2013, 20:38)hillbilly Wrote: i'd be interested in code for top richest

if you have Stats.cs by @Ich1994 ....
Code:
SELECT * FROM Statistics ORDER BY Points DESC LIMIT 0,5

Nyan Cat

And if theyre using a system that saves points into files?

I wish everyone used DBs D:!
Reply

#8
(10-01-2013, 23:20)yokai134 Wrote:
(10-01-2013, 20:47)xtreme2010 Wrote:
(10-01-2013, 20:38)hillbilly Wrote: i'd be interested in code for top richest

if you have Stats.cs by @Ich1994 ....
Code:
SELECT * FROM Statistics ORDER BY Points DESC LIMIT 0,5

Nyan Cat

And if theyre using a system that saves points into files?

I wish everyone used DBs D:!
no, only base .dat
Reply

#9
(10-01-2013, 20:38)hillbilly Wrote: i'd be interested in code for top richest + points

Lazyness ass. Troll
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#10
Ssshh @SailorMoon and be a good boy.
[Image: b_560_95_1.png]


[Image: b_560_95_1.png]

Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] Marauder & Last Alive v 2.0 [HARD] Tony. 16 13,286 03-07-2014, 17:23
Last Post: Slimpy

Forum Jump:


Users browsing this thread:
1 Guest(s)

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