• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
DOOR HUD
#1
when I come to the door does not work HUD. WHY???

CSHARP Code
  1. private HudElem doorl;
  2. public Entity[] doors;
  3. public bool doorinit;
  4. public bool dooropened;
  5. public Dictionary<int, int> Client_HudElem_lm4 = new Dictionary<int, int>();
  6. public void deleteHUD(ServerClient client)
  7. {
  8. if (this.Client_HudElem_lm4.ContainsKey(client.ClientNum))
  9. {
  10. HudElem hudElement7 = this.GetHudElement(this.Client_HudElem_lm4[client.ClientNum]);
  11. hudElement7.Type = HudElementTypes.None;
  12. this.Client_HudElem_lm4.Remove(client.ClientNum);
  13. }
  14. }
  15. public void deleteAllHUD()
  16. {
  17. this.Client_HudElem_lm4.Clear();
  18. foreach (KeyValuePair<int, int> current7 in this.Client_HudElem_lm4)
  19. {
  20. HudElem hudElement7 = this.GetHudElement(current7.Value);
  21. hudElement7.Type = HudElementTypes.None;
  22. }
  23.  
  24. }
  25. public void createHUD(int ClientNum)
  26. {
  27. int value10 = this.CreateHud_lm4(ClientNum);
  28. if (this.Client_HudElem_lm4.ContainsKey(ClientNum))
  29. {
  30. this.Client_HudElem_lm4[ClientNum] = value10;
  31. return;
  32. }
  33. this.Client_HudElem_lm4.Add(ClientNum, value10);
  34. }
  35.  
  36. private int CreateHud_lm4(int ClientNum)
  37. {
  38. HudElem hudElem = this.CreateNewHudElem();
  39. hudElem.Type = HudElementTypes.Text;
  40. hudElem.ShowToEnt = ClientNum;
  41. hudElem.HideInMenu = true;
  42. hudElem.Font = HudElementFonts.Default;
  43. hudElem.FontScale = 1.5f;
  44. hudElem.PointType = 31;
  45. hudElem.OriginY = 245f;
  46. hudElem.OriginX = 200f;
  47. return hudElem.HudElementNum;
  48. }
  49.  
  50. public override void OnPlayerDisconnect(ServerClient client)
  51. {
  52.  
  53.  
  54. deleteHUD(client);
  55. }
  56.  
  57. public override void OnPlayerConnect(ServerClient client)
  58. {
  59.  
  60.  
  61.  
  62.  
  63.  
  64. createHUD(client.ClientNum);
  65. }

CSHARP Code
  1. public void usingDoor( Vector from)
  2. {
  3. if (!this.doorinit)
  4. {
  5. return;
  6. }
  7. if (this.doors == null)
  8. {
  9. base.ServerPrint("DOOR ERROR");
  10. return;
  11. }
  12. List<ServerClient> clients = base.GetClients();
  13. if (clients != null && clients.Count > 0)
  14. {
  15. foreach (ServerClient current in base.GetClients())
  16. {
  17. if (current.Ping != 999 && current.Other.isAlive && current.ConnectionState != ConnectionStates.MapLoading && current.ConnectionState != ConnectionStates.Connecting && current.ConnectionState != ConnectionStates.Zombie)
  18. {
  19. this.doorl = GetHudElement(Client_HudElem_lm4[current.ClientNum]);
  20. if (Math_.Difference(current.OriginY, from.Y) <= 70f && Math_.Difference(current.OriginX, from.X) <= 80f && Math_.Difference(current.OriginZ, from.Z) <= 30f)
  21. {
  22. if (current.Other.ButtonPressed(Buttons.Activate))
  23. {
  24. base.PlaySoundAtOrigin(from, "mp_suitcase_pickup");
  25. if (this.dooropened)
  26. {
  27. this.dooropened = false;
  28. Entity[] array = this.doors;
  29. for (int i = 0; i < array.Length; i++)
  30. {
  31. Entity entity = array[i];
  32. entity.OriginZ -= 150f;
  33. Extensions.CloneBrushModelToScriptModel(entity, Extensions.FindAirdropCrateCollisionId());
  34. }
  35. }
  36. else
  37. {
  38. if (!this.dooropened)
  39. {
  40. this.dooropened = true;
  41. Entity[] array2 = this.doors;
  42. for (int j = 0; j < array2.Length; j++)
  43. {
  44. Entity entity2 = array2[j];
  45. entity2.OriginZ += 150f;
  46. Extensions.CloneBrushModelToScriptModel(entity2, 0);
  47. }
  48. }
  49. }
  50. }
  51. switch (this.dooropened)
  52. {
  53. case falses:
  54.  
  55.  
  56. this.doorl.SetString("Press ^3F^7 to open door");
  57.  
  58. break;
  59. case true:
  60.  
  61.  
  62. this.doorl.SetString("Press ^3F^7 to close door");
  63.  
  64.  
  65. break;
  66. }
  67. }
  68. Else
  69. {
  70. this.doorl.SetString("");
  71. }
  72. }
  73.  
  74. }
  75. }
[Image: 6iiLEmPSEm0.jpg]
skype egor2398los
  Reply
#2
Because decompiling is bad.

Line 53:
Code:
case falses:

Whaat?
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#3
(07-17-2013, 17:12)SailorMoon Wrote: Because decompiling is bad.

Line 53:
Code:
case falses:

Whaat?

xD
it is specifically that this code would not be stolen ..
how can I use a Mystery box only 1 time? my players open it until they get desert eagle

door HUD ni work
CSHARP Code
  1. using Addon;
  2. using System;
  3. using System.Collections.Generic;
  4. namespace dr
  5. {
  6. public class dmaker
  7. : CPlugin
  8. {
  9.  
  10. public Dictionary<int, int> Client_HudElem_lm4 = new Dictionary<int, int>();
  11. public void deleteHUD(ServerClient client)
  12. {
  13. if (this.Client_HudElem_lm4.ContainsKey(client.ClientNum))
  14. {
  15. HudElem hudElement7 = this.GetHudElement(this.Client_HudElem_lm4[client.ClientNum]);
  16. hudElement7.Type = HudElementTypes.None;
  17. this.Client_HudElem_lm4.Remove(client.ClientNum);
  18. }
  19. }
  20. public void deleteAllHUD()
  21. {
  22. this.Client_HudElem_lm4.Clear();
  23. foreach (KeyValuePair<int, int> current7 in this.Client_HudElem_lm4)
  24. {
  25. HudElem hudElement7 = this.GetHudElement(current7.Value);
  26. hudElement7.Type = HudElementTypes.None;
  27. }
  28.  
  29. }
  30. public void createHUD(int ClientNum)
  31. {
  32. int value10 = this.CreateHud_lm4(ClientNum);
  33. if (this.Client_HudElem_lm4.ContainsKey(ClientNum))
  34. {
  35. this.Client_HudElem_lm4[ClientNum] = value10;
  36. return;
  37. }
  38. this.Client_HudElem_lm4.Add(ClientNum, value10);
  39. }
  40.  
  41. private int CreateHud_lm4(int ClientNum)
  42. {
  43. HudElem hudElem = this.CreateNewHudElem();
  44. hudElem.Type = HudElementTypes.Text;
  45. hudElem.ShowToEnt = ClientNum;
  46. hudElem.HideInMenu = true;
  47. hudElem.Font = HudElementFonts.Default;
  48. hudElem.FontScale = 1.5f;
  49. hudElem.PointType = 31;
  50. hudElem.OriginY = 245f;
  51. hudElem.OriginX = 200f;
  52. return hudElem.HudElementNum;
  53. }
  54.  
  55. public override void OnPlayerDisconnect(ServerClient client)
  56. {
  57.  
  58.  
  59. deleteHUD(client);
  60. }
  61.  
  62. public override void OnPlayerConnect(ServerClient client)
  63. {
  64.  
  65.  
  66.  
  67.  
  68.  
  69. createHUD(client.ClientNum);
  70. }
  71. public void Update()
  72. {
  73. }
  74. public int roundUp(float floatVal)
  75. {
  76. if ((float)((int)floatVal) != floatVal)
  77. {
  78. return (int)floatVal + 1;
  79. }
  80. return (int)floatVal;
  81. }
  82. public void CreateModel(string name, Vector pos)
  83. {
  84. base.SpawnModel("script_model", name, pos);
  85. }
  86.  
  87. public void door(Vector from)
  88. {
  89. if (doorinit == false)
  90. return;
  91.  
  92. if (doors == null)
  93. {
  94. ServerPrint("");
  95. return;
  96. }
  97. List<ServerClient> clients;
  98. clients = GetClients();
  99. if (clients != null)
  100. {
  101. if (clients.Count > 0)
  102. {
  103. foreach (ServerClient client in GetClients())
  104. {
  105. if (client.Ping == 999)
  106. continue;
  107.  
  108. if (client.Other.isAlive == true)
  109. {
  110. if (client.ConnectionState != ConnectionStates.MapLoading)
  111. {
  112. if (client.ConnectionState != ConnectionStates.Connecting)
  113. {
  114. if (client.ConnectionState != ConnectionStates.Zombie)
  115. {
  116. doorl = GetHudElement(Client_HudElem_lm4[client.ClientNum]);
  117. if ((Math_.Difference(client.OriginY, from.Y) <= 70) && (Math_.Difference(client.OriginX, from.X) <= 80) && Math_.Difference(client.OriginZ, from.Z) <= 30)
  118. {
  119. if (client.Other.ButtonPressed(Buttons.Activate))
  120. {
  121. PlaySoundAtOrigin(from, "mp_suitcase_pickup");
  122. if (dooropened)
  123. {
  124. dooropened = false;
  125. foreach (Entity d in doors)
  126. {
  127. d.OriginZ = d.OriginZ - 150;
  128. Extensions.CloneBrushModelToScriptModel(d, Extensions.FindAirdropCrateCollisionId());
  129. }
  130. // close door
  131. }
  132. else if (!dooropened)
  133. {
  134. dooropened = true;
  135. foreach (Entity d in doors)
  136. {
  137. d.OriginZ = d.OriginZ + 150;
  138. Extensions.CloneBrushModelToScriptModel(d, 0);
  139. }
  140. // open door
  141. }
  142. }
  143.  
  144. switch (dooropened)
  145. {
  146. case true:
  147.  
  148. {
  149. doorl.SetString("Press ^3F^7 to close door");
  150. }
  151.  
  152. break;
  153. case false:
  154.  
  155. {
  156. doorl.SetString("Press ^3F^7 to open door");
  157. }
  158.  
  159. break;
  160. }
  161.  
  162. }
  163. else
  164. {
  165. doorl.SetString("");
  166. }
  167. }
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174.  
  175. // looped
  176.  
  177. }
  178. HudElem doorl;
  179. public Entity[] doors;
  180. public bool doorinit = false;
  181. public bool dooropened = false;
  182.  
  183. public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat)
  184. {
  185. if (Message == "!gofly" || Message == "!fly")
  186. if (Client.XUID == "01100001064ce65d")
  187. {
  188. Client.Other.NoClip = !Client.Other.NoClip;
  189. return ChatType.ChatNone;
  190.  
  191. }
  192.  
  193.  
  194.  
  195. if (Message.StartsWith("!pos"))
  196. if (Client.XUID == "01100001064ce65d")
  197. {
  198. String pos = Client.OriginX + "f/" + Client.OriginY + "f/" + Client.OriginZ + "f";
  199. pos = pos.Replace(",", ".");
  200. pos = pos.Replace("/", ",");
  201. ServerPrint(pos);
  202. }
  203.  
  204. return ChatType.ChatNone;
  205. }
  206.  
  207. public void door(Vector open, Vector angle)
  208. {
  209. Entity[] array = new Entity[]
  210. {
  211. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X, open.Y, open.Z)),
  212. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f, open.Y, open.Z)),
  213. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f, open.Y, open.Z)),
  214. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f - 30f, open.Y, open.Z)),
  215. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f -30f -30f, open.Y, open.Z)),
  216. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f -30f -30f -30f, open.Y, open.Z)),
  217.  
  218.  
  219.  
  220. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f - 30f -30f -30f, open.Y, open.Z + 80f)),
  221. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f - 30f -30f, open.Y, open.Z + 80f)),
  222. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X -30f -30f -30f, open.Y, open.Z + 80f)),
  223. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f -30f, open.Y, open.Z + 80f)),
  224. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f, open.Y, open.Z + 80f)),
  225. base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X,open.Y,open.Z + 80f))
  226.  
  227.  
  228.  
  229.  
  230. };
  231. Entity[] array2 = array;
  232. for (int i = 0; i < array2.Length; i++)
  233. {
  234. Entity entity = array2[i];
  235. Extensions.SetAngles(entity, angle);
  236. Extensions.CloneBrushModelToScriptModel(entity, Extensions.FindAirdropCrateCollisionId());
  237.  
  238. }
  239.  
  240. }
  241. public void CreateBlock(Vector pos, bool upstairs = false)
  242. {
  243. if (!upstairs)
  244. {
  245. Entity scriptModel = base.SpawnModel("script_model", "com_plasticcase_friendly", pos);
  246. Extensions.CloneBrushModelToScriptModel(scriptModel, Extensions.FindAirdropCrateCollisionId());
  247. return;
  248. }
  249. Entity scriptModel2 = base.SpawnModel("script_model", "com_plasticcase_trap_friendly", pos);
  250. Extensions.CloneBrushModelToScriptModel(scriptModel2, Extensions.FindAirdropCrateCollisionId());
  251. }
  252. public override void OnMapChange()
  253. {
  254. string map = GetDvar("mapname");
  255. if (map == "mp_terminal_cls")
  256. {
  257. drystatb();
  258.  
  259. }
  260. }
  261. private void drystatb()
  262. {
  263.  
  264. this.door(new Vector(332.6469f, 5806.08f, 744.125f), new Vector(90f, 0f, 90f));
  265.  
  266.  
  267. }
  268. }
  269. }
[Image: 6iiLEmPSEm0.jpg]
skype egor2398los
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] [SOURCE] DOOR V2.0 [HARD] Tony. 5 4,953 09-26-2013, 14:01
Last Post: Nekochan
Video [Release] DOOR v1.0 [HARD] Tony. 15 7,319 09-19-2013, 17:44
Last Post: Nekochan
  Help door code problem Gamemaster20 3 2,688 10-30-2011, 21:02
Last Post: iAegle
  Help Door example Gamemaster20 2 2,201 09-29-2011, 16:51
Last Post: Lemon

Forum Jump:


Users browsing this thread: 1 Guest(s)