Esempio n. 1
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;
    }
Esempio n. 2
0
        private static IEnumerator setGameScoreLimit()
        {
            yield return(Wait(1));

            //Promode for lulz
            GSCFunctions.SetDynamicDvar("scr_ctf_promode", 1);

            int scoreLimit = GSCFunctions.GetDvarInt("scr_ball_scorelimit");

            GSCFunctions.SetDynamicDvar("scr_ctf_scorelimit", scoreLimit);
        }
Esempio n. 3
0
        private static void Init()
        {
            GSCFunctions.SetDvarIfUninitialized("andromeda_updates", 1);

            if (GSCFunctions.GetDvarInt("andromeda_updates") == 1)
            {
                Async.Start(Update());
            }
            else
            {
                Log.Info("Andromeda update checks disabled");
            }
        }
Esempio n. 4
0
        private static void Init()
        {
            IEnumerator announcer()
            {
                GSCFunctions.SetDvarIfUninitialized("announcer_index", 0);

                var index = GSCFunctions.GetDvarInt("announcer_index");

                while (true)
                {
                    index %= Config.Announcements.Length;

                    Common.SayAll(Config.Announcements[index]);
                    index++;

                    yield return(BaseScript.Wait(Config.AnnounceInterval));
                }
            }

            if (Config.Announcements != null)
            {
                Async.Start(announcer());
            }

            foreach (var cmd in Config.InfoCommands)
            {
                // INFO COMMANDS
                Command.TryRegister(SmartParse.CreateCommand(
                                        name : cmd.Key,
                                        argTypes : null,
                                        action : delegate(Entity sender, object[] args)
                {
                    sender.Tell(cmd.Value);
                },
                                        usage: $"!{cmd.Key}",
                                        description: $"Shows information regarding {cmd.Key}"));
            }
        }
Esempio n. 5
0
        public Fusion()
        {
            gunOffsets[0]     = 0x1AC2370;
            gunOffsets[1]     = gunOffsets[0] + addressOffset;
            gunOffsets[2]     = gunOffsets[1] + addressOffset;
            gunOffsets[3]     = gunOffsets[2] + addressOffset;
            gunOffsets[4]     = gunOffsets[3] + addressOffset;
            gunOffsets[5]     = gunOffsets[4] + addressOffset;
            gunOffsets[6]     = gunOffsets[5] + addressOffset;
            gunOffsets[7]     = gunOffsets[6] + addressOffset;
            gunOffsets[8]     = gunOffsets[7] + addressOffset;
            gunOffsets[9]     = gunOffsets[8] + addressOffset;
            gunOffsets[10]    = gunOffsets[9] + addressOffset;
            gunOffsets[11]    = gunOffsets[10] + addressOffset;
            gunOffsets[12]    = gunOffsets[11] + addressOffset;
            gunOffsets[13]    = gunOffsets[12] + addressOffset;
            gunOffsets[14]    = gunOffsets[13] + addressOffset;
            gunOffsets[15]    = gunOffsets[14] + addressOffset;
            gunOffsets[16]    = gunOffsets[15] + addressOffset;
            gunOffsets[17]    = gunOffsets[16] + addressOffset;
            camoOffsets[0]    = 0x1AC2371;
            camoOffsets[1]    = camoOffsets[0] + addressOffset;
            camoOffsets[2]    = camoOffsets[1] + addressOffset;
            camoOffsets[3]    = camoOffsets[2] + addressOffset;
            camoOffsets[4]    = camoOffsets[3] + addressOffset;
            camoOffsets[5]    = camoOffsets[4] + addressOffset;
            camoOffsets[6]    = camoOffsets[5] + addressOffset;
            camoOffsets[7]    = camoOffsets[6] + addressOffset;
            camoOffsets[8]    = camoOffsets[7] + addressOffset;
            camoOffsets[9]    = camoOffsets[8] + addressOffset;
            camoOffsets[10]   = camoOffsets[9] + addressOffset;
            camoOffsets[11]   = camoOffsets[10] + addressOffset;
            camoOffsets[12]   = camoOffsets[11] + addressOffset;
            camoOffsets[13]   = camoOffsets[12] + addressOffset;
            camoOffsets[14]   = camoOffsets[13] + addressOffset;
            camoOffsets[15]   = camoOffsets[14] + addressOffset;
            camoOffsets[16]   = camoOffsets[15] + addressOffset;
            camoOffsets[17]   = camoOffsets[16] + addressOffset;
            attachOffsets[0]  = 0x1AC2372;
            attachOffsets[1]  = attachOffsets[0] + addressOffset;
            attachOffsets[2]  = attachOffsets[1] + addressOffset;
            attachOffsets[3]  = attachOffsets[2] + addressOffset;
            attachOffsets[4]  = attachOffsets[3] + addressOffset;
            attachOffsets[5]  = attachOffsets[4] + addressOffset;
            attachOffsets[6]  = attachOffsets[5] + addressOffset;
            attachOffsets[7]  = attachOffsets[6] + addressOffset;
            attachOffsets[8]  = attachOffsets[7] + addressOffset;
            attachOffsets[9]  = attachOffsets[8] + addressOffset;
            attachOffsets[10] = attachOffsets[9] + addressOffset;
            attachOffsets[11] = attachOffsets[10] + addressOffset;
            attachOffsets[12] = attachOffsets[11] + addressOffset;
            attachOffsets[13] = attachOffsets[12] + addressOffset;
            attachOffsets[14] = attachOffsets[13] + addressOffset;
            attachOffsets[15] = attachOffsets[14] + addressOffset;
            attachOffsets[16] = attachOffsets[15] + addressOffset;
            attachOffsets[17] = attachOffsets[16] + addressOffset;
            PlayerConnected  += OnPlayerConnected;

            GSCFunctions.SetDvarIfUninitialized("scr_fusion_weaponOffset", 0);
            weaponOffset = GSCFunctions.GetDvarInt("scr_fusion_weaponOffset");
        }
Esempio n. 6
0
        public static IEnumerator giveJuggernaut(Entity player, string juggType)
        {
            yield return(WaitForFrame());

            //remove light armor
            if (player.HasPerk("specialty_lightarmor"))
            {
                removeLightArmor(player, player.GetField <int>("previousMaxHealth"));
            }

            //remove explosive bullets
            if (player.HasPerk("specialty_explosivebullets"))
            {
                player.UnSetPerk("specialty_explosivebullets");
            }

            bool createObjectiveIcon = true;

            switch (juggType)
            {
            case "juggernaut":
                player.SetField("isJuggernaut", true);
                giveJuggLoadout(player, player.SessionTeam, juggType);
                player.SetMoveSpeedScale(.65f);
                break;

            case "juggernaut_recon":
                player.SetField("isJuggernautRecon", true);
                giveJuggLoadout(player, player.SessionTeam, juggType);
                player.SetMoveSpeedScale(.75f);

                Entity portable_radar = GSCFunctions.Spawn("script_model", player.Origin);
                portable_radar.SetField("team", player.SessionTeam);

                portable_radar.MakePortableRadar(player);
                player.SetField("personalRadar", portable_radar);

                radarMover(player, portable_radar);
                break;

            case "tjugg_juggernaut":
                player.SetField("isJuggernaut", true);
                giveJuggLoadout(player, player.SessionTeam, "gamemode");
                player.SetMoveSpeedScale(.7f);

                Entity portable_radar1 = GSCFunctions.Spawn("script_model", player.Origin);
                portable_radar1.SetField("team", player.SessionTeam);

                portable_radar1.MakePortableRadar(player);
                player.SetField("personalRadar", portable_radar1);

                radarMover(player, portable_radar1);
                break;

            case "jugg_juggernaut":
                player.SetField("isJuggernaut", true);
                giveJuggLoadout(player, player.SessionTeam, "gamemode");
                player.SetMoveSpeedScale(.7f);
                if (GSCFunctions.GetMatchRulesData("juggData", "showJuggRadarIcon") == "0")
                {
                    createObjectiveIcon = false;
                }
                break;
            }

            updateMoveSpeedScale(player);

            player.DisableWeaponPickup();

            if (GSCFunctions.GetDvarInt("camera_thirdPerson") == 0)
            {
                HudElem juggernautOverlay = GSCFunctions.NewClientHudElem(player);
                juggernautOverlay.X         = 0;
                juggernautOverlay.Y         = 0;
                juggernautOverlay.AlignX    = HudElem.XAlignments.Left;
                juggernautOverlay.AlignY    = HudElem.YAlignments.Top;
                juggernautOverlay.HorzAlign = HudElem.HorzAlignments.Fullscreen;
                juggernautOverlay.VertAlign = HudElem.VertAlignments.Fullscreen;
                juggernautOverlay.SetShader(level.GetField <Dictionary <string, Entity> >("juggSettings")[juggType].GetField <string>("overlay"), 640, 480);
                juggernautOverlay.Sort            = -10;
                juggernautOverlay.Archived        = true;
                juggernautOverlay.HideIn3rdPerson = true;
            }

            juggernautSounds(player);

            player.SetPerk("specialty_radarjuggernaut", true, false);

            teamPlayerCardSplash(level.GetField <Dictionary <string, Entity> >("juggSettings")[juggType].GetField <string>("splashUsedName"), player);
            player.PlaySoundToTeam(voice[player.SessionTeam] + "use_juggernaut", player.SessionTeam, player);
            player.PlaySoundToTeam(voice[otherTeam[player.SessionTeam]] + "enemy_juggernaut", otherTeam[player.SessionTeam]);

            updateKillstreaks(player, true);

            StartAsync(juggRemover(player));

            //reapply flag
            if (player.HasField("carryFlag"))
            {
                yield return(WaitForFrame());

                player.Attach(player.GetField <string>("carryFlag"), "J_spine4", true);
            }

            Notify("juggernaut_equipped", player);

            //Log data?
        }
Esempio n. 7
0
        private static IEnumerator checkRoundWin(Entity winner)
        {
            string team = winner.SessionTeam;

            if (GSCFunctions.GetTeamScore(team) >= GSCFunctions.GetDvarInt("scr_ctf_scorelimit"))
            {
                //HACK, set scorelimit to 1 then teleport the corresponding flag and enemy base to the winning player to tell GSC we scored a flag
                GSCFunctions.SetDynamicDvar("scr_ctf_scorelimit", "1");
                GSCFunctions.SetTeamScore(winner.SessionTeam, 0);
                yield return(Wait(.5f));//Wait a frame or two to let scorelimit update

                Notify("update_scorelimit", 1);
                if (isHalftime)
                {
                    if (team == "allies")
                    {
                        OnInterval(50, () =>
                        {
                            alliesFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        axisFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else if (team == "axis")
                    {
                        OnInterval(50, () =>
                        {
                            axisFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        alliesFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else
                    {
                        GSCFunctions.SetDynamicDvar("scr_ctf_timelimit", "0.01");//Failsafe
                    }
                }
                else
                {
                    if (team == "allies")
                    {
                        OnInterval(50, () =>
                        {
                            axisFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        alliesFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else if (team == "axis")
                    {
                        OnInterval(50, () =>
                        {
                            alliesFlagBase.Origin = winner.Origin;
                            if (gameEnded)
                            {
                                return(false);
                            }
                            return(true);
                        });
                        axisFlagTrig2.LinkTo(winner, "tag_origin", Vector3.Zero, Vector3.Zero);
                    }
                    else
                    {
                        GSCFunctions.SetDynamicDvar("scr_ctf_timelimit", "0.01");//Failsafe
                    }
                }
            }
        }
Esempio n. 8
0
        public Class1()
        {
            Utilities.PrintToConsole(string.Format("Plugin loaded at {0}", GSCFunctions.GetTime()));
            //GSCFunctions.PreCacheString("Test String");
            //GSCFunctions.PreCacheStatusIcon("cardicon_iwlogo");
            //GSCFunctions.PreCacheMenu("kickplayer");
            //GSCFunctions.PreCacheMenu("elevator_floor_selector");
            //GSCFunctions.PreCacheShader("faction_128_gign");

            //Marshal.WriteInt32(new IntPtr(0x0585AE0C), 24);
            //Marshal.WriteInt32(new IntPtr(0x0585AE1C), 24);

            //working guns
            GSCFunctions.PreCacheItem("at4_mp");
            GSCFunctions.PreCacheItem("airdrop_mega_marker_mp");
            GSCFunctions.PreCacheItem("throwingknife_rhand_mp");
            GSCFunctions.PreCacheItem("iw5_mk12spr_mp");
            GSCFunctions.PreCacheItem("lightstick_mp");
            GSCFunctions.PreCacheItem("killstreak_double_uav_mp");
            GSCFunctions.PreCacheItem("strike_marker_mp");
            GSCFunctions.PreCacheItem("killstreak_helicopter_minigun_mp");
            GSCFunctions.PreCacheItem("airdrop_juggernaut_def_mp");
            GSCFunctions.PreCacheItem("uav_strike_missile_mp");
            GSCFunctions.PreCacheItem("uav_strike_projectile_mp");
            GSCFunctions.PreCacheItem("iw5_xm25_mp");
            GSCFunctions.PreCacheItem("iw5_riotshield_mp");
            GSCFunctions.PreCacheItem("harrier_missile_mp");

            //turret-only
            GSCFunctions.PreCacheTurret("manned_minigun_turret_mp");
            GSCFunctions.PreCacheTurret("manned_gl_turret_mp");
            GSCFunctions.PreCacheItem("remote_uav_weapon_mp");
            GSCFunctions.PreCacheItem("aamissile_projectile_mp");

            //Hacking in all fx
            //smoke

            /*
             * string[] smoke_fx;
             * smoke_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\smoke");
             * for (int i = 0; i < smoke_fx.Length; i++)
             * {
             *  GSCFunctions.LoadFX("smoke/" + smoke_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             * string[] prop_fx;
             * prop_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\props");
             * for (int i = 0; i < prop_fx.Length; i++)
             * {
             *  GSCFunctions.LoadFX("props/" + prop_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             * string[] dust_fx;
             * dust_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\dust");
             * for (int i = 0; i < dust_fx.Length; i++)
             * {
             *  GSCFunctions.LoadFX("dust/" + dust_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             * string[] exp_fx;
             * exp_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\explosions");
             * for (int i = 0; i < exp_fx.Length; i++)
             * {
             *  GSCFunctions.LoadFX("explosions/" + exp_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             * string[] impact_fx;
             * impact_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\impacts");
             * for (int i = 0; i < 100; i++)
             * {
             *  GSCFunctions.LoadFX("impacts/" + impact_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             * string[] shellejects_fx;
             * shellejects_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\shellejects");
             * for (int i = 0; i < shellejects_fx.Length; i++)
             * {
             *  GSCFunctions.LoadFX("shellejects/" + shellejects_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             * string[] fire_fx;
             * fire_fx = Directory.GetFiles(@"H:\USBFORMAT\MW3 GSCs\devraw\fx\fire");
             * for (int i = 0; i < fire_fx.Length; i++)
             * {
             *  GSCFunctions.LoadFX("fire/" + fire_fx[i].Split('\\')[6].Replace(".FXE", ""));
             * }
             */
            GSCFunctions.LoadFX("fire/jet_afterburner_harrier");
            GSCFunctions.LoadFX("smoke/jet_contrail");
            GSCFunctions.LoadFX("misc/aircraft_light_red_blink");
            GSCFunctions.LoadFX("misc/aircraft_light_wingtip_red");
            GSCFunctions.LoadFX("misc/aircraft_light_wingtip_green");

            _airdropCollision = GSCFunctions.GetEnt("care_package", "targetname");
            _airdropCollision = GSCFunctions.GetEnt(_airdropCollision.Target, "targetname");

            GSCFunctions.PreCacheMpAnim("viewmodel_airdrop_marker_sprint_loop");
            //GSCFunctions.PreCacheMpAnim("viewmodel_claymore_idle");

            string[] testAnims = new string[] { "pb_crouch_grenade_idle",
                                                "pb_crouch_stickgrenade_idle",
                                                "pb_crouch_grenade_pullpin",
                                                "pb_crouch_alert",
                                                "pb_crouch_ads",
                                                "pb_crouch_alert_pistol",
                                                "pb_crouch_ads_pistol",
                                                "pb_crouch_alert_unarmed",
                                                "pb_crouch_alert_akimbo",
                                                "pb_crouch_alert_shield",
                                                "pb_chicken_dance",
                                                "pb_chicken_dance_crouch",
                                                "pb_crouch_bombplant",
                                                "pb_crouch_remotecontroller",
                                                "pb_hold_idle",
                                                "pb_crouch_hold_idle",
                                                "pb_crouch_alert_RPG",
                                                "pb_crouch_ads_RPG" };

            //foreach (string anim in testAnims)
            //GSCFunctions.PreCacheMpAnim(anim);

            fx_eyes = GSCFunctions.LoadFX("misc/aircraft_light_wingtip_red");

            PlayerConnected += OnPlayerConnected;

            //GSCFunctions.SetDvar("scr_diehard", 2);
            GSCFunctions.SetDevDvar("developer", 2);
            GSCFunctions.SetDevDvar("developer_script", 1);
            GSCFunctions.SetDvarIfUninitialized("scr_showNotifyMessages", 1);
            GSCFunctions.SetDvar("scr_game_playerwaittime", 0);
            GSCFunctions.SetDvar("scr_game_matchstarttime", 0);

            Notified += new Action <int, string, Parameter[]>((ent, message, parameters) =>
            {
                //if (message == "trigger") return;
                if (GSCFunctions.GetDvarInt("scr_showNotifyMessages") == 0)
                {
                    return;
                }
                if (parameters.Length > 0)
                {
                    foreach (string p in parameters)
                    {
                        Utilities.PrintToConsole(ent.ToString() + ": " + message + ":" + p);
                    }
                }
                else
                {
                    Utilities.PrintToConsole(string.Format("{0} Notified " + message, ent));
                }
            });

            level = Entity.GetEntity(2046);

            /*
             * GSCFunctions.SetSunlight(new Vector3(0, 0, 1));
             * GSCFunctions.VisionSetNaked("cobra_sunset3");
             * for (int i = 18; i < 2000; i++)
             * {
             *  Entity ent = GSCFunctions.GetEntByNum(i);
             *  if (ent == null) continue;
             *  string entModel = ent.Model;
             *
             *  if (entModel == "vehicle_hummer_destructible")
             *      ent.SetModel("com_satellite_dish_big");
             *  else if (ent.TargetName == "explodable_barrel")
             *  {
             *      Entity col = GSCFunctions.GetEnt(ent.Target, "targetname");
             *      if (col != null) col.Delete();
             *      ent.Delete();
             *  }
             *  else if (ent.TargetName == "animated_model")
             *  {
             *      ent.ScriptModelClearAnim();
             *      ent.Delete();
             *      Entity placeholder = GSCFunctions.Spawn("script_model", Vector3.Zero);
             *  }
             * }
             */
            //StartAsync(testFunc());
            //StartAsync(dumpHud());
        }