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; }
public heros() { //Call("precacheitem", "iw5_mk12spr_mp"); GSCFunctions.PreCacheShellShock("dog_bite"); GSCFunctions.PreCacheShader("compassping_portable_radar_sweep"); tempestFX = GSCFunctions.LoadFX("explosions/powerlines_c"); fireflyFX = GSCFunctions.LoadFX("misc/insects_carcass_runner"); PlayerConnected += onPlayerConnect; }
public a10() { GSCFunctions.PreCacheModel("vehicle_a10_warthog"); GSCFunctions.PreCacheMpAnim("MP_A10_strafing_run"); GSCFunctions.PreCacheShader("compass_objpoint_a10_friendly"); GSCFunctions.PreCacheShader("compass_objpoint_a10_enemy"); GSCFunctions.PreCacheMiniMapIcon("compass_objpoint_a10_friendly"); GSCFunctions.PreCacheMiniMapIcon("compass_objpoint_a10_enemy"); Dictionary <string, int> a10_fx = new Dictionary <string, int>(); a10_fx.Add("bullet_rain", GSCFunctions.LoadFX("misc/warthog_volley_runner")); a10_fx.Add("bullet_impacts", GSCFunctions.LoadFX("impacts/warthog_volley_runner")); a10_fx.Add("bullet_dust", GSCFunctions.LoadFX("dust/wing_drop_dust")); a10_fx.Add("afterburner", GSCFunctions.LoadFX("fire/jet_afterburner")); a10_fx.Add("contrail", GSCFunctions.LoadFX("smoke/jet_contrail")); a10_fx.Add("wingtip_light_green", GSCFunctions.LoadFX("misc/aircraft_light_wingtip_green")); a10_fx.Add("wingtip_light_red", GSCFunctions.LoadFX("misc/aircraft_light_wingtip_red")); level.SetField("a10_fx", new Parameter(a10_fx)); level.SetField("a10MaxHealth", 350); }
public Glowstick() { GSCFunctions.PreCacheItem("lightstick_mp"); fx_glowstickGlow = GSCFunctions.LoadFX("misc/glow_stick_glow_green"); PlayerConnected += OnPlayerConnected; }
public ball() { string gametype = GSCFunctions.GetDvar("g_gametype"); if (gametype != "ctf") { Log.Write(LogLevel.Info, "Gametype must be set to CTF for Uplink. Restarting..."); GSCFunctions.SetDvar("g_gametype", "ctf"); Utilities.ExecuteCommand("map_restart"); return; } GSCFunctions.PreCacheItem(ballWeapon); GSCFunctions.PreCacheShader("waypoint_defend"); GSCFunctions.PreCacheShader("waypoint_target"); GSCFunctions.PreCacheShader("waypoint_kill"); GSCFunctions.PreCacheShader("waypoint_targetneutral"); GSCFunctions.PreCacheShader("equipment_emp_grenade"); ballGlow = GSCFunctions.LoadFX("misc/aircraft_light_wingtip_green"); ballSiteFX = GSCFunctions.LoadFX("misc/ui_flagbase_gold"); alliesSiteFX = GSCFunctions.LoadFX("misc/ui_flagbase_red"); axisSiteFX = GSCFunctions.LoadFX("misc/ui_flagbase_silver"); ballContrail = GSCFunctions.LoadFX("misc/light_semtex_geotrail"); ballExplodeFX = GSCFunctions.LoadFX("explosions/emp_grenade"); GSCFunctions.SetDevDvarIfUninitialized("scr_ball_scorelimit", 10); //GSCFunctions.SetDevDvarIfUninitialized("scr_ball_halftime", 0); //GSCFunctions.SetDevDvarIfUninitialized("scr_ball_overtime", 0); StartAsync(setGameScoreLimit()); StartAsync(setGameHalftimeSetting()); Log.Debug(isHalftime.ToString()); //Delete flags Entity obj = GSCFunctions.GetEnt("ctf_zone_axis", "targetname"); axisSite = obj.Origin; //obj.Delete(); axisFlagBase = Entity.GetEntity(obj.EntRef); Entity flag = GSCFunctions.GetEnt("ctf_flag_axis", "targetname"); //flag.Delete(); axisFlag = Entity.GetEntity(flag.EntRef); Entity trig = GSCFunctions.GetEnt("ctf_trig_axis", "targetname"); axisFlagTrig = Entity.GetEntity(trig.EntRef); obj = GSCFunctions.GetEnt("ctf_zone_allies", "targetname"); alliesSite = obj.Origin; //obj.Delete(); alliesFlagBase = Entity.GetEntity(obj.EntRef); flag = GSCFunctions.GetEnt("ctf_flag_allies", "targetname"); //flag.Delete(); alliesFlag = Entity.GetEntity(flag.EntRef); trig = GSCFunctions.GetEnt("ctf_trig_allies", "targetname"); alliesFlagTrig = Entity.GetEntity(trig.EntRef); StartAsync(getFlagTriggers()); //Teleport flags under map and hide them axisFlagBase.Origin -= new Vector3(0, 0, 1000); axisFlagBase.Hide(); axisFlag.Origin -= new Vector3(0, 0, 1000); axisFlag.Hide(); axisFlagTrig.Origin -= new Vector3(0, 0, 1000); alliesFlagBase.Origin -= new Vector3(0, 0, 1000); alliesFlagBase.Hide(); alliesFlag.Origin -= new Vector3(0, 0, 1000); alliesFlag.Hide(); alliesFlagTrig.Origin -= new Vector3(0, 0, 1000); //Init stations and ball locations site = GSCFunctions.GetEnt("sab_bomb", "targetname").Origin; spawnBall(site); StartAsync(spawnStations(alliesSite, axisSite)); OnNotify("game_ended", (reason) => { gameEnded = true; if ((int)GSCFunctions.GetMatchData("alliesScore") == 1) { //GSCFunctions.SetDvar("scr_ball_halftime", 0);//Reset dvar if it's set GSCFunctions.SetMatchData("alliesScore", 0); } if ((string)reason == "halftime") { //GSCFunctions.SetDvar("scr_ball_halftime", 1); GSCFunctions.SetMatchData("alliesScore", 1); } }); OnNotify("prematch_over", () => prematchOver = true); //Set ball throw time GSCFunctions.SetDvar("perk_weapRateMultiplier", 0.3f); PlayerConnected += onPlayerConnect; Notified += onNotify; StartAsync(initGameHud()); }
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"); } }
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()); }
private static void Init() { Events.DSRLoad.Add((sender, args) => { if (args.TryGetOpt("custom_gametype", out var value)) { ServerStr.ReportedGameType = value; Log.Debug(value); } }); Config.Load(); Utils.SetObjectiveText(); #region Commands // SETFLY Command.TryRegister(SmartParse.CreateCommand( name: "setfly", argTypes: new[] { SmartParse.Player, SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { Entity ent = args[0] as Entity; bool state = (bool)args[1]; ent.SetField("EnableFly", state); if (state) { if (!ent.IsFieldTrue("InitializedFly")) { Utils.InitializeFly(ent); } Utils.DoFly(ent); } sender.Tell($"%nFly for %p{ent.Name} %nset to %i{state}"); }, usage: "!setfly <player> <state>", permission: "setfly", description: "Enables or disables fly for the specified player")); // MYFLY Command.TryRegister(SmartParse.CreateCommand( name: "myfly", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("EnableFly", state); if (state) { if (!sender.IsFieldTrue("InitializedFly")) { Utils.InitializeFly(sender); } Utils.DoFly(sender); } sender.Tell($"%nFly set to %i{state}"); }, usage: "!myfly <state>", permission: "myfly", description: "Enables or disables fly")); // UNLIMITEDAMMO Command.TryRegister(SmartParse.CreateCommand( name: "unlimitedammo", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("UnlimitedAmmo", state); if (state) { BaseScript.OnInterval(1, () => { if (!sender.IsFieldTrue("UnlimitedAmmo")) { return(false); } sender.SetWeaponAmmoClip(sender.CurrentWeapon, int.MaxValue, "right"); sender.SetWeaponAmmoClip(sender.CurrentWeapon, int.MaxValue, "left"); sender.SetWeaponAmmoStock(sender.CurrentWeapon, int.MaxValue); return(true); }); } sender.Tell($"%nUnlimited ammo set to %i{state}"); }, usage: "!unlimitedammo <state>", permission: "unlimitedammo", description: "Enables or disables unlimited ammo")); // UNLIMITEDAMMOWITHRELOAD Command.TryRegister(SmartParse.CreateCommand( name: "unlimitedammowithreload", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("UnlimitedAmmoReload", state); if (state) { BaseScript.OnInterval(1, () => { if (!sender.IsFieldTrue("UnlimitedAmmoReload")) { return(false); } sender.SetWeaponAmmoStock(sender.CurrentWeapon, int.MaxValue); return(true); }); } sender.Tell($"%nUnlimited ammo with reload set to %i{state}"); }, usage: "!unlimitedammowithreload <state>", permission: "unlimitedammowithreload", description: "Enables or disables unlimited ammo with reload")); // UNLIMITEDGRENADES Command.TryRegister(SmartParse.CreateCommand( name: "unlimitedgrenades", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("UnlimitedGrenades", state); if (state) { Events.GrenadeFire.Add((sender1, arguments) => { if (arguments.Player.IsFieldTrue("UnlimitedGrenades")) { arguments.Player.GiveWeapon(arguments.Grenade); } }); } sender.Tell($"%nUnlimited grenades set to %i{state}"); }, usage: "!unlimitedgrenades <state>", permission: "unlimitedgrenades", description: "Enables or disables unlimited grenades")); // AIMBOT Command.TryRegister(SmartParse.CreateCommand( name: "myaimbot", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("EnableAimbot", state); if (state) { Utils.DoAimbot(sender); } sender.Tell($"%nAimbot set to %i{state}"); }, usage: "!myaimbot <state>", permission: "myaimbot", description: "Enables or disables aimbot")); // SILENTAIM Command.TryRegister(SmartParse.CreateCommand( name: "mysilentaim", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("EnableSilentAim", state); Utils.SetupSilentAim(); sender.Tell($"%nSilentAim set to %i{state}"); }, usage: "!mysilentaim <state>", permission: "mysilentaim", description: "Enables or disables silentaim")); // AIMASSIST Command.TryRegister(SmartParse.CreateCommand( name: "myaimassist", argTypes: new[] { SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { bool state = (bool)args[0]; sender.SetField("EnableAimAssist", state); if (state) { Utils.DoAimAssist(sender); } sender.Tell($"%nAimAssist set to %i{state}"); }, usage: "!myaimassist <state>", permission: "myaimassist", description: "Enables or disables aimassist")); // AKIMBO Command.TryRegister(SmartParse.CreateCommand( name : "akimbo", argTypes : null, action : delegate(Entity sender, object[] args) { Utils.AkimboPrimary(sender); sender.Tell($"%nAkimbo primary enabled"); }, usage: "!akimbo", permission: "akimbo", description: "Enables akimbo primary")); // TPHERE Command.TryRegister(SmartParse.CreateCommand( name : "akimbomode", argTypes : null, action : delegate(Entity sender, object[] args) { Events.PlayerSpawned.Add((sender1, args1) => { Utils.AkimboPrimary(sender1 as Entity); }); Events.PlayerRespawned.Add((sender1, args1) => { Utils.AkimboPrimary(sender1 as Entity); }); sender.Tell($"%nAkimbomode enabled"); }, usage: "!akimbomode", permission: "akimbomode", description: "Enables akimbomode")); Command.TryRegister(SmartParse.CreateCommand( name: "tphere", argTypes: new[] { SmartParse.Player }, action : delegate(Entity sender, object[] args) { Entity ent = args[0] as Entity; ent.SetOrigin(sender.GetOrigin()); ent.Tell($"%nYou have been teleported to %p{sender.Name}"); sender.Tell($"%p{ent.Name} %nhas been teleported to you"); }, usage: "!tphere <player>", permission: "tphere", description: "Teleports a player to you")); Command.TryRegister(SmartParse.CreateCommand( name : "tppoint", argTypes : null, action : delegate(Entity sender, object[] args) { bool fix = false; sender.GiveWeapon("uav_strike_marker_mp"); BaseScript.AfterDelay(100, () => sender.SwitchToWeaponImmediate("uav_strike_marker_mp")); Action <object, WeaponFiredArgs> hook = (obj, arg) => { Entity ent = arg.Player; string weapon = arg.Weapon; if (weapon != "uav_strike_marker_mp" || ent != sender) { return; } int LaserFX = GSCFunctions.LoadFX("misc/laser_glow"); Vector3 playerForward = ent.GetTagOrigin("tag_weapon_right") + GSCFunctions.AnglesToForward(ent.GetPlayerAngles()) * 10000; Entity refObject = GSCFunctions.Spawn("script_model", ent.GetTagOrigin("tag_weapon_tight")); refObject.SetField("angles", ent.GetPlayerAngles()); refObject.SetModel("com_plasticcase_beige_big"); refObject.MoveTo(playerForward, 5f); refObject.Hide(); ent.TakeWeapon("uav_strike_marker_mp"); BaseScript.OnInterval(10, () => { Vector3 endLoc = refObject.GetOrigin() + GSCFunctions.AnglesToForward(refObject.GetField <Vector3>("angles")) * 100; if (!GSCFunctions.SightTracePassed(refObject.GetOrigin(), endLoc, false, ent)) { Entity fx = GSCFunctions.SpawnFX(LaserFX, refObject.Origin); sender.SetOrigin(refObject.GetOrigin()); fix = true; GSCFunctions.TriggerFX(fx); sender.Tell($"%nYou have been teleported to %p{refObject.Origin.ToString()}"); refObject.Notify("death"); BaseScript.AfterDelay(500, () => fx.Delete()); return(false); } return(true); }); }; Events.WeaponFired.Add(hook); BaseScript.OnInterval(100, () => { if (fix) { Events.WeaponFired.Remove(hook); return(false); } return(true); }); }, usage: "!tppoint", permission: "tppoint", description: "Teleports you to a point")); Command.TryRegister(SmartParse.CreateCommand( name : "giveallperks", argTypes : null, action : delegate(Entity sender, object[] args) { List <string> perks = new List <string>() { "specialty_longersprint", "specialty_fastreload", "specialty_scavenger", "specialty_blindeye", "specialty_paint", "specialty_hardline", "specialty_coldblooded", "specialty_quickdraw", "specialty_blastshield", "specialty_detectexplosive", "specialty_autospot", "specialty_bulletaccuracy", "specialty_quieter", "specialty_stalker", "specialty_copycat", "specialty_juiced", "specialty_grenadepulldeath", "specialty_finalstand", "specialty_revenge", "specialty_stopping_power", "specialty_c4death", "specialty_uav" }; sender.ClearPerks(); foreach (string s in perks) { sender.SetPerk(s, true, true); } sender.Tell(perks.Where(x => !sender.HasPerk(x)).Condense()); }, usage: "!giveallperks", permission: "giveallperks", description: "Gives you all perks")); Command.TryRegister(SmartParse.CreateCommand( name: "washingmachine", argTypes: new[] { SmartParse.String }, action : delegate(Entity sender, object[] args) { switch (args[0] as string) { case "random": Random rand = new Random(); BaseScript.OnInterval(1, () => { int num = rand.Next(10); switch (num) { case 1: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z + 1)); break; case 2: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z - 1)); break; case 3: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z + 50)); break; case 4: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z - 50)); break; case 5: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z - 100)); break; case 6: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z + 100)); break; default: sender.SetPlayerAngles(new Vector3(sender.GetPlayerAngles().X, sender.GetPlayerAngles().Y, sender.GetPlayerAngles().Z + 3)); break; } return(true); }); break; } }, usage: "!washingmachine <string>", permission: "washingmachine", description: "Enables washing machine")); // GIVEWEP Command.TryRegister(SmartParse.CreateCommand( name: "givewep", argTypes: new[] { SmartParse.String }, action : delegate(Entity sender, object[] args) { string wep = args[0] as string; sender.GiveWeapon(wep); sender.SetWeaponAmmoClip(wep, int.MaxValue); sender.SetField("Allow_Weapon_Name", wep); sender.SetField("Allow_Grenade_Name", wep); BaseScript.AfterDelay(100, () => sender.SwitchToWeaponImmediate(wep)); sender.Tell($"%nYou have been given %p{wep}"); }, usage: "!givewep <weapon>", permission: "givewep", description: "Gives you the specified weapon")); // AC130 Command.TryRegister(SmartParse.CreateCommand( name : "ac130", argTypes : null, action : delegate(Entity sender, object[] args) { sender.GiveWeapon("ac130_105mm_mp"); sender.GiveWeapon("ac130_40mm_mp"); sender.GiveWeapon("ac130_25mm_mp"); BaseScript.AfterDelay(100, () => sender.SwitchToWeaponImmediate("ac130_105mm_mp")); sender.Tell($"%nYou have been given ac130"); }, usage: "!ac130", permission: "ac130", description: "Gives you AC130")); // AC130 Command.TryRegister(SmartParse.CreateCommand( name: "missilestrike", argTypes: new[] { SmartParse.Integer }, action : delegate(Entity sender, object[] args) { int times = (int)args[0]; sender.Tell($"%nAirstrike confirmed. Sending %h1{times} %nmissiles"); BaseScript.OnInterval(400, () => { Utils.MissileStrike(sender); if (times > 0) { times--; return(true); } return(false); }); }, usage: "!missilestrike <time>", permission: "missilestrike", description: "Sends a missile strike")); // TAKEALLWEPS Command.TryRegister(SmartParse.CreateCommand( name : "takeallweps", argTypes : null, action : delegate(Entity sender, object[] args) { sender.TakeAllWeapons(); sender.Tell($"%nAll weapons taken"); }, usage: "!takeallweps", permission: "takeallweps", description: "Takes all weapons")); // CRASH Command.TryRegister(SmartParse.CreateCommand( name: "crash", argTypes: new[] { SmartParse.UnimmunePlayer }, action : delegate(Entity sender, object[] args) { Entity ent = args[0] as Entity; Utils.CrashPlayer(ent); sender.Tell($"%p{ent.Name} %nhas been crashed"); }, usage: "!crash <player>", permission: "crash", description: "Crashes the players client")); // SPAWNPLAYER Command.TryRegister(SmartParse.CreateCommand( name: "spawnplayer", argTypes: new[] { SmartParse.UnimmunePlayer }, action : delegate(Entity sender, object[] args) { Entity ent = args[0] as Entity; ent.Notify("menuresponse", "team_marinesopfor", "spectator"); BaseScript.AfterDelay(100, () => ent.Notify("menuresponse", "team_marinesopfor", "autoassign")); BaseScript.AfterDelay(300, () => ent.Notify("menuresponse", "changeclass", "class0")); sender.Tell($"%p{ent.Name} %nhas been spawned"); }, usage: "!spawnplayer <player>", permission: "spawnplayer", description: "Spawns the client")); // TEST Command.TryRegister(SmartParse.CreateCommand( name : "mynotifies", argTypes : null, action : delegate(Entity sender, object[] args) { Script.PlayerNotified.Add((sender1, args1) => { Entity ent = args1.Entity; if (ent == sender) { Log.Debug("Entity: " + args1.Notify + "(" + (string.Join(", ", args1.Parameters.Select(x => x.ToString())) + ")")); } }); Script.Notified.Add((sender1, args1) => { Entity ent = null; if (args1.Entity != null) { ent = args1.Entity; } else if (args1.EntityParam != null) { ent = args1.EntityParam; } if (ent != null && ent == sender) { Log.Debug("Level: " + args1.Notify + "(" + (string.Join(", ", args1.Parameters.Select(x => x.ToString())) + ")")); } }); }, usage: "!mynotifies", permission: "mynotifies", description: "")); // TEST Command.TryRegister(SmartParse.CreateCommand( name : "afkgod", argTypes : null, action : delegate(Entity sender, object[] args) { sender.SessionTeam = "spectator"; }, usage: "!afkgod", permission: "afkgod", description: "")); // TEST Command.TryRegister(SmartParse.CreateCommand( name : "god", argTypes : null, action : delegate(Entity sender, object[] args) { BaseScript.OnInterval(1, () => { sender.Health = 1000; return(true); }); }, usage: "!god", permission: "god", description: "")); // TEST Command.TryRegister(SmartParse.CreateCommand( name : "test", argTypes : null, action : delegate(Entity sender, object[] args) { BaseScript.OnInterval(100, () => { sender.Tell(sender.GetPlayerAngles().ToString()); return(true); }); }, usage: "!test", permission: "test", description: "")); Vector3 spawn; // SETSPAWN Command.TryRegister(SmartParse.CreateCommand( name : "setspawn", argTypes : null, action : delegate(Entity sender, object[] args) { spawn = sender.GetOrigin(); Events.PlayerRespawned.Add((sender1, args1) => { (sender1 as Entity).SetOrigin(spawn); }); Events.PlayerSpawned.Add((sender1, args1) => { (sender1 as Entity).SetOrigin(spawn); }); }, usage: "!setspawn", permission: "setspawn", description: "")); // SPAWNPLAYER Command.TryRegister(SmartParse.CreateCommand( name: "fucklamb", argTypes: new[] { SmartParse.Player, SmartParse.Boolean }, action : delegate(Entity sender, object[] args) { Entity ent = args[0] as Entity; bool state = (bool)args[1]; ent.SetField("EnableReverseAimbot", state); if (state) { Utils.DoReverseAimbot(ent); } sender.Tell($"%p{ent.Name} %nhas been f****d"); }, usage: "!fucklamb <player> <state>", permission: "fucklamb", description: "F***s lambdur")); //Script.PlayerConnected.Add((sender, args) => //{ // //if (args.Name.Contains("Lambder") || args.Name.Contains("Markus")) // BaseScript.OnInterval(2000, () => // { // args.SetClientDvar("cg_objectiveText", "^1Lambder"); // BaseScript.AfterDelay(500, () => args.SetClientDvar("cg_objectiveText", "^2Sucks")); // BaseScript.AfterDelay(1000, () => args.SetClientDvar("cg_objectiveText", "^3Big")); // BaseScript.AfterDelay(1500, () => args.SetClientDvar("cg_objectiveText", "^5Dicks")); // return true; // }); // //Events.WeaponChanged.Add((sender1, args1) => // //{ // // Entity ent = sender1 as Entity; // // if (ent.Name.Contains("Lambder") || ent.Name.Contains("Markus")) // // Marshal.WriteInt32((IntPtr)0x01AC2488, (0x38A4 * args.EntRef), 1); // //}); //}); #endregion //GSCFunctions.MakeDvarServerInfo("ui_netGametypeName", "Test"); //GSCFunctions.MakeDvarServerInfo("party_gametype", "Test1"); //GSCFunctions.MakeDvarServerInfo("ui_customModeName", "Test2"); //GSCFunctions.MakeDvarServerInfo("ui_gametype", "Test3"); //GSCFunctions.MakeDvarServerInfo("didyouknow", "Test4"); //GSCFunctions.MakeDvarServerInfo("g_motd", "Test5"); //GSCFunctions.MakeDvarServerInfo("ui_connectScreenTextGlowColor", "0 1 0"); }