private static void playBallFX() { if (!ballEnt.GetField <bool>("beingCarried")) { stopBallFX(); //Log.Write(LogLevel.All, "Playing Ball FX"); AfterDelay(200, () => GSCFunctions.PlayFXOnTag(ballGlow, ballEnt, "j_gun")); } }
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"); } }