• 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request Compile this code please
#1
I always get the error The type or namespace name could not be found, but if I add InfinityScript as reference then i get more errors. This is a decompiled dll file which I edited for my liking, I included the original dll as attachment if it helps.

Code:
namespace Sharpshooter_Infected
{
    using InfinityScript;
    using System;
    using System.Collections.Generic;
    using System.Linq;

    public class SharpshooterInfected : BaseScript
    {
        private string _currentWeapon;
        private int _cycleRemaining;
        private SharpshooterPerk[] _perkList;
        private Random _rng;
        private int _switchTime;
        private List<string> _usedWeapons;
        private Dictionary<string, string[]> _validAttachments;
        private string[] _weaponList;

        public SharpshooterInfected()
        {
            Func<bool> func = null;
            Func<bool> func2 = null;
            Action<Entity> action = null;
            this._rng = new Random();
            this._usedWeapons = new List<string>();
            this._switchTime = base.Call<int>("getDvarInt", new Parameter[] { "shrp_switchTime", 30 });
            this._cycleRemaining = this._switchTime;
            SharpshooterPerk[] perkArray = new SharpshooterPerk[7];
            SharpshooterPerk perk2 = new SharpshooterPerk {
                perkName = "Sleight of Hand",
                perks = new string[] { "specialty_fastreload", "specialty_quickswap" }
            };
            perkArray[0] = perk2;
            SharpshooterPerk perk3 = new SharpshooterPerk {
                perkName = "Quickdraw",
                perks = new string[] { "specialty_quickdraw" }
            };
            perkArray[1] = perk3;
            SharpshooterPerk perk4 = new SharpshooterPerk {
                perkName = "Stalker",
                perks = new string[] { "specialty_stalker" }
            };
            perkArray[2] = perk4;
            SharpshooterPerk perk5 = new SharpshooterPerk {
                perkName = "Marathon",
                perks = new string[] { "specialty_longersprint", "specialty_fastmantle" }
            };
            perkArray[3] = perk5;
            SharpshooterPerk perk6 = new SharpshooterPerk {
                perkName = "Range",
                perks = new string[] { "specialty_longerrange" },
                isWeapon = true
            };
            perkArray[4] = perk6;
            SharpshooterPerk perk7 = new SharpshooterPerk {
                perkName = "Stability",
                perks = new string[] { "specialty_reducedsway" },
                isWeapon = true
            };
            perkArray[5] = perk7;
            SharpshooterPerk perk8 = new SharpshooterPerk {
                perkName = "Speed",
                perks = new string[] { "specialty_lightweight" },
                isWeapon = true
            };
            perkArray[6] = perk8;
            this._perkList = perkArray;
            foreach (SharpshooterPerk perk in this._perkList)
            {
                string str = perk.perks[0] + (perk.isWeapon ? "" : "_upgrade");
                base.Call("precacheShader", new Parameter[] { str });
            }
            this.PrepareWeaponLists();
            this._currentWeapon = this.GetRandomWeapon();
            if (func == null)
            {
                func = delegate {
                    this._cycleRemaining--;
                    if (this._cycleRemaining == 0)
                    {
                        this._cycleRemaining = this._switchTime;
                    }
                    foreach (Entity entity in base.get_Players())
                    {
                        if (entity.HasField("bohud_created"))
                        {
                            entity.GetField<HudElem[]>("bohud_messageText")[0].SetText("Changing weapons in: " + this.FormatTime(this._cycleRemaining));
                        }
                    }
                    return true;
                };
            }
            base.OnInterval(0x3e8, func);
            if (func2 == null)
            {
                func2 = delegate {
                    Action<Entity> action = null;
                    this._currentWeapon = this.GetRandomWeapon();
                    this._cycleRemaining = this._switchTime;
                    foreach (Entity entity in base.get_Players())
                    {
                        if (entity.get_IsAlive() && (entity.GetField<string>("sessionteam") != "axis"))
                        {
                            entity.TakeAllWeapons();
                            entity.GiveWeapon(this._currentWeapon);
                            entity.Call("giveMaxAmmo", new Parameter[] { this._currentWeapon });
                            if (action == null)
                            {
                                action = entity => entity.SwitchToWeaponImmediate(this._currentWeapon);
                            }
                            entity.AfterDelay(100, action);
                        }
                    }
                    return true;
                };
            }
            base.OnInterval(this._switchTime * 0x3e8, func2);
            if (action == null)
            {
                action = delegate (Entity entity) {
                    this.createServerHud();
                    base.Call("setdvar", new Parameter[] { "motd", "" });
                    entity.OnNotify("joined_team", delegate (Entity player) {
                        entity.Call("closePopupMenu", new Parameter[0]);
                        entity.Call("closeIngameMenu", new Parameter[0]);
                    });
                    entity.OnInterval(250, delegate (Entity player) {
                        if (player.get_IsAlive() && (player.GetField<string>("sessionteam") != "axis"))
                        {
                            string str = player.get_CurrentWeapon();
                            string realWeaponName = this.GetRealWeaponName(this._currentWeapon);
                            if (!((!(str != "none") || !(str != "")) || str.Contains(realWeaponName)))
                            {
                            }
                        }
                        return true;
                    });
                    entity.OnInterval(0xdac, delegate (Entity player) {
                        if (player.get_IsAlive() && (player.GetField<string>("sessionteam") != "axis"))
                        {
                            string str = player.get_CurrentWeapon();
                            if (str.StartsWith("iw5_44magnum") || str.StartsWith("iw5_44magnum"))
                            {
                                player.Call("giveMaxAmmo", new Parameter[] { str });
                            }
                        }
                        return true;
                    });
                    entity.add_SpawnedPlayer(delegate {
                        if (entity.GetField<string>("sessionteam") == "axis")
                        {
                            this.createServerHud();
                        }
                        else
                        {
                            entity.TakeAllWeapons();
                            entity.Call("clearPerks", new Parameter[0]);
                            this.createServerHud();
                            entity.SetField("shrp_perkc", 0);
                            entity.SetField("shrp_perks", new Parameter(new string[3]));
                            entity.GiveWeapon(this._currentWeapon);
                            entity.Call("giveMaxAmmo", new Parameter[] { this._currentWeapon });
                            entity.AfterDelay(100, player => player.SwitchToWeaponImmediate(this._currentWeapon));
                        }
                    });
                };
            }
            base.add_PlayerConnected(action);
        }

        private string AddRandomAttachmentToWeapon(string baseWeapon)
        {
            string[] source = this._validAttachments[baseWeapon];
            if (source.Length == 0)
            {
                return Utilities.BuildWeaponName(baseWeapon, "none", "none", this._rng.Next(0, 14), this._rng.Next(0, 7));
            }
            bool flag = false;
            string[] desiredAttachments = null;
            while (!flag)
            {
                desiredAttachments = this.GetDesiredAttachments();
                if (desiredAttachments.Length == 0)
                {
                    return Utilities.BuildWeaponName(baseWeapon, "none", "none", this._rng.Next(0, 14), this._rng.Next(0, 7));
                }
                foreach (string str in desiredAttachments)
                {
                    if (source.Contains<string>(str))
                    {
                        flag = true;
                        break;
                    }
                }
            }
            string str2 = "none";
            bool flag2 = false;
            while (!flag2)
            {
                str2 = desiredAttachments[this._rng.Next(0, desiredAttachments.Length)];
                if (source.Contains<string>(str2))
                {
                    flag2 = true;
                }
            }
            Log.Write(1, "weapon {0} with a {1}", new object[] { baseWeapon, str2 });
            return Utilities.BuildWeaponName(baseWeapon, str2, "none", this._rng.Next(0, 14), this._rng.Next(0, 7));
        }

        private void createServerHud()
        {
            HudElem motd = HudElem.CreateServerFontString("boldFont", 1f);
            motd.SetPoint("CENTER", "BOTTOM", 0, -19);
            motd.set_Foreground(true);
            motd.set_HideWhenInMenu(true);
            base.OnInterval(0x61a8, delegate {
                motd.SetText(this.Call<string>("getdvar", new Parameter[] { "motd" }));
                motd.SetPoint("CENTER", "BOTTOM", 0x44c, -10);
                motd.Call("moveovertime", new Parameter[] { 0x19 });
                motd.set_X(-700f);
                return true;
            });
        }

        private string FormatTime(int seconds)
        {
            int num = seconds % 60;
            return string.Format("{0}:{1}", seconds / 60, num.ToString().PadLeft(2, '0'));
        }

        private string[] GetDesiredAttachments()
        {
            string[] strArray = new string[] { "none", "sight", "sight", "sight", "sight", "sight", "other", "other", "other", "final" };
            switch (strArray[this._rng.Next(0, strArray.Length)])
            {
                case "none":
                    return new string[0];

                case "sight":
                    return new string[] { "acog", "reflex", "hamrhybrid", "hybrid", "zoomscope", "eotech", "vzscope" };

                case "other":
                    return new string[] { "silencer", "silencer02", "silencer03", "grip", "gl", "gp25", "m320", "shotgun" };

                case "final":
                    return new string[] { "thermal", "heartbeat" };
            }
            return new string[0];
        }

        private string GetRandomWeapon()
        {
            string item = (from w in this._weaponList
                where !this._usedWeapons.Contains(w)
                orderby this._rng.Next()
                select w).FirstOrDefault<string>();
            if (item == null)
            {
                this._usedWeapons.Clear();
                item = this._weaponList[this._rng.Next(0, this._weaponList.Length)];
            }
            this._usedWeapons.Add(item);
            return this.AddRandomAttachmentToWeapon(item);
        }

        private string GetRealWeaponName(string weapon)
        {
            string[] strArray = weapon.Split(new char[] { '_' });
            if (strArray[0] == "iw5")
            {
                return strArray[1];
            }
            return strArray[0];
        }

        public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
        {
            if (((attacker != player) && (attacker.GetField<string>("classname") == "player")) && attacker.get_IsAlive())
            {
            }
        }

        private void PrepareWeaponLists()
        {
            this._weaponList = new string[] {
                "iw5_44magnum", "iw5_usp45", "iw5_deserteagle", "iw5_mp412", "iw5_p99", "iw5_fnfiveseven", "iw5_fmg9", "iw5_skorpion", "iw5_mp9", "iw5_g18", "iw5_mp5", "iw5_m9", "iw5_p90", "iw5_pp90m1", "iw5_ump45", "iw5_mp7",
                "iw5_ak47", "iw5_m16", "iw5_m4", "iw5_fad", "iw5_acr", "iw5_type95", "iw5_mk14", "iw5_scar", "iw5_g36c", "iw5_cm901", "rpg", "iw5_smaw", "xm25", "iw5_dragunov", "iw5_msr", "iw5_barrett",
                "iw5_rsass", "iw5_as50", "iw5_l96a1", "iw5_ksg", "iw5_1887", "iw5_striker", "iw5_aa12", "iw5_usas12", "iw5_spas12", "iw5_m60", "iw5_mk46", "iw5_pecheneg", "iw5_sa80", "iw5_mg36"
             };
            this._validAttachments = new Dictionary<string, string[]>();
            foreach (string str in this._weaponList)
            {
                List<string> list = new List<string>();
                for (int i = 11; i <= 0x15; i++)
                {
                    string item = base.Call<string>("tableLookup", new Parameter[] { "mp/statstable.csv", 4, str, i });
                    if (item != "")
                    {
                        list.Add(item);
                    }
                }
                this._validAttachments.Add(str, list.ToArray());
            }
        }

        private class SharpshooterPerk
        {
            public bool isWeapon;
            public string perkName;
            public string[] perks;
        }
    }
}

.rar   infected.rar (Size: 6.45 KB / Downloads: 19)
  Reply
#2
Quote:InfinityScript
Quote:decompiled dll file

Neither of these are supported here.
[Image: b_560_95_1.png]
  Reply
#3
This is not the fourdeltaone support forum. Go there.

Edit: damn it Nukem
[Image: MaEIQ.png]
  Reply
#4
So there's no moderators to remove it. GREAT!
C++/Obj-C developer. Neko engine wip
Steam: Click
  Reply
#5
(08-10-2013, 20:25)SailorMoon Wrote: So there's no moderators to remove it. GREAT!

I was letting the person see the post before it was removed...

This thread has been moved to the boards archive.
Contact a moderator in case you want to contribute to this thread.
[Image: b_560_95_1.png]
  Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
  Help Code color crosshairs koren30 3 1,917 10-02-2013, 19:26
Last Post: koren30
  Help need help?how to make plugins code hXnarutoXone 12 3,839 09-01-2013, 18:30
Last Post: Bandarigoda123
  Help Need Help with C# code tubwux 2 1,640 08-27-2013, 18:18
Last Post: tubwux
  Compile this code please First_Semyon 12 4,390 08-08-2013, 14:53
Last Post: Bandarigoda123
  Compile please this code First_Semyon 8 2,639 07-28-2013, 01:52
Last Post: First_Semyon
  Trying to compile a modified menu DidUknowiPwn 7 2,420 07-05-2013, 21:55
Last Post: DidUknowiPwn
  Code of vector Bloodfocus 1 1,060 06-23-2013, 11:54
Last Post: Yamato
  problem with gsc code CheGuevara 5 2,235 04-20-2013, 15:06
Last Post: Nekochan
  Help Server Script Compile Error when loading ExtremeBunkerMaker lolmoon 3 1,981 04-09-2013, 03:11
Last Post: lolmoon
Tongue [Request] read if you have a cs:go code:) rawr-saours 5 1,970 04-05-2013, 18:15
Last Post: SuperNovaAO

Forum Jump:


Users browsing this thread: 1 Guest(s)