Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Release] Alive and Axis (*counter) on HUD
#1
Tongue 
Requirements:
1.413 version of Nukem's add-on

CSHARP Code
  1. using System;
  2. using System.Collections.Generic;
  3. using Addon;
  4.  
  5. namespace ShowAxis
  6. {
  7. public class Main : CPlugin
  8. {
  9. private Dictionary<int, int> Client_HudElem_Axis = new Dictionary<int,int>();
  10. private Dictionary<int, int> Client_HudElem_Allies = new Dictionary<int, int>();
  11.  
  12. private IntPtr Axis
  13. {
  14. get
  15. {
  16. return (IntPtr)Convert.ToInt32(28438236);
  17. }
  18. }
  19.  
  20. private IntPtr Allies
  21. {
  22. get
  23. {
  24. return (IntPtr)Convert.ToInt32(28438240);
  25. }
  26. }
  27.  
  28. private unsafe int GetAxis()
  29. {
  30. return *(int*)Axis;
  31. }
  32.  
  33. private unsafe int GetAllies()
  34. {
  35. return *(int*)Allies;
  36. }
  37.  
  38. public override void OnPlayerConnect(ServerClient Client)
  39. {
  40. int Allies = CreateHud_Allies(Client.ClientNum);
  41. if (Client_HudElem_Allies.ContainsKey(Client.ClientNum))
  42. {
  43. Client_HudElem_Allies[Client.ClientNum] = Allies;
  44. }
  45. else
  46. {
  47. Client_HudElem_Allies.Add(Client.ClientNum, Allies);
  48. }
  49. int Axis = CreateHud_Axis(Client.ClientNum);
  50. if (Client_HudElem_Axis.ContainsKey(Client.ClientNum))
  51. {
  52. Client_HudElem_Axis[Client.ClientNum] = Axis;
  53. }
  54. else
  55. {
  56. Client_HudElem_Axis.Add(Client.ClientNum, Axis);
  57. }
  58. }
  59.  
  60. public override void OnPlayerDisconnect(ServerClient Client)
  61. {
  62. if (Client_HudElem_Allies.ContainsKey(Client.ClientNum))
  63. {
  64. HudElem al = GetHudElement(Client_HudElem_Allies[Client.ClientNum]);
  65. al.Type = HudElementTypes.None;
  66. Client_HudElem_Allies.Remove(Client.ClientNum);
  67. }
  68. if (Client_HudElem_Axis.ContainsKey(Client.ClientNum))
  69. {
  70. HudElem ax = GetHudElement(Client_HudElem_Axis[Client.ClientNum]);
  71. ax.Type = HudElementTypes.None;
  72. Client_HudElem_Axis.Remove(Client.ClientNum);
  73. }
  74. }
  75.  
  76. public override void OnAddonFrame()
  77. {
  78. List<ServerClient> clients;
  79. clients = GetClients();
  80. if (clients != null)
  81. {
  82. foreach (ServerClient c in clients)
  83. {
  84. if (Client_HudElem_Allies.ContainsKey(c.ClientNum))
  85. {
  86. HudElem allies = GetHudElement(Client_HudElem_Allies[c.ClientNum]);
  87. allies.Value = GetAllies();
  88. }
  89. if (Client_HudElem_Axis.ContainsKey(c.ClientNum))
  90. {
  91. HudElem axis = GetHudElement(Client_HudElem_Axis[c.ClientNum]);
  92. axis.Value = GetAxis();
  93. }
  94. }
  95. }
  96. }
  97.  
  98. private int CreateHud_Axis(int ClientNum)
  99. {
  100. HudElem hud = CreateNewHudElem();
  101. hud.Type = HudElementTypes.Value;
  102. hud.ShowToEnt = ClientNum;
  103. hud.HideInMenu = true;
  104. hud.Font = HudElementFonts.Default;
  105. hud.FontScale = 1.3f;
  106. hud.PointType = 81;
  107. hud.OriginY = 200f;
  108. hud.OriginX = 10f;
  109. hud.SetLabel("^1Axis:^7 ");
  110. return hud.HudElementNum;
  111. }
  112.  
  113. private int CreateHud_Allies(int ClientNum)
  114. {
  115. HudElem hud = CreateNewHudElem();
  116. hud.Type = HudElementTypes.Value;
  117. hud.ShowToEnt = ClientNum;
  118. hud.HideInMenu = true;
  119. hud.Font = HudElementFonts.Default;
  120. hud.FontScale = 1.3f;
  121. hud.PointType = 81;
  122. hud.OriginY = 212f;
  123. hud.OriginX = 10f;
  124. hud.SetLabel("^2Allies:^7 ");
  125. return hud.HudElementNum;
  126. }
  127. }
  128. }


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...
CSHARP Code
  1. int ALLIES = 0, AXIS = 0;
  2. ServerClient client = null;
  3. for (int i = 0; i < 18; i++)
  4. {
  5. client = GetClient(i);
  6. if (client != null)
  7. {
  8. if (client.Team == Teams.Allies)
  9. {
  10. ALLIES++;
  11. }
  12. else
  13. {
  14. AXIS++;
  15. }
  16. }
  17. }
[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 ....
MYSQL Code
  1. SELECT * FROM Statistics
  2. 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 ....
MYSQL Code
  1. SELECT * FROM Statistics
  2. 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 ....
MYSQL Code
  1. SELECT * FROM Statistics
  2. 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 10,277 03-07-2014, 17:23
Last Post: Slimpy

Forum Jump:


Users browsing this thread:
2 Guest(s)

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