![]() |
|
DOOR HUD - Printable Version +- ItsMods (https://www.itsmods.com) +-- Forum: Archive (https://www.itsmods.com/Forum-Archive.html) +--- Forum: Archive (https://www.itsmods.com/Forum-Archive--64.html) +--- Thread: DOOR HUD (/Thread-DOOR-HUD.html) |
DOOR HUD - E-losev - 07-17-2013 when I come to the door does not work HUD. WHY??? Code: private HudElem doorl;
public Entity[] doors;
public bool doorinit;
public bool dooropened;
public Dictionary<int, int> Client_HudElem_lm4 = new Dictionary<int, int>();
public void deleteHUD(ServerClient client)
{
if (this.Client_HudElem_lm4.ContainsKey(client.ClientNum))
{
HudElem hudElement7 = this.GetHudElement(this.Client_HudElem_lm4[client.ClientNum]);
hudElement7.Type = HudElementTypes.None;
this.Client_HudElem_lm4.Remove(client.ClientNum);
}
}
public void deleteAllHUD()
{
this.Client_HudElem_lm4.Clear();
foreach (KeyValuePair<int, int> current7 in this.Client_HudElem_lm4)
{
HudElem hudElement7 = this.GetHudElement(current7.Value);
hudElement7.Type = HudElementTypes.None;
}
}
public void createHUD(int ClientNum)
{
int value10 = this.CreateHud_lm4(ClientNum);
if (this.Client_HudElem_lm4.ContainsKey(ClientNum))
{
this.Client_HudElem_lm4[ClientNum] = value10;
return;
}
this.Client_HudElem_lm4.Add(ClientNum, value10);
}
private int CreateHud_lm4(int ClientNum)
{
HudElem hudElem = this.CreateNewHudElem();
hudElem.Type = HudElementTypes.Text;
hudElem.ShowToEnt = ClientNum;
hudElem.HideInMenu = true;
hudElem.Font = HudElementFonts.Default;
hudElem.FontScale = 1.5f;
hudElem.PointType = 31;
hudElem.OriginY = 245f;
hudElem.OriginX = 200f;
return hudElem.HudElementNum;
}
public override void OnPlayerDisconnect(ServerClient client)
{
deleteHUD(client);
}
public override void OnPlayerConnect(ServerClient client)
{
createHUD(client.ClientNum);
}Code: public void usingDoor( Vector from)
{
if (!this.doorinit)
{
return;
}
if (this.doors == null)
{
base.ServerPrint("DOOR ERROR");
return;
}
List<ServerClient> clients = base.GetClients();
if (clients != null && clients.Count > 0)
{
foreach (ServerClient current in base.GetClients())
{
if (current.Ping != 999 && current.Other.isAlive && current.ConnectionState != ConnectionStates.MapLoading && current.ConnectionState != ConnectionStates.Connecting && current.ConnectionState != ConnectionStates.Zombie)
{
this.doorl = GetHudElement(Client_HudElem_lm4[current.ClientNum]);
if (Math_.Difference(current.OriginY, from.Y) <= 70f && Math_.Difference(current.OriginX, from.X) <= 80f && Math_.Difference(current.OriginZ, from.Z) <= 30f)
{
if (current.Other.ButtonPressed(Buttons.Activate))
{
base.PlaySoundAtOrigin(from, "mp_suitcase_pickup");
if (this.dooropened)
{
this.dooropened = false;
Entity[] array = this.doors;
for (int i = 0; i < array.Length; i++)
{
Entity entity = array[i];
entity.OriginZ -= 150f;
Extensions.CloneBrushModelToScriptModel(entity, Extensions.FindAirdropCrateCollisionId());
}
}
else
{
if (!this.dooropened)
{
this.dooropened = true;
Entity[] array2 = this.doors;
for (int j = 0; j < array2.Length; j++)
{
Entity entity2 = array2[j];
entity2.OriginZ += 150f;
Extensions.CloneBrushModelToScriptModel(entity2, 0);
}
}
}
}
switch (this.dooropened)
{
case falses:
this.doorl.SetString("Press ^3F^7 to open door");
break;
case true:
this.doorl.SetString("Press ^3F^7 to close door");
break;
}
}
Else
{
this.doorl.SetString("");
}
}
}
}RE: DOOR HUD - Nekochan - 07-17-2013 Because decompiling is bad. Line 53: Code: case falses:Whaat? RE: DOOR HUD - E-losev - 07-17-2013 (07-17-2013, 17:12)SailorMoon Wrote: Because decompiling is bad. 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 Code: using Addon;
using System;
using System.Collections.Generic;
namespace dr
{
public class dmaker
: CPlugin
{
public Dictionary<int, int> Client_HudElem_lm4 = new Dictionary<int, int>();
public void deleteHUD(ServerClient client)
{
if (this.Client_HudElem_lm4.ContainsKey(client.ClientNum))
{
HudElem hudElement7 = this.GetHudElement(this.Client_HudElem_lm4[client.ClientNum]);
hudElement7.Type = HudElementTypes.None;
this.Client_HudElem_lm4.Remove(client.ClientNum);
}
}
public void deleteAllHUD()
{
this.Client_HudElem_lm4.Clear();
foreach (KeyValuePair<int, int> current7 in this.Client_HudElem_lm4)
{
HudElem hudElement7 = this.GetHudElement(current7.Value);
hudElement7.Type = HudElementTypes.None;
}
}
public void createHUD(int ClientNum)
{
int value10 = this.CreateHud_lm4(ClientNum);
if (this.Client_HudElem_lm4.ContainsKey(ClientNum))
{
this.Client_HudElem_lm4[ClientNum] = value10;
return;
}
this.Client_HudElem_lm4.Add(ClientNum, value10);
}
private int CreateHud_lm4(int ClientNum)
{
HudElem hudElem = this.CreateNewHudElem();
hudElem.Type = HudElementTypes.Text;
hudElem.ShowToEnt = ClientNum;
hudElem.HideInMenu = true;
hudElem.Font = HudElementFonts.Default;
hudElem.FontScale = 1.5f;
hudElem.PointType = 31;
hudElem.OriginY = 245f;
hudElem.OriginX = 200f;
return hudElem.HudElementNum;
}
public override void OnPlayerDisconnect(ServerClient client)
{
deleteHUD(client);
}
public override void OnPlayerConnect(ServerClient client)
{
createHUD(client.ClientNum);
}
public void Update()
{
}
public int roundUp(float floatVal)
{
if ((float)((int)floatVal) != floatVal)
{
return (int)floatVal + 1;
}
return (int)floatVal;
}
public void CreateModel(string name, Vector pos)
{
base.SpawnModel("script_model", name, pos);
}
public void door(Vector from)
{
if (doorinit == false)
return;
if (doors == null)
{
ServerPrint("");
return;
}
List<ServerClient> clients;
clients = GetClients();
if (clients != null)
{
if (clients.Count > 0)
{
foreach (ServerClient client in GetClients())
{
if (client.Ping == 999)
continue;
if (client.Other.isAlive == true)
{
if (client.ConnectionState != ConnectionStates.MapLoading)
{
if (client.ConnectionState != ConnectionStates.Connecting)
{
if (client.ConnectionState != ConnectionStates.Zombie)
{
doorl = GetHudElement(Client_HudElem_lm4[client.ClientNum]);
if ((Math_.Difference(client.OriginY, from.Y) <= 70) && (Math_.Difference(client.OriginX, from.X) <= 80) && Math_.Difference(client.OriginZ, from.Z) <= 30)
{
if (client.Other.ButtonPressed(Buttons.Activate))
{
PlaySoundAtOrigin(from, "mp_suitcase_pickup");
if (dooropened)
{
dooropened = false;
foreach (Entity d in doors)
{
d.OriginZ = d.OriginZ - 150;
Extensions.CloneBrushModelToScriptModel(d, Extensions.FindAirdropCrateCollisionId());
}
// close door
}
else if (!dooropened)
{
dooropened = true;
foreach (Entity d in doors)
{
d.OriginZ = d.OriginZ + 150;
Extensions.CloneBrushModelToScriptModel(d, 0);
}
// open door
}
}
switch (dooropened)
{
case true:
{
doorl.SetString("Press ^3F^7 to close door");
}
break;
case false:
{
doorl.SetString("Press ^3F^7 to open door");
}
break;
}
}
else
{
doorl.SetString("");
}
}
}
}
}
}
}
}
// looped
}
HudElem doorl;
public Entity[] doors;
public bool doorinit = false;
public bool dooropened = false;
public override ChatType OnSay(String Message, ServerClient Client, bool Teamchat)
{
if (Message == "!gofly" || Message == "!fly")
if (Client.XUID == "01100001064ce65d")
{
Client.Other.NoClip = !Client.Other.NoClip;
return ChatType.ChatNone;
}
if (Message.StartsWith("!pos"))
if (Client.XUID == "01100001064ce65d")
{
String pos = Client.OriginX + "f/" + Client.OriginY + "f/" + Client.OriginZ + "f";
pos = pos.Replace(",", ".");
pos = pos.Replace("/", ",");
ServerPrint(pos);
}
return ChatType.ChatNone;
}
public void door(Vector open, Vector angle)
{
Entity[] array = new Entity[]
{
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X, open.Y, open.Z)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f, open.Y, open.Z)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f, open.Y, open.Z)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f - 30f, open.Y, open.Z)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f -30f -30f, open.Y, open.Z)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f -30f -30f -30f, open.Y, open.Z)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f - 30f -30f -30f, open.Y, open.Z + 80f)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f - 30f - 30f -30f, open.Y, open.Z + 80f)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X -30f -30f -30f, open.Y, open.Z + 80f)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f -30f, open.Y, open.Z + 80f)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X - 30f, open.Y, open.Z + 80f)),
base.SpawnModel("script_model", "com_plasticcase_enemy", new Vector(open.X,open.Y,open.Z + 80f))
};
Entity[] array2 = array;
for (int i = 0; i < array2.Length; i++)
{
Entity entity = array2[i];
Extensions.SetAngles(entity, angle);
Extensions.CloneBrushModelToScriptModel(entity, Extensions.FindAirdropCrateCollisionId());
}
}
public void CreateBlock(Vector pos, bool upstairs = false)
{
if (!upstairs)
{
Entity scriptModel = base.SpawnModel("script_model", "com_plasticcase_friendly", pos);
Extensions.CloneBrushModelToScriptModel(scriptModel, Extensions.FindAirdropCrateCollisionId());
return;
}
Entity scriptModel2 = base.SpawnModel("script_model", "com_plasticcase_trap_friendly", pos);
Extensions.CloneBrushModelToScriptModel(scriptModel2, Extensions.FindAirdropCrateCollisionId());
}
public override void OnMapChange()
{
string map = GetDvar("mapname");
if (map == "mp_terminal_cls")
{
drystatb();
}
}
private void drystatb()
{
this.door(new Vector(332.6469f, 5806.08f, 744.125f), new Vector(90f, 0f, 90f));
}
}
} |