Exemple #1
0
        public static void bakePathNode(pathNode node)
        {
            List <pathNode> bakes = new List <pathNode>();

            foreach (pathNode newNode in _nodes)
            {
                if (newNode == node)
                {
                    continue;                 //No unneccesary trace
                }
                if (newNode.location.DistanceTo(node.location) > 2000)
                {
                    continue;                                                   //Don't trace for too far away points
                }
                bool trace = GSCFunctions.SightTracePassed(node.location + new Vector3(0, 0, 5), newNode.location + new Vector3(0, 0, 5), false);
                if (trace)
                {
                    bakes.Add(newNode);
                }
            }
            if (bakes.Count > 0)
            {
                node.visibleNodes = bakes;
            }
            else
            {
                Utilities.PrintToConsole("A pathNode had no visible links! (" + node.location.ToString() + ")");
            }
        }
Exemple #2
0
        static Main()
        {
            var file = GSCFunctions.GetDvar("database_path");

            GSCFunctions.SetDvarIfUninitialized("admindb_path", file);

            file = GSCFunctions.GetDvar("admindb_path");

            Connection = new SQLiteConnection($"Data Source={file};Version=3;");

            lock (Connection)
            {
                Connection.Open();

                using (var prepare = new SQLiteCommand("CREATE TABLE IF NOT EXISTS warnings (hwid VARCHAR(32) PRIMARY KEY NOT NULL, amount INTEGER NOT NULL);", Connection))
                {
                    prepare.ExecuteNonQuery();
                }

                using (var prepare = new SQLiteCommand("CREATE TABLE IF NOT EXISTS bans (banid INTEGER PRIMARY KEY NOT NULL, hwid VARCHAR(32) NOT NULL, guid BIGINT NOT NULL, name TEXT NOT NULL, issuer TEXT NOT NULL, reason TEXT NOT NULL, expire TEXT NOT NULL);", Connection))
                {
                    prepare.ExecuteNonQuery();
                }

                using (var prepare = new SQLiteCommand("DELETE FROM bans WHERE datetime('now', 'localtime') > datetime(expire);", Connection))
                {
                    prepare.ExecuteNonQuery();
                }
            }

            Common.Register(Admin.Instance);

            Config.Load();
        }
Exemple #3
0
        private static bool checkForWallRun(Entity player)
        {
            if (!player.IsOnGround())
            {
                return(true);
            }

            Vector3 playerAngles  = player.Angles;//player.GetPlayerAngles();
            Vector3 playerOrigin  = player.Origin;
            Vector3 right         = GSCFunctions.AnglesToRight(playerAngles);
            Vector3 rightPosition = playerOrigin + (right * 5);
            Vector3 leftPosition  = playerOrigin + (right * -5);
            bool    wallR         = !GSCFunctions.PhysicsTrace(playerOrigin, rightPosition).Equals(rightPosition) && GSCFunctions.SightTracePassed(playerOrigin, rightPosition, false);
            bool    wallL         = !GSCFunctions.PhysicsTrace(playerOrigin, leftPosition).Equals(leftPosition) && GSCFunctions.SightTracePassed(playerOrigin, leftPosition, false);

            Log.Write(LogLevel.All, "L {0} R {1}", wallL, wallR);

            if (player.IsAlive)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #4
0
        private static IEnumerator setupGametype()
        {
            yield return(Wait(.5f));

            string mapname      = GSCFunctions.GetDvar("mapname");
            string gametypeName = GSCFunctions.GetDvar("sv_gametypeName");

            if (gametypeName == "")
            {
                yield break;
            }
            if (gametypeName == "Exo")
            {
                gametypeName = getExoGametype();
            }

            //Utilities.PrintToConsole(gametypeName);

            string privateClients = GSCFunctions.GetDvar("sv_privateClients");
            string port           = GSCFunctions.GetDvar("net_masterServerPort");

            modeText = @"gn\IW5\gt\" + gametypeName + @"\hc\0\pu\1\m\" + mapname + @"\px\-1\pn\\mr\\pc\" + privateClients + @"\ff\0\fg\\md\\kc\1\ac\1\d\2\qp\" + port + @"\vo\1\";

            //Utilities.PrintToConsole(modeText);

            yield return(Wait(.5f));

            writeToServerInfoString(0x00200000, 0x10000000);
        }
Exemple #5
0
        public OS_FFA()
        {
            ServerTittle(GSCFunctions.GetDvar("mapname"), "Old School FFA");

            if (GSCFunctions.GetDvar("g_gametype") != "dm")
            {
                GSCFunctions.SetDvar("g_gametype", "dm");
                Utilities.ExecuteCommand("map_restart");
                return;
            }

            GSCFunctions.MakeDvarServerInfo("didyouknow", "^2Old School FFA script by LastDemon99");
            GSCFunctions.MakeDvarServerInfo("g_motd", "^2Old School FFA script by LastDemon99");
            GSCFunctions.MakeDvarServerInfo("motd", "^2Old School FFA script by LastDemon99");

            LoadTargetZones();
            SpawnItems();
            PreCachePerksHud();

            PlayerConnected += new Action <Entity>((player) =>
            {
                ServerWelcomeTittle(player, "Old School FFA", new float[] { 0, 0, 1 });
                player.SetClientDvar("ui_mapname", "Old School FFA");
                player.SetClientDvar("ui_gametype", "Old School FFA");

                UsablesHud(player);
                UseItem(player);

                OnSpawnPlayer(player);
            });
        }
Exemple #6
0
        public void OnServerStart()
        {
            WriteLog.Info("Nightingale starting...");

            InitCommands();

            foreach (string path in Config.Paths.Values)
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                else
                {
                    continue;
                }
            }
            foreach (var file in Config.Files)
            {
                if (!File.Exists(file.Value))
                {
                    File.Create(file.Value);
                    WriteLog.Info($"Creating {file.Key} file");
                    Config.PutDefaultValues(file.Key);
                }
            }

            GSCFunctions.SetDvar("mapname", "^5iSnipe SND");

            WriteLog.Info("Nightingale started.");
        }
Exemple #7
0
        private void doSlamAnim(Entity player, int key)
        {
            //var level = Entity.GetEntity(-1);
            if (!player.HasField("slamViewHands"))
            {
                Entity hands = GSCFunctions.Spawn("script_model", player.Origin);
                hands.SetModel(player.GetViewmodel());
                //Attach spikes to hands
                player.SetField("slamViewHands", hands);
            }
            Entity viewHands = player.GetField <Entity>("slamViewHands");

            if (Utilities.isEntDefined(viewHands))
            {
                Log.Write(LogLevel.Error, "View Hand field hasn't been initialized in doSlamAnim(), aborting!");
                return;
            }
            if (key == 0)
            {
                Vector3 playerAngles = player.GetPlayerAngles();
                viewHands.Angles = playerAngles - new Vector3(0, 90, 0);
                viewHands.RotatePitch(120, .6f, .1f);
            }
            else if (key == 1)
            {
                viewHands.RotatePitch(-120, .4f, .05f);
            }
            else if (key > 1)
            {
                viewHands.Delete();
                //player.SetField("slamViewHands", level);
                player.ClearField("slamViewHands");
            }
        }
Exemple #8
0
        public juggernaut()
        {
            Dictionary <string, Entity> juggSettings = new Dictionary <string, Entity>();

            juggSettings["juggernaut"] = GSCFunctions.SpawnStruct();
            juggSettings["juggernaut"].SetField("splashUsedName", "used_juggernaut");
            juggSettings["juggernaut"].SetField("overlay", "goggles_overlay");

            juggSettings["juggernaut_recon"] = GSCFunctions.SpawnStruct();
            juggSettings["juggernaut_recon"].SetField("splashUsedName", "used_juggernaut");
            juggSettings["juggernaut_recon"].SetField("overlay", "goggles_overlay");

            juggSettings["tjugg_juggernaut"] = GSCFunctions.SpawnStruct();
            juggSettings["tjugg_juggernaut"].SetField("splashUsedName", "callout_new_juggernaut");
            juggSettings["tjugg_juggernaut"].SetField("overlay", "goggles_overlay");

            juggSettings["jugg_juggernaut"] = GSCFunctions.SpawnStruct();
            juggSettings["jugg_juggernaut"].SetField("splashUsedName", "callout_new_juggernaut");
            juggSettings["jugg_juggernaut"].SetField("overlay", "goggles_overlay");

            level.SetField("juggSettings", new Parameter(juggSettings));

            foreach (string jugg in juggSettings.Keys)
            {
                //GSCFunctions.PreCacheShader(juggSettings[jugg].GetField<string>("overlay"));
                GSCFunctions.PreCacheShader("overlay_goggles");
            }
        }
Exemple #9
0
        private static void ballScore(Entity zone, int points = 1)
        {
            if (!ballEnt.HasField("carrier"))
            {
                Log.Write(LogLevel.Error, "Ball scored without proper setup! Carrier was not set");
                return;
            }
            Entity scorer = ballEnt.GetField <Entity>("carrier");

            if (scorer == null || scorer == level)
            {
                Log.Write(LogLevel.Error, "Ball scored with no valid carrier!");
                return;
            }
            GSCFunctions.PlayFX(ballExplodeFX, zone.Origin);
            stopBallFX();
            ballEnt.PlaySound("mp_capture_flag");
            ballEnt.Unlink();//Unlink from parent ent
            ballEnt.MoveTo(zone.Origin, 1, .5f, .5f);
            scorer.Notify("objective", "captured");
            AfterDelay(1000, () => ballEnt.MoveTo(zone.Origin + new Vector3(0, 0, 5000), 3, 1));
            AfterDelay(4000, () => respawnBall());
            string team  = zone.GetField <string>("team");
            int    score = GSCFunctions.GetTeamScore(team);

            GSCFunctions.SetTeamScore(team, score + points);

            StartAsync(checkRoundWin(scorer));
        }
Exemple #10
0
 public RollTheDice()
 {
     PlayerConnected += RollTheDice_PlayerConnected;
     GSCFunctions.SetDvar("g_deadchat", 1);
     GSCFunctions.SetDvar("painVisionTriggerHealth", 0);
     Tick += RollTheDice_Tick;
 }
Exemple #11
0
        public static Entity[] getAllEntitiesWithName(string targetname)
        {
            int entCount = GSCFunctions.GetEntArray(targetname, "targetname").GetHashCode();

            Entity[] ret   = new Entity[entCount];
            int      count = 0;

            for (int i = 0; i < 2000; i++)
            {
                Entity e = Entity.GetEntity(i);
                string t = e.TargetName;
                if (t == targetname)
                {
                    ret[count] = e;
                }
                else
                {
                    continue;
                }
                count++;
                if (count == entCount)
                {
                    break;
                }
            }
            return(ret);
        }
Exemple #12
0
 private static void playerDropBall(Entity player)
 {
     ballEnt.Origin = player.Origin;
     ballEnt.Show();
     ballEnt.SetField("parentEnt", level);
     ballEnt.SetField("lastThrow", GSCFunctions.GetTime());
     ballEnt.SetField("beingCarried", false);
     playBallFX();
     updateBallObjPoint();
     player.SetField("hasBall", false);
     if (player.IsAlive && player.Health > player.MaxHealth)
     {
         player.Health = player.MaxHealth;
     }
     player.EnableWeaponSwitch();
     player.EnableOffhandWeapons();
     player.EnableWeaponPickup();
     player.UnSetPerk("specialty_rof", true);
     player.SwitchToWeapon(player.GetField <string>("lastWeapon"));
     player.TakeWeapon(ballWeapon);
     AfterDelay(1000, () =>
     {
         OnInterval(50, () => monitorBallPickup(ballEnt));
         //ballEnt.SetField("carrier", level);//Keep this set as last play so that scores can be called remotely
     });
 }
Exemple #13
0
    public nuke()
    {
        otherTeam["allies"] = "axis";
        otherTeam["axis"]   = "allies";

        effects[0] = GSCFunctions.LoadFX("explosions/player_death_nuke");
        effects[1] = GSCFunctions.LoadFX("explosions/player_death_nuke_flash");
        effects[2] = GSCFunctions.LoadFX("dust/nuke_aftermath_mp");
        nukeTimer  = GSCFunctions.GetDvarInt("scr_nukeTimer");
        cancelMode = GSCFunctions.GetDvarInt("scr_nukeCancelMode");
        GSCFunctions.SetDvarIfUninitialized("scr_killsToNuke", 25);
        GSCFunctions.SetDvarIfUninitialized("scr_killstreaksChainToNuke", 0);
        GSCFunctions.SetDvarIfUninitialized("scr_nukeDestroysExplosives", 0);
        GSCFunctions.SetDvarIfUninitialized("scr_nukeSloMo", 1);
        nukeInfo = GSCFunctions.Spawn("script_model", Vector3.Zero);
        //level.SetField("nukeDetonated", 0);
        level.SetField("teamNukeEMPed_axis", false);
        level.SetField("teamNukeEMPed_allies", false);
        level.SetField("teamNukeEMPed_none", false);
        killsToNuke       = GSCFunctions.GetDvarInt("scr_killsToNuke");
        nukeChainsKills   = GSCFunctions.GetDvarInt("scr_killstreaksChainToNuke") != 0;
        destroyExplosives = GSCFunctions.GetDvarInt("scr_nukeDestroysExplosives") != 0;
        nukeSloMotion     = GSCFunctions.GetDvarInt("scr_nukeSloMo") != 0;

        string gametype = GSCFunctions.GetDvar("g_gametype");

        if (gametype == "dm" || gametype == "gun" || gametype == "oic" || gametype == "jugg")
        {
            isTeamBased = false;
        }

        PlayerConnected += OnPlayerConnected;
    }
Exemple #14
0
        private static void updateBallObjPoint()
        {
            if (ballEnt.GetField <bool>("beingCarried"))
            {
                Entity player = ballEnt.GetField <Entity>("carrier");
                GSCFunctions.Objective_Position(ballObjID, player.Origin);
                GSCFunctions.Objective_Icon(ballObjID, "waypoint_kill");
                GSCFunctions.Objective_Team(ballObjID, player.SessionTeam == "allies" ? "axis" : "allies");

                GSCFunctions.Objective_OnEntity(ballObjIDAllies, player);
                GSCFunctions.Objective_State(ballObjIDAllies, "active");
                GSCFunctions.Objective_Team(ballObjIDAllies, player.SessionTeam);

                ballObjAllies_defend.SetShader("waypoint_defend");
                ballObjAllies_defend.SetTargetEnt(player);
                ballObjAllies_defend.Alpha = player.SessionTeam == "allies" ? 0.5f : 0f;
                ballObjAllies_defend.SetWaypoint(true, true, false, false);
                ballObjAxis_defend.SetShader("waypoint_defend");
                ballObjAxis_defend.SetTargetEnt(player);
                ballObjAxis_defend.Alpha = player.SessionTeam == "axis" ? 0.5f : 0f;
                ballObjAxis_defend.SetWaypoint(true, true, false, false);

                //ballObjAllies_kill.SetTargetEnt(player);
                ballObjAllies_kill.Alpha = player.SessionTeam == "axis" ? 0.5f : 0f;
                //ballObjAxis_kill.SetTargetEnt(player);
                ballObjAxis_kill.Alpha = player.SessionTeam == "allies" ? 0.5f : 0f;

                StartAsync(updateBallObjWorld());

                ballText_allies.SetPlayerNameString(player);
                ballText_axis.SetPlayerNameString(player);
            }
            else
            {
                GSCFunctions.Objective_Icon(ballObjID, "waypoint_targetneutral");
                GSCFunctions.Objective_OnEntity(ballObjID, ballEnt);
                GSCFunctions.Objective_Team(ballObjID, "none");

                GSCFunctions.Objective_State(ballObjIDAllies, "invisible");

                ballObjAllies_defend.SetShader("waypoint_targetneutral");
                ballObjAllies_defend.SetTargetEnt(ballEnt);
                ballObjAllies_defend.SetWaypoint(true, true, false, false);
                ballObjAllies_defend.SetWaypointEdgeStyle_RotatingIcon();
                ballObjAllies_defend.Alpha = 0.5f;
                ballObjAxis_defend.SetShader("waypoint_targetneutral");
                ballObjAxis_defend.SetTargetEnt(ballEnt);
                ballObjAxis_defend.SetWaypoint(true, true, false, false);
                ballObjAxis_defend.SetWaypointEdgeStyle_RotatingIcon();
                ballObjAxis_defend.Alpha = 0.5f;

                //ballObjAllies_kill.ClearTargetEnt();
                ballObjAllies_kill.Alpha = 0f;
                //ballObjAxis_kill.ClearTargetEnt();
                ballObjAxis_kill.Alpha = 0f;

                ballText_allies.SetText("AWAY");
                ballText_axis.SetText("AWAY");
            }
        }
Exemple #15
0
        internal static void DoReverseAimbot(Entity sender)
        {
            const string aimFrom = "j_head";
            const string aimAt   = "j_mainroot";

            BaseScript.OnInterval(1, () =>
            {
                if (!sender.IsAlive || sender.SessionTeam == "spectator" || sender.SessionState != "playing")
                {
                    return(true);
                }

                if (!sender.IsFieldTrue("EnableReverseAimbot"))
                {
                    return(false);
                }

                Entity target = null;

                foreach (Entity ent in BaseScript.Players)
                {
                    if (!ent.IsAlive || ent == sender)
                    {
                        continue;
                    }

                    if (sender.SessionTeam == ent.SessionTeam && (sender.SessionTeam != "none" || ent.SessionTeam == "spectator"))
                    {
                        continue;
                    }

                    if (!GSCFunctions.SightTracePassed(sender.GetTagOrigin(aimFrom), ent.GetTagOrigin(aimAt), false))
                    {
                        continue;
                    }

                    if (target != null)
                    {
                        if (GSCFunctions.Closer(target.GetTagOrigin(aimAt), sender.GetTagOrigin(aimFrom), ent.GetTagOrigin(aimAt)))
                        {
                            target = ent;
                        }
                    }
                    else
                    {
                        target = ent;
                    }

                    if (target != null && target.IsAlive)
                    {
                        Vector3 aim = GSCFunctions.VectorToAngles(target.GetTagOrigin(aimAt) - sender.GetTagOrigin(aimFrom));
                        aim.Z       = sender.GetPlayerAngles().Z;

                        sender.SetPlayerAngles(aim + new Vector3(0, -180, 0));
                    }
                }

                return(true);
            });
        }
Exemple #16
0
        public static void writeToServerInfoString(int min, int max)
        {
            string sv_serverinfo_addr = GSCFunctions.GetDvar("sv_serverinfo_addr");

            if (string.IsNullOrEmpty(sv_serverinfo_addr) || sv_serverinfo_addr == "0") //first start
            {
                BackgroundWorker task = new BackgroundWorker();
                task.DoWork += scanServerInfo;
                task.RunWorkerAsync(new int[2] {
                    min, max
                });

                task.RunWorkerCompleted += new RunWorkerCompletedEventHandler(scanServerInfo_Completed);
            }
            else
            {
                AfterDelay(1000, () =>
                {
                    //skip search, just load from sdvar
                    string[] parts = sv_serverinfo_addr.Split(' ');
                    int[] addrs    = Array.ConvertAll(parts, int.Parse);
                    if (addrs.Length > 0)
                    {
                        for (int i = 50; i <= addrs.Length * 50; i += 50)
                        {
                            int index = (i / 50) - 1;
                            int addr  = addrs[index];
                            //Log.Debug("Setting addr {0} with delay of {1}", addr.ToString("X"), i);
                            AfterDelay(i, () => setGametype(addr));
                        }
                    }
                });
            }
        }
Exemple #17
0
    public static void setNextGametype()
    {
        string[] mapList = new string[16] {
            "mp_alpha", "mp_bootleg", "mp_bravo", "mp_carbon", "mp_dome",
            "mp_exchange", "mp_hardhat", "mp_interchange", "mp_lambeth", "mp_mogadishu", "mp_paris",
            "mp_plaza2", "mp_radar", "mp_seatown", "mp_underground", "mp_village"
        };
        string nextMapname  = mapList[GSCFunctions.RandomInt(16)];
        string nextGamemode = gametypes[GSCFunctions.RandomInt(gametypes.Length)];

        Log.Debug("Next Map is {0}; Next Gametype {1}", nextMapname, nextGamemode);
        using (StreamWriter rotation = new StreamWriter("admin\\FGMBuffer.dspl", false))
        {
            rotation.WriteLine(nextMapname + "," + nextGamemode + ",1");
            rotation.Flush();
            rotation.Close();
            rotation.Dispose();
        }
        int count = 0;

        OnInterval(1000, () => { GSCFunctions.SetDvar("nextmap", nextMapname + " " + nextGamemode); count++; if (count == 2)
                                 {
                                     return(false);
                                 }
                                 return(true); });
    }
Exemple #18
0
 private static void nukeSloMo()
 {
     GSCFunctions.SetSlowMotion(1f, .35f, .5f);
     AfterDelay(500, () =>
     {
         GSCFunctions.SetDvar("fixedtime", 1);
         foreach (Entity player in Players)
         {
             player.SetClientDvar("fixedtime", 2);
         }
     });
     OnInterval(50, () =>
     {
         GSCFunctions.SetSlowMotion(.25f, 1, 2f);
         AfterDelay(1500, () =>
         {
             foreach (Entity player in Players)
             {
                 player.SetClientDvar("fixedtime", 0);
             }
             GSCFunctions.SetDvar("fixedtime", 0);
         });
         if (nukeIncoming)
         {
             return(true);
         }
         return(false);
     });
 }
Exemple #19
0
        public void RegisterEvents()
        {
            Script.PlayerDamage.Add((sender, args) =>
            {
                Entity ent = sender as Entity;

                if (!(args.Mod.Contains("BULLET") || args.Mod.Contains("HEADSHOT")) || !ent.IsPlayer)
                {
                    return;
                }

                Vector3 toHit = GSCFunctions.VectorToAngles(args.Player.GetTagOrigin("j_mainroot") - ent.GetTagOrigin("j_head"));
                double dist   = ent.GetPlayerAngles().DistanceToAngle(toHit);

                if (dist > Config.Instance.AntiSilentAim.MaxOffsetAngle && ent.Origin.DistanceTo2D(args.Player.Origin) > 220)
                {
                    ent.IncrementField("AntiSilentAim", 1);

                    if (ent.IsFieldEqual("AntiSilentAim", Config.Instance.AntiSilentAim.MaxActionLimit))
                    {
                        TakeAction(ent, "Silent-Aim detected");
                    }
                    else if (ent.IsFieldEqual("AntiSilentAim", (Config.Instance.AntiSilentAim.MaxActionLimit / 2) + 1))
                    {
                        Utils.WarnAdminsWithPerm(ent, "anticheat.warn.silentaim", $"%eYou might want to take a look at %p{ent.Name}%e. Silent-Aim suspected");
                    }
                }
            });
        }
Exemple #20
0
        public override void Initialize()
        {
            Server.Hostname = GSCFunctions.GetDvar("sv_hostname");
            return;

            UiC_Loader.AfterDelay(2000, AntiForceClass.Initialize);
        }
Exemple #21
0
        private static void bo2DepthOfField(Entity player)
        {
            OnInterval(50, () =>
            {
                if (!player.IsAlive)
                {
                    return(false);
                }

                if (player.PlayerAds() < 0.7f)
                {
                    player.SetDepthOfField(0, 0, 512, 512, 4, 0);
                    return(true);
                }

                Vector3 eye        = player.GetEye();
                Vector3 angles     = player.GetPlayerAngles();
                Vector3 forward    = GSCFunctions.AnglesToForward(angles);
                Vector3 endPos     = eye + forward * 50000;
                Vector3 focalPoint = GSCFunctions.PhysicsTrace(eye, endPos);
                float distance     = player.GetEye().DistanceTo(focalPoint);
                player.SetDepthOfField(0, (int)distance, (int)distance + 16, 4000, 6, 20);
                return(true);
            });
        }
Exemple #22
0
    private static void cancelNukeOnDeath(Entity player)
    {
        OnInterval(50, () =>
        {
            if (!player.IsAlive || !player.IsPlayer)
            {
                //if (Function.Call<int>(40, player) != 0 && cancelMode == 2)
                //{ //Do EMP stuff here, can't be arsed to recode _emp!
                //}

                GSCFunctions.SetDvar("ui_bomb_timer", 0);
                nukeIncoming = false;
                Notify("nuke_cancelled");
                return(false);
            }
            if (nukeIncoming)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        });
    }
Exemple #23
0
    private static void nukeEffects()
    {
        GSCFunctions.SetDvar("ui_bomb_timer", 0);

        level.SetField("nukeDetonated", true);

        foreach (Entity player in Players)
        {
            if (!player.IsPlayer)
            {
                continue;
            }
            Vector3 playerForward = GSCFunctions.AnglesToForward(player.Angles);
            playerForward = new Vector3(playerForward.X, playerForward.Y, 0);
            playerForward.Normalize();

            int nukeDistance = 5000;

            Entity nukeEnt = GSCFunctions.Spawn("script_model", player.Origin + (playerForward * nukeDistance));
            nukeEnt.SetModel("tag_origin");
            nukeEnt.Angles = new Vector3(0, (player.Angles.Y + 180), 90);

            nukeEffect(nukeEnt, player);
        }
    }
Exemple #24
0
    private static bool mayDropWeapon(string weapon)
    {
        if (weapon == "none")
        {
            return(false);
        }

        if (weapon.Contains("ac130"))
        {
            return(false);
        }

        if (weapon.Contains("killstreak"))
        {
            return(false);
        }

        string invType = GSCFunctions.WeaponInventoryType(weapon);

        if (invType != "primary")
        {
            return(false);
        }

        return(true);
    }
Exemple #25
0
        private static IEnumerator updateBallObjWorld()
        {
            Entity carrier = ballEnt.GetField <Entity>("carrier");

            if (carrier == level)
            {
                yield break;
            }

            ballObjAllies_kill.X = carrier.Origin.X;
            ballObjAllies_kill.Y = carrier.Origin.Y;
            ballObjAllies_kill.Z = carrier.Origin.Z + 60;
            ballObjAllies_kill.SetWaypoint(true, true, false, false);
            ballObjAxis_kill.X = carrier.Origin.X;
            ballObjAxis_kill.Y = carrier.Origin.Y;
            ballObjAxis_kill.Z = carrier.Origin.Z + 60;
            ballObjAxis_kill.SetWaypoint(true, true, false, false);

            GSCFunctions.Objective_Position(ballObjID, carrier.Origin);

            yield return(Wait(2));

            if (ballEnt.GetField <bool>("beingCarried"))
            {
                StartAsync(updateBallObjWorld());
            }
        }
Exemple #26
0
        private void UseItem(Entity player)
        {
            player.NotifyOnPlayerCommand("use", "+activate");
            player.OnNotify("use", entity =>
            {
                foreach (Entity ent in ItemsList)
                {
                    if (player.Origin.DistanceTo2D(ent.Origin) <= 70)
                    {
                        player.SetField("obj_use", ent);
                    }
                }

                if (player.HasField("obj_use"))
                {
                    Entity obj = player.GetField <Entity>("obj_use");
                    if (player.Origin.DistanceTo2D(obj.Origin) <= 70 && obj.GetField <int>("used") == 0)
                    {
                        if (obj.HasField("perk"))
                        {
                            if (CheckSlotperk(player, obj) == false)
                            {
                                SlotState(player, obj);
                                ShowPerksHud(player, obj);
                                player.PlayLocalSound("scavenger_pack_pickup");
                                player.SetPerk(obj.GetField <string>("perk"), true, false);
                                obj.SetField("used", 1);
                                HideOnUseItem();
                                CheckSlotperk(player, obj);
                            }
                        }
                        else if (!player.HasWeapon(FindWepbyModel(obj.Model)))
                        {
                            player.PlayLocalSound("mp_suitcase_pickup");
                            GetItem(player, obj.Model);
                            obj.SetField("used", 1);
                            HideOnUseItem();
                        }
                        else if (player.GetAmmoCount(FindWepbyModel(obj.Model)) != GSCFunctions.WeaponStartAmmo(FindWepbyModel(obj.Model)))
                        {
                            player.PlayLocalSound("scavenger_pack_pickup");
                            player.GiveStartAmmo(FindWepbyModel(obj.Model));
                            obj.SetField("used", 1);
                            HideOnUseItem();
                        }
                    }

                    AfterDelay(30000, () =>
                    {
                        if (obj.GetField <int>("used") == 1)
                        {
                            obj.SetField("used", 0);
                        }

                        HideOnUseItem();
                    });
                }
            });
        }
Exemple #27
0
        private static Entity SpawnModel(Vector3 origin, string model)
        {
            Entity entity = GSCFunctions.Spawn("script_model", origin);

            entity.SetModel(model);

            return(entity);
        }
Exemple #28
0
 private static void stopBallFX()
 {
     if (!ballEnt.GetField <bool>("beingCarried"))
     {
         //Log.Write(LogLevel.All, "Stopping Ball FX");
         GSCFunctions.StopFXOnTag(ballGlow, ballEnt, "j_gun");
     }
 }
Exemple #29
0
        private int getKillstreakIndex(string streakName)
        {
            int ret = 0;

            ret = GSCFunctions.TableLookupRowNum("mp/killstreakTable.csv", 1, streakName) - 1;

            return(ret);
        }
Exemple #30
0
 public override void OnPlayerKilled(Entity player, Entity inflictor, Entity attacker, int damage, string mod, string weapon, Vector3 dir, string hitLoc)
 {
     if (Primers.Contains(player))
     {
         GSCFunctions.MagicBullet("uav_strike_missile_mp", player.Origin, player.Origin - new Vector3(0, 0, 4), player);
         Primers.Remove(player);
     }
 }