Release [SOURCE] DOOR V2.0
#1
Code:
using System; using System.Collections.Generic; using Addon; using System.Collections; using System.IO; using System.Timers; using System.Runtime.InteropServices; namespace Door { public class Door : CPlugin { Dictionary<int, int> Client_HudElem_lm = new Dictionary<int, int>(); int fx = 0; enum DoorState { Button, Top, Destroy }; public int DoorHealth = 750; int Interval = 0; public int State = 0; public bool DoorWork = false; List<Entity> Boxes = new List<Entity>(); public override void OnServerLoad() { Th.Elapsed += new ElapsedEventHandler(Event); Th.Interval = 150; } Timer Th = new Timer(); int Counter = 0; public override void OnMapChange() { Counter = 0; Th.Stop(); Boxes.Clear(); Interval = 0; DoorHealth = 100; State = 0; DoorWork = false; string map = GetDvar("mapname"); if (map == "mp_lambeth") { Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(2850f, 703.719f, -281.875f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(2850f, 703.583f, -210.0819f))); for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], Extensions.FindAirdropCrateCollisionId()); } } if (map == "mp_lambeth") { Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(1887.093f, -520.5082f, -241.7929f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(1890.825f, -520.6057f, -172.9306f))); for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], Extensions.FindAirdropCrateCollisionId()); Vector vector = Extensions.GetAngles(Boxes[i]); vector.Y += 90; Extensions.SetAngles(Boxes[i], vector); } } if (map == "mp_terminal_cls") { Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3861.388f, 3538.042f, 204.125f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3861.388f, 3481.042f, 204.125f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3861.388f, 3424.042f, 204.125f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3861.388f, 3538.042f, 270.125f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3861.388f, 3481.042f, 270.125f))); Boxes.Add(SpawnModel("script_model", "com_plasticcase_trap_friendly", new Vector(3861.388f, 3424.042f, 270.125f))); for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], Extensions.FindAirdropCrateCollisionId()); Vector vector = Extensions.GetAngles(Boxes[i]); vector.Y += 90; Extensions.SetAngles(Boxes[i], vector); } } } public override void OnServerFrame() { if (Interval == 0) { Interval = 10; } else { Interval--; } } public void Event(object source, ElapsedEventArgs e) { //Counter - if (Counter <= 17) { if (State == (int)DoorState.Button) { for (int i = 0; i < Boxes.Count; i++) { // 5 = Z Boxes[i].OriginY += 10; } } else if (State == (int)DoorState.Top) { for (int i = 0; i < Boxes.Count; i++) { Boxes[i].OriginY -= 10; } } Counter++; } else { if (State == (int)DoorState.Button) { State = (int)DoorState.Top; } else { for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], Extensions.FindAirdropCrateCollisionId()); } State = (int)DoorState.Button; } DoorWork = false; Counter = 0; Th.Stop(); } } public override void OnAddonFrame() { List<ServerClient> clients; try { clients = GetClients(); if (clients != null && clients.Count > 0) { foreach (ServerClient c in GetClients()) { if (c.Other.isAlive == true/* && !DoorDestroy*/) { HudElem hl = GetHudElement(Client_HudElem_lm[c.ClientNum]); string map = GetDvar("mapname"); if (map == "mp_lambeth" && State != (int)DoorState.Destroy) { if ((Difference(c.OriginY, 703.0484f) <= 150) && (Difference(c.OriginX, 2850.202f) <= 150) && c.OriginZ >= -306.1291f) { if (c.Team == Teams.Allies) { if (!DoorWork && State == (int)DoorState.Button) { hl.SetString(" ^3F^7 ^1"); } if (!DoorWork && State == (int)DoorState.Top) { hl.SetString(" ^3F^7 ^1"); } if (c.Other.ButtonPressed(Buttons.Activate) && !DoorWork) { if (State == (int)DoorState.Button) { PlaySoundOnPlayer(c, "elev_door_close"); for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], 0); } } if (State == (int)DoorState.Top) { PlaySoundOnPlayer(c, "elev_door_interupt"); } DoorWork = true; Counter = 0; Th.Start(); } } else { hl.SetString(" -^1 ^7!"); if (c.Other.ButtonPressed(Buttons.Knife) && !DoorWork && State == (int)DoorState.Button) { if (DoorHealth > 5) { if (Interval == 0) { DoorHealth -= 5; iPrintLnBold(": ^2 " + DoorHealth, c); } } else { hl.SetString(""); State = (int)DoorState.Destroy; for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], 0); Boxes[i].Delete(); } Boxes.Clear(); } } } } else { hl.SetString(""); } } ///////// if (map == "mp_terminal_cls" && State != (int)DoorState.Destroy) { if ((Difference(c.OriginY, 3490.191f) <= 150) && (Difference(c.OriginX, 3864.955f) <= 150) && c.OriginZ >= 100.125f) { if (c.Team == Teams.Allies) { if (!DoorWork && State == (int)DoorState.Button) { hl.SetString(" ^3F^7 ^1"); } if (!DoorWork && State == (int)DoorState.Top) { hl.SetString(" ^3F^7 ^1"); } if (c.Other.ButtonPressed(Buttons.Activate) && !DoorWork) { if (State == (int)DoorState.Button) { PlaySoundOnPlayer(c, "elev_door_close"); for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], 0); } } if (State == (int)DoorState.Top) { PlaySoundOnPlayer(c, "elev_door_interupt"); } DoorWork = true; Counter = 0; Th.Start(); } } else { hl.SetString(" -^1 ^7!"); if (c.Other.ButtonPressed(Buttons.Knife) && !DoorWork && State == (int)DoorState.Button) { if (DoorHealth > 5) { if (Interval == 0) { DoorHealth -= 5; iPrintLnBold(": ^2 " + DoorHealth, c); } } else { hl.SetString(""); State = (int)DoorState.Destroy; for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], 0); Boxes[i].Delete(); } Boxes.Clear(); } } } } else { hl.SetString(""); } } if (map == "mp_lambeth" && State != (int)DoorState.Destroy) { if ((Difference(c.OriginY, -534.8205f) <= 150) && (Difference(c.OriginX, 1895.324f) <= 150) && c.OriginZ >= -253.5872f) { if (c.Team == Teams.Allies) { if (!DoorWork && State == (int)DoorState.Button) { hl.SetString(" ^3F^7 ^1"); } if (!DoorWork && State == (int)DoorState.Top) { hl.SetString(" ^3F^7 ^1"); } if (c.Other.ButtonPressed(Buttons.Activate) && !DoorWork) { if (State == (int)DoorState.Button) { PlaySoundOnPlayer(c, "elev_door_close"); for (int i = 0; i < Boxes.Count; i++) { Extensions.CloneBrushModelToScriptModel(Boxes[i], 0); } } if (State == (int)DoorState.Top) { PlaySoundOnPlayer(c, "elev_door_interupt"); } DoorWork = true; Counter = 0; Th.Start(); } } else { hl.SetString(" -^1 ^7!"); if (c.Other.ButtonPressed(Buttons.Knife) && !DoorWork && State == (int)DoorState.Button) { if (DoorHealth > 3) { if (Interval == 0) { ; DoorHealth -= 3; iPrintLnBold(": ^2 " + DoorHealth, c); } } else { hl.SetString(""); State = (int)DoorState.Destroy; for (int i = 0; i < Boxes.Count; i++) { Extensions.PlayFX(fx, new Vector(1895.324f, -534.8205f, -253.5872f)); Extensions.CloneBrushModelToScriptModel(Boxes[i], 0); Boxes[i].Delete(); } Boxes.Clear(); } } } } else { hl.SetString(""); } } } } } } catch (Exception z) { ServerPrint("Error Doors: " + z.Message); } } public static float Difference(float loc, float loc2) { return Math.Abs(loc - loc2); } public override void OnPlayerDisconnect(ServerClient client) { if (Client_HudElem_lm.ContainsKey(client.ClientNum)) { HudElem info2 = GetHudElement(Client_HudElem_lm[client.ClientNum]); info2.Type = HudElementTypes.None; Client_HudElem_lm.Remove(client.ClientNum); } } public override void OnPlayerConnect(ServerClient client) { int HudElemNum1 = CreateHud_lm(client.ClientNum); if (Client_HudElem_lm.ContainsKey(client.ClientNum)) { Client_HudElem_lm[client.ClientNum] = HudElemNum1; } else { Client_HudElem_lm.Add(client.ClientNum, HudElemNum1); } } private int CreateHud_lm(int ClientNum) { HudElem hud = CreateNewHudElem(); hud.Type = HudElementTypes.Text; hud.ShowToEnt = ClientNum; hud.HideInMenu = true; hud.Font = HudElementFonts.Default; hud.FontScale = 1.7f; hud.PointType = 120; hud.OriginY = 180f; hud.OriginX = -100f; hud.SetString(""); return hud.HudElementNum; } } }
powered by www.forum.hard-zombie.com
idea @[Z00MBY] Alex
help @extreme2010 (aka [MEM] So Close )
main @master131
creator http://www.forum.hard-zombie.com
Reply

#2
:trollface:
Reply

#3
(09-26-2013, 02:00)Slimpy Wrote: :trollface:

Troll
Reply

#4
Another stolen code. Troll

Code:
ClientHud_lm
^ this method is from my Killmz mod. That means 'lowermessage'.......
Also please, I recommend you to make this code look more beauty & organised.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#5
it is removed
Reply

#6
(09-26-2013, 13:53)[HARD] Tony. Wrote:
(09-26-2013, 12:14)SailorMoon Wrote: Another stolen code. Troll

Code:
ClientHud_lm
^ this method is from my Killmz mod. That means 'lowermessage'.......
Also please, I recommend you to make this code look more beauty & organised.

LAZY (((66(((6((,(6(
lazy lazy
Lazy Lazyzyxyxyxylaztuzlazy

@Retarded Guy
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] [SOURCE] Random Weapons. [HARD] Tony. 1 6,154 11-08-2013, 11:11
Last Post: Nekochan
  Help source random weapons [HARD] Tony. 4 6,567 11-08-2013, 05:25
Last Post: [HARD] Tony.
  [Request] Health and Points on hud source robinvm 7 8,181 10-27-2013, 08:23
Last Post: robinvm
Video [Release] DOOR v1.0 [HARD] Tony. 15 11,708 09-19-2013, 17:44
Last Post: Nekochan
  [source] medic E-losev 6 7,550 07-26-2013, 06:18
Last Post: E-losev
  [source] vAmpIr E-losev 5 6,776 07-25-2013, 16:28
Last Post: Bandarigoda123
  DOOR HUD E-losev 2 4,315 07-17-2013, 17:50
Last Post: E-losev
  [Release] Barata's REAL External Console Source C# barata 37 30,161 06-28-2013, 23:47
Last Post: barata
  [Release] Shoutbot + source JariZ 11 10,354 04-05-2013, 18:15
Last Post: SuperNovaAO
Rainbow [News] Valve strikes again (Source Filmmaker) estebespt 25 18,711 04-05-2013, 18:15
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread:
1 Guest(s)

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