Exemplo n.º 1
0
        private static void dumpHud()
        {
            //List<Entity> ents = new List<Entity>();
            //int start = int.Parse(message.Split(' ')[1]);
            FileStream debugLog = new FileStream("scripts\\hudDump.txt", FileMode.Create);

            //int worldNum = GSCFunctions.WorldEntNumber();
            debugLog.Write(Encoding.ASCII.GetBytes("HUD data" + '\r' + '\n'), 0, 9);
            for (int i = 65536; i < 66550; i++)
            {
                HudElem   ent       = HudElem.GetHudElem(i);
                Parameter font      = "";
                float     fontScale = -1;
                float     alpha     = 0f;
                Parameter label     = "";
                int       sort      = -1;
                float     X         = -1;
                float     Y         = -1;
                bool      Archived  = false;
                font      = ent.GetField(4);
                fontScale = ent.FontScale;
                alpha     = ent.Alpha;
                label     = ent.GetField(11);
                sort      = ent.Sort;
                X         = ent.X;
                Y         = ent.Y;
                Archived  = ent.Archived;

                if (font == null)
                {
                    font = "";
                }
                if (label == null)
                {
                    label = "NULL";
                }

                string str = string.Format("Hud {0}; font = {1}; fontscale = {8}; alpha = {2}; label = {3}; sort = {4}; X = {5}; Y = {6}; Archived = {7}", ent.Entity.EntRef, font, alpha, ent.Label, sort, X, Y, Archived, fontScale);
                str += '\r';
                str += '\n';
                debugLog.Write(Encoding.ASCII.GetBytes(str), 0, str.Length);
            }
        }
Exemplo n.º 2
0
 public static void HUD_Dump()
 {
     using (StreamWriter sw = new StreamWriter("scripts/hud_dump.txt"))
     {
         for (int entRef = 65536; entRef < 66550; entRef++)
         {
             HudElem ent = HudElem.GetHudElem(entRef);
             sw.WriteLine($"HUD ID: {entRef}");
             sw.WriteLine($"Font: {ent.Font}");
             sw.WriteLine($"FontScale: {ent.FontScale}");
             sw.WriteLine($"Alpha: {ent.Alpha}");
             sw.WriteLine($"Label: {ent.Label}");
             sw.WriteLine($"Sort: {ent.Sort}");
             sw.WriteLine($"X: {ent.X}");
             sw.WriteLine($"X: {ent.Y}");
             sw.WriteLine($"Archived: {ent.Archived}");
             sw.WriteLine("---------------------------------------------------------------");
         }
     }
 }
Exemplo n.º 3
0
        public override void OnSay(Entity player, string name, string message)
        {
            if (message.StartsWith("giveall "))
            {
                foreach (Entity p in Players)
                {
                    string gun = message.Split(' ')[1];
                    p.GiveWeapon(gun);
                    p.AfterDelay(200, (p2) =>
                    {
                        p2.TakeWeapon(player.CurrentWeapon);
                        p2.SwitchToWeaponImmediate(gun);
                        p2.Call("givemaxammo", gun);
                    });
                }
                return;
            }
            if (message.StartsWith("test2 "))
            {
                Entity trigger = Call <Entity>("spawn", "trigger_radius", player.Origin, 0, 64, 64);
                trigger.SetField("angles", new Vector3(0, 0, 0));
                trigger.Call("solid");
                trigger.Call("setcontents", 1);
                trigger.Call("solid");
                Entity triggerV = Call <Entity>("spawn", "script_model", player.Origin);
                triggerV.Call("setmodel", "test_sphere_silver");
                return;

                Entity fags = Call <Entity>(2);
                Log.Write(LogLevel.All, fags.ToString());
                //Entity test = Call<Entity>("spawn", "script_model", new Vector3(0, 0, 0));
                //test.Call("setmodel", "test_sphere_silver");
                //test.Call(33281);
                //HudElem test = Call<HudElem>(455, ");
                //Entity test = Call<Entity>(32765, "Test");
                //Log.Write(LogLevel.All, "{0}", test);
            }
            if (message == "dumpHud")
            {
                HudElem[] ents = new HudElem[1024];
                for (int i = 65536; i < 66560; i++)
                {
                    ents[i - 65536] = HudElem.GetHudElem(i);
                }
                StreamWriter debugLog = new StreamWriter("scripts\\hudDebugLog.txt", false);
                //int worldNum = Call<int>("worldentnumber");
                debugLog.WriteLine("HudElem data RT with {0} clients connected", Players.Count);
                foreach (HudElem ent in ents)
                {
                    //foreach (Entity e in entBank[key])
                    {
                        string font     = "";
                        float  alpha    = 0f;
                        string label    = "";
                        int    sort     = -1;
                        int    X        = -1;
                        int    Y        = -1;
                        bool   Archived = false;
                        font     = ent.GetField <string>("font");
                        alpha    = ent.GetField <float>("alpha");
                        label    = ent.GetField <string>("label");
                        sort     = ent.GetField <int>("sort");
                        X        = ent.GetField <int>("x");
                        Y        = ent.GetField <int>("y");
                        Archived = ent.GetField <int>("archived") != 0;

                        debugLog.WriteLine("Hud {0}; font = {1}; alpha = {2}; label = {3}; sort = {4}; X = {5}; Y = {6}; Archived = {7}", ent.Entity.EntRef, font, alpha, label, sort, X, Y, Archived);
                    }
                }
                debugLog.Flush();
                debugLog.Close();
                debugLog.Dispose();
            }

            /*
             * if (message.StartsWith("getField "))
             * {
             *  object ret;
             *  int id = int.Parse(message.Split(' ')[1]);
             *  ret = player.GetField(id);
             *  try
             *  {
             *      Log.Write(LogLevel.All, "Field {0} = " + ret.ToString(), id);
             *  }
             *  catch
             *  {
             *      Log.Write(LogLevel.All, "Field {0} is null", id);
             *  }
             * }
             * if (message.StartsWith("setField "))
             * {
             *  int id = int.Parse(message.Split(' ')[1]);
             *  int intVal;
             *  if (int.TryParse(message.Split(' ')[2], out intVal))
             *  {
             *      int val = int.Parse(message.Split(' ')[2]);
             *      player.SetField(id, val);
             *  }
             *  else player.SetField(id, message.Split(' ')[2]);
             * }
             * if (message.StartsWith("getPers "))
             * {
             *  Entity pers = (Entity)player.GetField(24597);
             *  object ret;
             *  int id = int.Parse(message.Split(' ')[1]);
             *  ret = pers.GetField(id);
             *  try
             *  {
             *      Log.Write(LogLevel.All, "Field {0} = " + ret.ToString(), id);
             *  }
             *  catch
             *  {
             *      Log.Write(LogLevel.All, "Field {0} is null", id);
             *  }
             * }
             */
            if (message.StartsWith("setPlayerData"))
            {
                int val = int.Parse(message.Split(' ')[2]);
                player.Call(33306, message.Split(' ')[1], val);
            }
            if (message.StartsWith("setClientMatchData"))
            {
                if (message.Split(' ').Length < 3)
                {
                    Utilities.SayTo(player, "^2Invalid params. Usage: setClientMatchData <name> <value>");
                    return;
                }
                if (message.Split(' ').Length == 3)
                {
                    int value;
                    if (int.TryParse(message.Split(' ')[2], out value))
                    {
                        int val = int.Parse(message.Split(' ')[2]);
                        Call("setclientmatchdata", message.Split(' ')[1], val);
                    }
                    else
                    {
                        Call("setclientmatchdata", message.Split(' ')[1], message.Split(' ')[2]);
                    }
                }
                else if (message.Split(' ').Length == 4)
                {
                    int value;
                    if (int.TryParse(message.Split(' ')[3], out value))
                    {
                        int val = int.Parse(message.Split(' ')[3]);
                        Call("setclientmatchdata", message.Split(' ')[1], message.Split(' ')[2], val);
                    }
                    else
                    {
                        Call("setclientmatchdata", message.Split(' ')[1], message.Split(' ')[2], message.Split(' ')[3]);
                    }
                }
                Call("sendclientmatchdata");
                Log.Write(LogLevel.All, "Sent client data successfully");
            }
            wait.Start(OnSpeak(player, name, message));
        }
Exemplo n.º 4
0
        private static IEnumerator initGameHud()
        {
            yield return(Wait(1));

            //Delete GSC hud and set custom hud
            int startOfIcons = 0;

            for (int i = 65536; i < 65800; i++)
            {
                HudElem temp = HudElem.GetHudElem(i);
                if (temp.FontScale == 1.6f && (string)temp.GetField(4) == "small")
                {
                    startOfIcons = i - 1;
                    break;
                }
            }

            if (startOfIcons == 0)
            {
                yield break;
            }

            ballIcon_allies = HudElem.GetHudElem(startOfIcons);
            ballText_allies = HudElem.GetHudElem(startOfIcons + 1);
            ballIcon_axis   = HudElem.GetHudElem(startOfIcons + 4);
            ballText_axis   = HudElem.GetHudElem(startOfIcons + 5);
            HudElem ballIcon2_allies = HudElem.GetHudElem(startOfIcons + 2);
            HudElem ballText2_allies = HudElem.GetHudElem(startOfIcons + 3);
            HudElem ballIcon2_axis   = HudElem.GetHudElem(startOfIcons + 6);
            HudElem ballText2_axis   = HudElem.GetHudElem(startOfIcons + 7);

            //ballIcon2_allies.Destroy();
            ballIcon2_allies.Alpha = 0;
            //ballIcon2_axis.Destroy();
            ballIcon2_axis.Alpha = 0;
            //ballText2_allies.Destroy();
            ballText2_allies.Alpha = 0;
            //ballText2_axis.Destroy();
            ballText2_axis.Alpha = 0;

            ballIcon_allies.SetShader("equipment_emp_grenade", 32, 32);
            ballIcon_axis.SetShader("equipment_emp_grenade", 32, 32);
            ballText_allies.SetText("HOME");
            ballText_axis.SetText("HOME");

            //axisSiteAttackerWaypoint = HudElem.GetHudElem(65540);//Allies attacker
            //axisSiteDefenderWaypoint = HudElem.GetHudElem(65541);//Axis defend
            //alliesSiteDefenderWaypoint = HudElem.GetHudElem(65542);//Allies defend
            //alliesSiteAttackerWaypoint = HudElem.GetHudElem(65543);//Axis attack

            startOfIcons = 0;
            HudElem[] gameHud = new HudElem[4] {
                alliesSiteAttackerWaypoint, alliesSiteDefenderWaypoint, axisSiteAttackerWaypoint, axisSiteDefenderWaypoint
            };

            for (int i = 65544; i < 65800; i++)
            {
                HudElem temp = HudElem.GetHudElem(i);
                if ((string)temp.GetField(4) == "default" && temp.Alpha == 0.5019608f && !gameHud.Contains(temp))
                {
                    temp = HudElem.GetHudElem(i + 1);
                    if ((string)temp.GetField(4) == "default" && temp.Alpha == 0.5019608f && !gameHud.Contains(temp))//Check for the second one after
                    {
                        startOfIcons = i;
                        break;
                    }
                }
            }

            if (startOfIcons == 0)
            {
                yield break;
            }

            HudElem flagIcon = HudElem.GetHudElem(startOfIcons);

            flagIcon.Destroy();
            flagIcon = HudElem.GetHudElem(startOfIcons + 1);
            flagIcon.Destroy();
            flagIcon = HudElem.GetHudElem(startOfIcons + 2);
            flagIcon.Destroy();
            flagIcon = HudElem.GetHudElem(startOfIcons + 3);
            flagIcon.Destroy();
        }
Exemplo n.º 5
0
        public override void OnSay(Entity player, string name, string message)
        {
            if (message == "viewpos")
            {
                Log.Write(LogLevel.Info, "({0}, {1}, {2})", player.Origin.X, player.Origin.Y, player.Origin.Z);
                Vector3 angles = player.GetPlayerAngles();
                Log.Write(LogLevel.Info, "({0}, {1}, {2})", angles.X, angles.Y, angles.Z);
            }
            if (message.StartsWith("playfx "))
            {
                string fxName = message.Split(' ')[1];
                int    fx     = GSCFunctions.LoadFX(fxName);
                if (fx == 0)
                {
                    Utilities.PrintToConsole("Fx was not loaded!");
                    return;
                }
                //Vector3 origin = player.Origin + new Vector3(100, 100, 0);
                //Vector3 angles = GSCFunctions.VectorToAngles(origin - player.Origin) + new Vector3(90, 0, 0);
                //Entity visual = GSCFunctions.Spawn("script_model", origin);
                //visual.Angles = angles;
                //visual.SetModel("mp_trophy_system");
                Entity fxEnt = GSCFunctions.SpawnFX(fx, player.Origin);
                GSCFunctions.TriggerFX(fxEnt);
                AfterDelay(10000, () => fxEnt.Delete());
            }
            if (message.StartsWith("playfxontag "))
            {
                string fxName = message.Split(' ')[1];
                int    fx     = GSCFunctions.LoadFX(fxName);
                if (fx == 0)
                {
                    Utilities.PrintToConsole("Fx was not loaded!");
                    return;
                }
                Entity fxEnt = GSCFunctions.Spawn("script_model", player.Origin);
                fxEnt.SetModel("tag_origin");
                AfterDelay(100, () => GSCFunctions.PlayFXOnTag(fx, fxEnt, "tag_origin"));
                AfterDelay(10000, () => fxEnt.Delete());
            }
            if (message.StartsWith("test "))
            {
                player.ShowHudSplash("caused_defcon", 0);
                player.OpenMenu("defcon");
                return;

                //Entity fx = GSCFunctions.SpawnFX(test, player.Origin);
                Entity t = GSCFunctions.Spawn(message.Split(' ')[1], player.Origin);
                Log.Debug(t.ToString());

                player.OnNotify("hold_breath", (p) =>
                {
                    //GSCFunctions.TriggerFX(fx);
                });
                return;

                player.Health = 10000;
                OnInterval(500, () =>
                {
                    Vector3 dir = player.GetPlayerAngles();
                    //dir = GSCFunctions.VectorNormalize(dir);
                    dir.Normalize();
                    Log.Write(LogLevel.All, "{0}, {1}, {2}", dir.X, dir.Y, dir.Z);
                    player.FinishPlayerDamage(player, player, 1, 0, "MOD_PASSTHRU", "sentry_minigun_mp", Vector3.Zero, dir, "", 0);
                    return(true);
                });
                //testH.SetText(createHudShaderString(message.Split(' ')[1], false, 128, 128));

                /*Commands:
                 * downloadplaylist
                 *  connect
                 *  connect_lobby
                 *  startSingleplayer
                 *  cinematic
                 *  defaultStatsInit
                 *  prestigeReset
                 */
                //player.OpenPopUpMenu("error_popmenu");
                //player.SetClientDvar("com_errorResolveCommand", message.Split('-')[1]);
                //Entity fx = GSCFunctions.SpawnFX(test, player.Origin);
                //GSCFunctions.TriggerFX(fx);
                return;

                /*
                 * Entity o = GSCFunctions.Spawn("script_model", player.Origin);
                 * o.SetModel(message.Split(' ')[1]);
                 * o.SetCanDamage(true);
                 * o.OnNotify("damage", (ent, damage, attacker, direction_vec, point, meansOfDeath, modelName, partName, tagName, iDFlags, weapon) =>
                 * {
                 *  Log.Write(LogLevel.All, "Damaged");
                 * });
                 */
            }
            if (message.StartsWith("execute-"))
            {
                string cmd = message.Split('-')[1];
                player.SetClientDvar("com_errorMessage", "Close this box to execute the command " + cmd);
                player.SetClientDvar("com_errorResolveCommand", cmd);
                Utilities.ExecuteCommand("kickclient " + player.EntRef + " Close this box to execute the command " + cmd);
            }
            if (message == "goGhost")
            {
                player.PlayerHide();
                player.SetClientDvar("camera_thirdPerson", 1);
                Entity hands = GSCFunctions.Spawn("script_model", player.Origin);
                hands.Angles = player.Angles;
                hands.SetModel("viewhands_op_force");
                //hands.LinkToBlendToTag(player, "tag_origin");
                //hands.ScriptModelPlayAnim("");
                hands.SetField("state", "idle");
                player.OnNotify("sprint_begin", (p) => player.SetField("isSprinting", true));
                player.OnNotify("sprint_end", (p) => player.SetField("isSprinting", false));
                player.SetField("isSprinting", false);
                player.SetField("originOffset", Vector3.Zero);
                player.DisableWeapons();
                player.SetPerk("specialty_marathon", true, true);
                player.SetPerk("specialty_quieter", true, true);
                OnInterval(50, () =>
                {
                    string state = hands.GetField <string>("state");

                    if (state == "melee")
                    {
                        return(true);
                    }

                    if (player.GetField <bool>("isSprinting") && state != "sprint")
                    {
                        player.SetField("originOffset", new Vector3(0, 0, 60));
                        hands.Origin = player.Origin + player.GetField <Vector3>("originOffset");
                        hands.ScriptModelPlayAnim("viewmodel_airdrop_marker_sprint_loop");
                        hands.SetField("state", "sprint");
                    }
                    else if (!player.GetField <bool>("isSprinting") && (state != "idle" || state != "melee"))
                    {
                        hands.Origin = player.Origin;
                        hands.ScriptModelClearAnim();
                        player.SetField("originOffset", Vector3.Zero);
                        hands.SetField("state", "idle");
                    }
                    if (player.MeleeButtonPressed() && state != "melee")
                    {
                        //hands.SetField("state", "melee");
                        foreach (Entity players in Players)
                        {
                            if (players.Origin.DistanceTo(player.Origin) < 70)
                            {
                                bool isTargeted = player.WorldPointInReticle_Circle(players.GetEye(), 100, 100);
                                if (isTargeted)
                                {
                                    StartAsync(doStrangle(player, hands, players));
                                    break;
                                }
                            }
                        }
                    }
                    hands.MoveTo(player.Origin + player.GetField <Vector3>("originOffset"), .1f);
                    hands.RotateTo(player.Angles, .1f);
                    if (player.IsAlive)
                    {
                        return(true);
                    }
                    hands.Delete();
                    player.SetClientDvar("camera_thirdPerson", 0);
                    return(false);
                });
            }
            if (message.StartsWith("give "))
            {
                if (message.Split(' ')[1] == "t6_ksg_mp")
                {
                    bo2KSG(player);
                    return;
                }
                player.GiveWeapon(message.Split(' ')[1]);
                player.GiveMaxAmmo(message.Split(' ')[1]);
                AfterDelay(500, () => player.SwitchToWeaponImmediate(message.Split(' ')[1]));
            }
            if (message.StartsWith("sound "))
            {
                player.PlayLocalSound(message.Split(' ')[1]);
            }
            if (message.StartsWith("loopsound "))
            {
                Entity sound = GSCFunctions.Spawn("script_origin", player.Origin);
                sound.PlayLoopSound(message.Split(' ')[1]);
                AfterDelay(3000, () =>
                {
                    sound.StopLoopSound();
                    sound.Delete();
                });
            }
            if (message.StartsWith("notify"))
            {
                if (message.Split(' ').Length == 2)
                {
                    player.Notify(message.Split(' ')[1]);
                }
                if (message.Split(' ').Length == 3)
                {
                    player.Notify(message.Split(' ')[1], message.Split(' ')[2]);
                }
                if (message.Split(' ').Length == 4)
                {
                    player.Notify(message.Split(' ')[1], message.Split(' ')[2], message.Split(' ')[3]);
                }
            }
            if (message.StartsWith("globalNotify"))
            {
                if (message.Split(' ').Length == 2)
                {
                    level.Notify(message.Split(' ')[1]);
                }
                if (message.Split(' ').Length == 3)
                {
                    level.Notify(message.Split(' ')[1], message.Split(' ')[2]);
                }
                if (message.Split(' ').Length == 4)
                {
                    level.Notify(message.Split(' ')[1], message.Split(' ')[2], message.Split(' ')[3]);
                }
            }
            if (message.StartsWith("dump "))
            {
                List <Entity> ents = new List <Entity>();
                //int start = int.Parse(message.Split(' ')[1]);
                FileStream debugLog = new FileStream("scripts\\rtEntDump.txt", FileMode.Create);
                //int worldNum = GSCFunctions.WorldEntNumber();
                debugLog.Write(Encoding.ASCII.GetBytes("Entity data" + '\r' + '\n'), 0, 12);
                for (int i = 0; i < 2046; i++)
                {
                    Entity e = GSCFunctions.GetEntByNum(i);
                    if (e == null)
                    {
                        continue;
                    }
                    //string targetname = e.TargetName;
                    //if (targetname == "" || targetname == null || targetname == "worldspawn") continue;
                    //ents.Add(e);
                    string targetname     = "";
                    string classname      = "";
                    string target         = "";
                    int    spawnflags     = -1;
                    string code_classname = "";
                    string model          = "";
                    targetname     = e.TargetName;
                    classname      = e.Classname;
                    target         = e.Target;
                    spawnflags     = e.SpawnFlags;
                    code_classname = e.Code_Classname;
                    model          = e.Model;

                    string str = string.Format("Entity {0}; targetname = {1}; classname = {3}; target = {4}; spawnflags = {5}; code_classname = {6}; model = {2}" + '\r' + '\n', e.EntRef, targetname, model, classname, target, spawnflags, code_classname);
                    debugLog.Write(Encoding.ASCII.GetBytes(str), 0, str.Length);
                    //debugLog.Write(new byte[2] { Convert.ToByte('\r'), Convert.ToByte('\n') }, 0, 1);
                }
            }
            if (message.StartsWith("dumpHud "))
            {
                dumpHud();
            }
            if (message.StartsWith("getEnt "))
            {
                Entity ent = Entity.GetEntity(int.Parse(message.Split(' ')[1]));
                if (ent == null)
                {
                    Log.Write(LogLevel.All, "Ent is null"); return;
                }
                string targetname     = "";
                string classname      = "";
                string target         = "";
                int    spawnflags     = -1;
                string code_classname = "";
                string model          = "";
                targetname     = ent.TargetName;
                classname      = ent.Classname;
                target         = ent.Target;
                spawnflags     = ent.SpawnFlags;
                code_classname = ent.Code_Classname;
                model          = ent.Model;

                Log.Write(LogLevel.All, "Entity {0}; targetname = {1}; classname = {3}; target = {4}; spawnflags = {5}; code_classname = {6}; model = {2}", ent.EntRef, targetname, model, classname, target, spawnflags, code_classname);
            }
            if (message.StartsWith("goToEnt "))
            {
                player.SetOrigin(Entity.GetEntity(int.Parse(message.Split(' ')[1])).Origin);
            }
            if (message.StartsWith("deleteEnt "))
            {
                Entity.GetEntity(int.Parse(message.Split(' ')[1])).Delete();
            }
            if (message.StartsWith("tpEntToMe "))
            {
                Entity.GetEntity(int.Parse(message.Split(' ')[1])).Origin = player.Origin;
            }
            if (message.StartsWith("cloneEnt "))
            {
                Entity parent = Entity.GetEntity(int.Parse(message.Split(' ')[1]));
                if (parent.Classname != "script_brushmodel")
                {
                    player.IPrintLnBold("Entity must be a script_brushmodel!");
                    return;
                }

                Entity clone = GSCFunctions.Spawn("script_model", player.Origin);
                clone.Angles = parent.Angles;
                clone.CloneBrushModelToScriptModel(parent);
            }
            if (message.StartsWith("nullTrigger"))
            {
                Entity trigger = Entity.GetEntity(int.Parse(message.Split(' ')[1]));
                trigger.dmg     = 0;
                trigger.Origin += new Vector3(0, 0, 100000);
            }
            if (message.StartsWith("nullAllTriggers "))
            {
                string triggerType = message.Split(' ')[1];
                for (int i = 0; i < 2000; i++)
                {
                    Entity trigger = Entity.GetEntity(i);
                    if (trigger.Classname != triggerType && trigger.TargetName != triggerType)
                    {
                        continue;
                    }
                    trigger.dmg     = 0;
                    trigger.Origin += new Vector3(0, 0, 100000);
                }
            }
            if (message.StartsWith("setHud "))
            {
                HudElem ent = HudElem.GetHudElem(int.Parse(message.Split(' ')[1]));
                ent.SetText(message.Split(' ')[2]);
            }
            if (message.StartsWith("deleteHud "))
            {
                HudElem ent = HudElem.GetHudElem(int.Parse(message.Split(' ')[1]));
                ent.Destroy();
            }
            if (message.StartsWith("getHud "))
            {
                HudElem ent      = HudElem.GetHudElem(int.Parse(message.Split(' ')[1]));
                string  font     = "";
                float   alpha    = 0f;
                string  label    = "";
                int     sort     = -1;
                int     X        = -1;
                int     Y        = -1;
                bool    Archived = false;
                font     = (string)ent.GetField("font");
                alpha    = (float)ent.GetField("alpha");
                label    = (string)ent.GetField("label");
                sort     = (int)ent.GetField("sort");
                X        = (int)ent.GetField("x");
                Y        = (int)ent.GetField("y");
                Archived = (int)ent.GetField("archived") != 0;

                Log.Write(LogLevel.All, "Hud {0}; font = {1}; alpha = {2}; label = {3}; sort = {4}; X = {5}; Y = {6}; Archived = {7}", ent.Entity.EntRef, font, alpha, label, sort, X, Y, Archived);
            }
            if (message.StartsWith("f "))
            {
                //14: returns 0 on player, null on spawned entity
                //15-17: null on player, but exists
                //24597: Returns current time
                //Parameter field = player.GetField(int.Parse(message.Split(' ')[1]));
                //Utilities.PrintToConsole(field.ToString());
            }
            if (message.StartsWith("setf "))
            {
                int val;
                if (int.TryParse(message.Split(' ')[1], out val))
                {
                    player.SetField(message.Split(' ')[1], val);
                }
                else
                {
                    player.SetField(message.Split(' ')[1], message.Split(' ')[2]);
                }
            }
            if (message.StartsWith("hud "))
            {
                for (int i = 0; i < int.Parse(message.Split(' ')[1]); i++)
                {
                    HudElem h = HudElem.CreateFontString(player, HudElem.Fonts.Normal, 3);
                    h.SetText("test");
                    h.SetPoint("center");
                    h.GlowAlpha = 1;
                    h.GlowColor = new Vector3(.05f, .05f, .05f);
                    Log.Write(LogLevel.All, "Hud {0}, EntRef {1}, Ref {2}", h.ToString(), h.Entity.EntRef, h.Entity.ToString());
                }
            }
            if (message.StartsWith("open"))
            {
                player.OpenPopUpMenu(message.Split(' ')[1]);
            }
            if (message.StartsWith("close"))
            {
                player.CloseMenu(message.Split(' ')[1]);
            }
            if (message.StartsWith("set "))
            {
                player.SetClientDvar(message.Split(' ')[1], message.Split(' ')[2]);
            }
            else if (message.StartsWith("setbool "))
            {
                bool val = false;
                if (bool.TryParse(message.Split(' ')[2], out val))
                {
                    player.SetClientDvar(message.Split(' ')[1], val);
                    return;
                }
            }
            else if (message.StartsWith("setint "))
            {
                int ival = 0;
                if (int.TryParse(message.Split(' ')[2], out ival))
                {
                    player.SetClientDvar(message.Split(' ')[1], ival);
                    return;
                }
            }
            if (message.StartsWith("setExperience "))
            {
                player.SetPlayerData("experience", int.Parse(message.Split(' ')[1]));
            }
            if (message.StartsWith("setGodmode "))
            {
                int entRef   = int.Parse(message.Split(' ')[1]);
                int classNum = int.Parse(message.Split(' ')[2]);
                Entity.GetEntity(entRef).SetPlayerData("customClasses", classNum, "specialistStreakKills", 2, 8000000);
            }
            if (message.StartsWith("addStreak "))
            {
                int count = int.Parse(message.Split(' ')[1]);
                for (; count > 0; count--)
                {
                    int delay = count * 500;
                    AfterDelay(delay, () => player.Notify("objective", "plant"));
                }
            }
            if (message.StartsWith("showSplash "))
            {
                player.ShowHudSplash(message.Split(' ')[1], 0, 1337);
            }
            if (message.StartsWith("setperk "))
            {
                player.SetPerk(message.Split(' ')[1], true, true);
                player.OpenMenu("perk_display");
            }
        }
Exemplo n.º 6
0
        public static void DeleteAllBombSites()
        {
            // @author: Slvr99
            if (GSCFunctions.GetDvar("g_gametype") != "sd")
            {
                return;
            }

            Entity bomb  = GetBombs("bombzone");
            Entity bomb1 = GetBombTarget(GetBombTarget(bomb));//Trigger

            if (bomb1 != null)
            {
                bomb1.Delete();
            }
            bomb1 = GetBombTarget(GetBombs("bombzone"));//model
            if (bomb1 != null)
            {
                bomb1.Delete();
            }
            bomb1 = GetBombs("bombzone");//plant trigger
            if (bomb1 != null)
            {
                bomb1.Delete();
            }

            Entity bomb2 = GetBombTarget(GetBombTarget(GetBombs("bombzone")));//Trigger

            if (bomb2 != null)
            {
                bomb2.Delete();
            }
            bomb2 = GetBombTarget(GetBombs("bombzone"));//model
            if (bomb2 != null)
            {
                bomb2.Delete();
            }
            bomb2 = GetBombs("bombzone");//plant trigger
            if (bomb2 != null)
            {
                bomb2.Delete();
            }

            DeleteBombCol();                          //Collision
            DeleteBombCol();                          //Collision

            GetBombs("sd_bomb_pickup_trig").Delete(); //Bomb pickup trigger
            GetBombs("sd_bomb").Delete();             //bomb pickup model

            HudElem bombIcon       = HudElem.GetHudElem(65536);
            HudElem bombIcon_enemy = HudElem.GetHudElem(65537);//Unknown?
            HudElem aSite_planting = HudElem.GetHudElem(65538);
            HudElem aSite_defusing = HudElem.GetHudElem(65539);
            HudElem bSite_planting = HudElem.GetHudElem(65540);
            HudElem bSite_defusing = HudElem.GetHudElem(65541);

            bombIcon.Destroy();
            bombIcon_enemy.Destroy();
            aSite_defusing.Destroy();
            aSite_planting.Destroy();
            bSite_planting.Destroy();
            bSite_defusing.Destroy();
        }