private bool LoadAssembly(string filename, Assembly assembly) { uint num3; uint num2 = 0; try { foreach (System.Type type in assembly.GetTypes()) { if (type.IsSubclassOf(typeof(Script))) { num2++; this._scriptTypes.Add(new Tuple <string, System.Type>(filename, type)); } } } catch (ReflectionTypeLoadException exception1) { string[] strArray2 = new string[] { "Failed to load assembly '", Path.GetFileName(filename), "':", Environment.NewLine, exception1.ToString() }; GTA.Log("[ERROR]", strArray2); return(false); } string[] message = new string[] { "Found ", num3.ToString(), " script(s) in '", Path.GetFileName(filename), "'." }; num3 = num2; GTA.Log("[INFO]", message); return((num2 != 0) ? ((bool)((byte)1)) : ((bool)((byte)0))); }
public void Abort() { int count; string[] message = new string[] { "Stopping ", count.ToString(), " script(s) ..." }; count = this._runningScripts.Count; GTA.Log("[INFO]", message); List <Script> .Enumerator enumerator = this._runningScripts.GetEnumerator(); if (enumerator.MoveNext()) { do { Script current = enumerator.Current; current.Abort(); IDisposable disposable = current as IDisposable; if (disposable != null) { disposable.Dispose(); } }while (enumerator.MoveNext()); } this._scriptTypes.Clear(); this._runningScripts.Clear(); GC.Collect(); }
private void DrawMenu(GTA.Menu menuLayout) { //FROZETS MENU LAYOUT // Header Layout menuLayout.HeaderCentered = true; menuLayout.HeaderHeight += 5; menuLayout.HeaderTextScale = 0.64f; menuLayout.HeaderFont = GTA.Font.ChaletComprimeCologne; menuLayout.HeaderColor = System.Drawing.Color.FromArgb(175, 51, 153, 255); // Items Layout menuLayout.ItemTextCentered = true; menuLayout.ItemHeight -= 7; menuLayout.ItemTextScale = 0.32f; menuLayout.SelectedItemColor = System.Drawing.Color.FromArgb(220, 255, 255, 255); menuLayout.UnselectedItemColor = System.Drawing.Color.FromArgb(80, 230, 230, 230); menuLayout.SelectedTextColor = System.Drawing.Color.FromArgb(255, 0, 0, 0); menuLayout.UnselectedTextColor = System.Drawing.Color.FromArgb(255, 0, 0, 0); // Footer Layout menuLayout.HasFooter = true; menuLayout.FooterColor = System.Drawing.Color.FromArgb(175, 51, 153, 255); menuLayout.FooterHeight += -17; menuLayout.FooterTextScale = 0.50f; menuLayout.FooterTextColor = System.Drawing.Color.FromArgb(220, 255, 255, 255); menuLayout.FooterFont = GTA.Font.ChaletComprimeCologne; menuLayout.FooterCentered = true; View.MenuPosition = new System.Drawing.Point(35, 20); View.AddMenu(menuLayout); }
void Bombat_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerBomb.AddInputKey(e.Key); if (inputCheckerBomb.Check(0) == true) { if (AllF) { Game.DisplayText("ChaosHeli OFF", 4000); AllF = false; CameraFlag = false; Reset(); } else { Game.DisplayText("ChaosHeli ON", 4000); AllF = true; CameraFlag = false; Reset(); } } if (inputCheckerBomb.Check(1)) { AllF = true; Reset(); } }
public static void renderAll(GTA.Graphics g) { foreach (var view in ViewsPool) { if (view.currentInterpolatorX != null && view.currentInterpolatorX.HasStarted) // those conditonals actually make sense { if (view.currentInterpolatorX.HasEnded && !view.currentInterpolatorX.HasStarted) { view.currentInterpolatorX = null; } else { view.position.X = view.currentInterpolatorX.Current; } } if (view.currentInterpolatorY != null && view.currentInterpolatorY.HasStarted) { if (view.currentInterpolatorY.HasEnded && !view.currentInterpolatorY.HasStarted) { view.currentInterpolatorY = null; } else { view.position.Y = view.currentInterpolatorY.Current; } } view.render(g); } }
//キー入力があると実行される void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { //キーボードのKが押されたら //30m以内の車が一斉に発火する if (e.Key == Keys.K) { Vehicle[] V = World.GetVehicles(Player.Character.Position, 100.0f); for (int i = 0; i < V.Length; i++) { if (!Exists(V[i])) { continue; } if (V[i] == Player.Character.CurrentVehicle) { continue; } Ped ped = V[i].GetPedOnSeat(VehicleSeat.Driver); if (!Exists(ped)) { continue; } float vel = rnd.Next(30, 70); V[i].Speed += vel; World.AddExplosion(V[i].Position, ExplosionType.Default, 0, true, false, 1.0f); } } }
void Bombat_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerBomb.AddInputKey(e.Key); inputCheckerAll.AddInputKey(e.Key); if (inputCheckerAll.Check(0) == true) { AllF = true; } if (inputCheckerBomb.Check(0) == true) { if (AllF) { Game.DisplayText("MeteoStorm OFF", 4000); AllF = false; if (Exists(A)) { A.Delete(); } if (Exists(target)) { target.Delete(); } // if (Exists(lig.Enabled)) { lig.Disable(); } // lig.Enabled = false; } else { Game.DisplayText("MeteoStorm ON", 4000); AllF = true; } } }
/// <summary> /// Draw text /// </summary> /// <param name="text">Text to drawn</param> /// <param name="x">X position in pixel</param> /// <param name="y">Y position in pixel</param> /// <param name="align">Horizontal alignment</param> /// <param name="color">Color</param> /// <param name="xScale">X Scale</param> /// <param name="yScale">Y Scale</param> /// <param name="font">Font</param> /// <param name="shadowOffset">Offset of shadow</param> /// <param name="shadowColor">Color of shadow</param> /// <param name="screenHeight">Height of screen in pixel</param> /// <param name="screenWidth">Width of screen in pixel</param> public static void DrawText(MString text, int x, int y, GlobalConst.HAlign align, Color color, float xScale = 0.35f, float yScale = 0.35f, GTA.Font font = GTA.Font.ChaletLondon, Point shadowOffset = new Point(), Color shadowColor = new Color(), int screenWidth = GlobalConst.DEFAULT_SCREEN_WIDTH, int screenHeight = GlobalConst.DEFAULT_SCREEN_HEIGHT) { if (shadowOffset.X != 0 || shadowOffset.Y != 0) { DrawText(text, x + shadowOffset.X, y + shadowOffset.Y, align, shadowColor, xScale, yScale, font, new Point(), Color.Black, screenWidth, screenHeight); } Function.Call(Hash.SET_TEXT_FONT, (int)font); Function.Call(Hash.SET_TEXT_SCALE, xScale, yScale); Function.Call(Hash.SET_TEXT_COLOUR, color.R, color.G, color.B, color.A); switch (align) { case GlobalConst.HAlign.Left: Function.Call(Hash.SET_TEXT_CENTRE, 0); break; case GlobalConst.HAlign.Center: Function.Call(Hash.SET_TEXT_CENTRE, 1); break; case GlobalConst.HAlign.Right: Function.Call(Hash.SET_TEXT_RIGHT_JUSTIFY, 1); break; } Function.Call(Hash._SET_TEXT_ENTRY, "STRING"); Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, ML(text)); Function.Call(Hash._DRAW_TEXT, (float)x / screenWidth, (float)y / screenHeight); }
private void DrawMenu(GTA.Menu name) { // Header Layout name.HeaderHeight += 2; name.HeaderFont = GTA.Font.Pricedown; name.HeaderColor = System.Drawing.Color.FromArgb(233, 0, 16, 99); // Items Layout name.ItemTextCentered = false; name.ItemHeight -= 7; name.ItemTextScale = 0.32f; name.SelectedItemColor = System.Drawing.Color.FromArgb(112, 0, 16, 115); name.UnselectedItemColor = System.Drawing.Color.FromArgb(112, 0, 16, 0); name.SelectedTextColor = System.Drawing.Color.White; name.UnselectedTextColor = System.Drawing.Color.AntiqueWhite; // Footer Layout name.HasFooter = false; name.FooterHeight -= 32; name.FooterFont = GTA.Font.Pricedown; name.FooterColor = System.Drawing.Color.FromArgb(233, 0, 16, 99); name.FooterTextColor = System.Drawing.Color.White; View.MenuPosition = new System.Drawing.Point(5, 5); View.AddMenu(name); }
private Script InstantiateScript(System.Type scripttype) { if (scripttype.IsSubclassOf(typeof(Script))) { string[] message = new string[] { "Instantiating script '", scripttype.FullName, "' in script domain '", this.Name, "' ..." }; GTA.Log("[INFO]", message); try { return((Script)Activator.CreateInstance(scripttype)); } catch (MissingMethodException) { string[] strArray4 = new string[] { "Failed to instantiate script '", scripttype.FullName, "' because no public default constructor was found." }; GTA.Log("[ERROR]", strArray4); } catch (TargetInvocationException exception1) { string[] strArray2 = new string[] { "Failed to instantiate script '", scripttype.FullName, "' because constructor threw an exception:", Environment.NewLine, exception1.InnerException.ToString() }; GTA.Log("[ERROR]", strArray2); } catch (Exception exception3) { string[] strArray = new string[] { "Failed to instantiate script '", scripttype.FullName, "':", Environment.NewLine, exception3.ToString() }; GTA.Log("[ERROR]", strArray); } } return(null); }
/// <summary> /// Draw text /// </summary> /// <param name="text">Text to drawn</param> /// <param name="x">X position in pixel</param> /// <param name="y">Y position in pixel</param> /// <param name="align">Horizontal alignment</param> /// <param name="color">Color</param> /// <param name="xScale">X Scale</param> /// <param name="yScale">Y Scale</param> /// <param name="font">Font</param> /// <param name="screenHeight">Height of screen in pixel</param> /// <param name="screenWidth">Width of screen in pixel</param> public static void DrawText(string text, int x, int y, GlobalConst.HAlign align, Color color, float xScale = 0.45f, float yScale = 0.45f, GTA.Font font = GTA.Font.ChaletLondon, int screenWidth = GlobalConst.DEFAULT_SCREEN_WIDTH, int screenHeight = GlobalConst.DEFAULT_SCREEN_HEIGHT) { Function.Call(Hash.SET_TEXT_FONT, (int)font); Function.Call(Hash.SET_TEXT_SCALE, xScale, yScale); Function.Call(Hash.SET_TEXT_COLOUR, color.R, color.G, color.B, color.A); Function.Call(Hash.SET_TEXT_WRAP, 0.0f, 1.0f); switch (align) { case GlobalConst.HAlign.Left: Function.Call(Hash.SET_TEXT_CENTRE, 0); break; case GlobalConst.HAlign.Center: Function.Call(Hash.SET_TEXT_CENTRE, 1); break; case GlobalConst.HAlign.Right: Function.Call(Hash.SET_TEXT_RIGHT_JUSTIFY, 1); break; } //Function.Call(Hash.SET_TEXT_DROP_SHADOW, 0, 0, 0, 0, 0); //Function.Call(Hash.SET_TEXT_EDGE, 0, 0, 0, 0, 0); Function.Call(Hash._SET_TEXT_ENTRY, "STRING"); Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, text); Function.Call(Hash._DRAW_TEXT, (float)x / screenWidth, (float)y / screenHeight); }
void key_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.NumPad2) { GTA.Native.Function.Call("DISPLAY_HUD", true); Player.CanControlCharacter = true; } inputChecker.AddInputKey(e.Key); if (inputChecker.Check(0) == true) { Player.Character.Health = -1; } if (e.Key == Keys.NumPad3 && Player.Character.isInVehicle()) { Rt = true; } else { Rt = false; } if (e.Key == Keys.NumPad1) { Rt = false; } }
private void DrawMenu(GTA.Menu MainMenu) { //ALPHA , RED , GREEN , BLUE // Header Layout MainMenu.HeaderCentered = true; MainMenu.HeaderHeight += 5; MainMenu.HeaderTextScale = 0.64f; MainMenu.HeaderFont = GTA.Font.ChaletComprimeCologne; MainMenu.HeaderColor = System.Drawing.Color.FromArgb(175, 51, 153, 255); // Items Layout MainMenu.ItemTextCentered = true; MainMenu.ItemHeight -= 7; MainMenu.ItemTextScale = 0.32f; MainMenu.SelectedItemColor = System.Drawing.Color.FromArgb(220, 255, 255, 255); MainMenu.UnselectedItemColor = System.Drawing.Color.FromArgb(80, 230, 230, 230); MainMenu.SelectedTextColor = System.Drawing.Color.FromArgb(255, 0, 0, 0); MainMenu.UnselectedTextColor = System.Drawing.Color.FromArgb(255, 0, 0, 0); // Footer Layout MainMenu.HasFooter = true; MainMenu.FooterColor = System.Drawing.Color.FromArgb(175, 51, 153, 255); MainMenu.FooterHeight += -17; MainMenu.FooterTextScale = 0.50f; MainMenu.FooterTextColor = System.Drawing.Color.FromArgb(220, 255, 255, 255); MainMenu.FooterFont = GTA.Font.ChaletComprimeCologne; MainMenu.FooterCentered = true; View.MenuPosition = new System.Drawing.Point(35, 20); View.AddMenu(MainMenu); }
void N2C_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerN2C.AddInputKey(e.Key); if (e.Key == Keys.NumPad6) { if (RemoveMissions) { Game.DisplayText("[Nitro2Cit] No Exclude Mission Vehicles.", 5000); } else { Game.DisplayText("[Nitro2Cit] Exclude Mission Vehicles.", 5000); } RemoveMissions = !RemoveMissions; } if (inputCheckerN2C.Check(1) == true) { ActivateFlag = true; } if (inputCheckerN2C.Check(0) == true) { if (ActivateFlag) { Game.DisplayText("Nitro2 OFF", 4000); ActivateFlag = false; } else { Game.DisplayText("Nitro2 ON", 4000); ActivateFlag = true; } } }
private void Form1_Load(object sender, EventArgs e) { var login = new Login(); login.ShowDialog(); Gta = new GTA(); Player = new Player(Gta); UIUpdaterThread = new Thread(new ThreadStart(UpdateUIElements)); UIUpdaterThread.Start(); foreach (var scrn in Screen.AllScreens) { if (scrn.Bounds.Contains(this.Location)) { this.Location = new Point(scrn.Bounds.Right - this.Width, scrn.Bounds.Top); } } WindowState = FormWindowState.Minimized; KeyboardHook = new Hook("Keyboard hook"); KeyboardHook.KeyUpEvent += KeyPress; MarqueeTimer.Start(); InitializeTooltips(); TeleportBox.Items.Add("Waypoint"); foreach (var location in Models.Location.GetLocations()) { TeleportBox.Items.Add(location.Name); } TeleportBox.SelectedIndex = 0; }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMOD.AddInputKey(e.Key); if (inputCheckerMOD.Check(1)) { //ActiveFlag = true; } if (inputCheckerMOD.Check(0) == true) { if (ActiveFlag) { ActiveFlag = false; KamikazeFlag = false; if (Exists(KB)) { KB.Delete(); } KB = Blip.AddBlip(K_P); Game.DisplayText("Kamikaze OFF", 4000); } else { ActiveFlag = true; Game.DisplayText("Kamikaze ON", 4000); } } }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMOD.AddInputKey(e.Key); if (inputCheckerMOD.Check(0)) { if (!ActiveFlag) { ActiveFlag = true; Game.DisplayText("Flare ON", 4000); Setting = true; } else { ActiveFlag = false; Game.DisplayText("Flare OFF", 4000); cam.Deactivate(); Setting = false; Player.Character.FreezePosition = false; for (int i = 0; i < 4; i++) { if (Exists(A[i])) { A[i].Delete(); } } } } }
public ScriptDomain() { sCurrentDomain = this; this._appdomain.AssemblyResolve += new ResolveEventHandler(< Module >.GTA.HandleResolve); this._appdomain.UnhandledException += new UnhandledExceptionEventHandler(< Module >.GTA.HandleUnhandledException); string[] message = new string[] { "Created new script domain with v", typeof(ScriptDomain).Assembly.GetName().Version.ToString(3), "." }; GTA.Log("[INFO]", message); }
public Player(GTA gta) { Gta = gta; AutoHealThread = new Thread(new ParameterizedThreadStart(AutoHeal)); PlayerAddy = Gta.ReadInt64(Gta.CPedFactory + 0x8); PlayerInfoAddy = Gta.ReadInt64(PlayerAddy + 0x10B8); Weapon = new Weapon(Gta, PlayerAddy); }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMOD.AddInputKey(e.Key); if (inputCheckerMOD.Check(0)) { if (Flag) { Flag = false; } else { Flag = true; } } }
private void FTB(GTA.Script sender, GTA.ObjectCollection Parameter) { if (AllF) { Player.CanControlRagdoll = true; Player.Character.isRagdoll = true; FlyNow = true; } }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMOD.AddInputKey(e.Key); if (inputCheckerMOD.Check(0) == true) { ActiveFlag = true; } }
void Bombat_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerBomb.AddInputKey(e.Key); if (inputCheckerBomb.Check(0) == true) { Thread thread = new Thread(new ThreadStart(StopBoyomi)); thread.Start(); } }
public static void AbortScript(Script script) { if (!ReferenceEquals(script._thread, null)) { script._running = false; script._thread.Abort(); script._thread = null; string[] message = new string[] { "Aborted script '", script.Name, "'." }; GTA.Log("[INFO]", message); } }
void Bombat_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerBomb.AddInputKey(e.Key); if (inputCheckerBomb.Check(0) == true) { Game.DisplayText("Test Active", 4000); AF = true; } }
public void DrawText(string message, float x, float y, float scale, GTA.Font font, int r, int g, int b, int alpha) { Function.Call(Hash.SET_TEXT_FONT, Convert.ToInt32(font)); Function.Call(Hash.SET_TEXT_SCALE, scale, scale); Function.Call(Hash.SET_TEXT_COLOUR, r, g, b, alpha); Function.Call(Hash.SET_TEXT_WRAP, 0.0, 1.0); Function.Call(Hash.SET_TEXT_CENTRE, false); Function.Call(Hash.SET_TEXT_DROPSHADOW, 2, 2, 0, 0, 0); Function.Call(Hash.SET_TEXT_EDGE, 1, 1, 1, 1, 205); Function.Call(Hash._SET_TEXT_ENTRY, "STRING"); Function.Call(Hash._ADD_TEXT_COMPONENT_STRING, message); Function.Call(Hash._DRAW_TEXT, x, y); }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.U) { if (AF) { AF = false; Player.CanControlRagdoll = false; Player.Character.isRagdoll = false; Player.Character.Invincible = false; return; } } }
void Bombat_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.F12) { if (GTA.Game.CurrentCamera.isActive) { GTA.Game.CurrentCamera.Deactivate(); Game.DisplayText("Camera disable.", 4000); } else { Game.DisplayText("Camera enable.", 4000); GTA.Game.CurrentCamera.Activate(); } } }
public HUDText(string text, int value, Entity ent, Vector3 position, Color mainColor, Color textColor, GTA.Font font = GTA.Font.Monospace, Vector3? startOffset = null) { this.text = text; this.value = value; this.entity = ent; this.position = position; this.mainColor = mainColor; this.textColor = textColor; this.font = font; this.startOffset = startOffset; this.moveOffset = new PointF(0.0f, 0.005f); this.displayTimer = new Timer(100); this.fadeTimer = new Timer(1000); this.display = true; displayTimer.Start(); }
void Bombat_KeyDown(object sender, GTA.KeyEventArgs m) { inputCheckerBomb.AddInputKey(m.Key); if (inputCheckerBomb.Check(0) == true) { if (ActiveF) { Game.DisplayText("Soliton Lader OFF", 4000); ActiveF = false; } else { Game.DisplayText("Soliton Lader ON", 4000); ActiveF = true; } } }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMOD.AddInputKey(e.Key); if (inputCheckerMOD.Check(0) == true || inputCheckerMOD.Check(1) == true) { if (ActiveFlag) { ActiveFlag = false; Game.DisplayText("TamiPato OFF", 4000); } else { ActiveFlag = true; Game.DisplayText("TamiPato ON", 4000); } } }
bool CheckLockOn(GTA.Object O) { try { for (int i = 0; i < RT.Length; i++) { if (RT[i].o == O) { return true; } } } catch { Game.DisplayText("@HORMING ERROR in CheckLockOn", 4000); } return false; }
public void kdHandler(object sender, GTA.KeyEventArgs e) { if (Keys.I == e.Key) { if (Player.Character.isInVehicle()) { if (enginestarted) { enginestarted = false; audioplayed = false; } else if (!enginestarted) { startsounddelay = true; audioplayed = false; } } } }
void MOD_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMOD.AddInputKey(e.Key); if (inputCheckerMOD.Check(0)) { Vehicle[] v = Cacher.GetVehicles(Player.Character.Position, 50.0f); for (int i = 0, length = v.Length; i < length; i++) { if (Exists(v)) { v[i].DoorLock = DoorLock.None; Game.DisplayText("ドアロック解除", 4000); } } } }
public void DoTick() { List <Script> .Enumerator enumerator = this._runningScripts.GetEnumerator(); if (enumerator.MoveNext()) { do { Script current = enumerator.Current; if (current._running) { this._executingScript = current; AutoResetEvent event2 = current._waitEvent; current._continueEvent.Set(); byte num = (byte)event2.WaitOne(0x7530); current._running = (bool)num; if (num != 0) { while (this._taskQueue.Count > 0) { this._taskQueue.Dequeue().Run(); event2 = current._waitEvent; current._continueEvent.Set(); num = (byte)event2.WaitOne(0x7530); current._running = (bool)num; if (num == 0) { break; } } } this._executingScript = null; if (!current._running) { string[] message = new string[] { "Script '", current.Name, "' is not responding! Aborting ..." }; GTA.Log("[ERROR]", message); AbortScript(current); } } }while (enumerator.MoveNext()); } this.CleanupStrings(); }
private bool LoadAssembly(string filename) { Assembly assembly = null; try { assembly = Assembly.LoadFrom(filename); } catch (BadImageFormatException) { return(false); } catch (Exception exception1) { string[] message = new string[] { "Failed to load assembly '", Path.GetFileName(filename), "':", Environment.NewLine, exception1.ToString() }; GTA.Log("[ERROR]", message); return(false); } return(this.LoadAssembly(filename, assembly)); }
void key_KeyDown(object sender, GTA.KeyEventArgs e) { if (e.Key == Keys.D8) { pZ += 0.5f; } if (e.Key == Keys.D2) { pZ -= 0.5f; } inputChecker.AddInputKey(e.Key); if (inputChecker.Check(0) == true) { if (Flag) { GTA.World.PedDensity = 1.0f; cam.Deactivate(); Flag = false; Player.Character.FreezePosition = false; Player.Character.Invincible = false; Player.Character.Visible = true; Player.CanControlCharacter = true; GTA.Native.Function.Call("DISPLAY_HUD", true); GTA.Native.Function.Call("DISPLAY_RADAR", true); } else { Flag = true; GTA.World.PedDensity = 10.0f; cam.Position = Player.Character.Position; cam.Activate(); Player.Character.FreezePosition = true; Player.Character.Invincible = true; Player.Character.Visible = false; Player.CanControlCharacter = false; GTA.Native.Function.Call("DISPLAY_HUD", false); GTA.Native.Function.Call("DISPLAY_RADAR", false); } } }
void MaxSpeed_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerMaxSpeed.AddInputKey(e.Key); if (inputCheckerMaxSpeed.Check(1) == true) { ActivateFlag = true; } if (inputCheckerMaxSpeed.Check(0) == true) { if (ActivateFlag) { Game.DisplayText("Run away OFF", 4000); ActivateFlag = false; } else { Game.DisplayText("Run away ON", 4000); ActivateFlag = true; } } }
void Choki_KeyDown(object sender, GTA.KeyEventArgs e) { inputCheckerChoki.AddInputKey(e.Key); if (inputCheckerChoki.Check(1) == true) { AllF = true; } if (inputCheckerChoki.Check(0) == true) { if (AllF) { Game.DisplayText("Armor OFF", 4000); AllF = false; } else { Game.DisplayText("armor ON", 4000); AllF = true; } } }
public Weapon(GTA gta, long playerAddy) { Gta = gta; WpAddy = Gta.ReadInt64(playerAddy + 0x10C8); }
private bool LoadScript(string filename) { CodeDomProvider provider; CompilerParameters options = new CompilerParameters { CompilerOptions = "/optimize", GenerateInMemory = true, IncludeDebugInformation = true, ReferencedAssemblies = { "System.dll", "System.Core.dll", "System.Drawing.dll", "System.Windows.Forms.dll", "System.XML.dll", "System.XML.Linq.dll", typeof(Script).Assembly.Location } }; string extension = Path.GetExtension(filename); if (extension.Equals(".cs", StringComparison.InvariantCultureIgnoreCase)) { provider = new CSharpCodeProvider(); options.CompilerOptions = options.CompilerOptions + " /unsafe"; } else { if (!extension.Equals(".vb", StringComparison.InvariantCultureIgnoreCase)) { return(false); } provider = new VBCodeProvider(); } CompilerResults results = provider.CompileAssemblyFromFile(options, new string[] { filename }); if (!results.Errors.HasErrors) { string[] message = new string[] { "Successfully compiled '", Path.GetFileName(filename), "'." }; GTA.Log("[INFO]", message); return(this.LoadAssembly(filename, results.CompiledAssembly)); } StringBuilder builder = new StringBuilder(); IEnumerator enumerator = results.Errors.GetEnumerator(); while (true) { try { while (true) { if (!enumerator.MoveNext()) { int count; string[] message = new string[] { "Failed to compile '", Path.GetFileName(filename), "' with ", count.ToString(), " error(s):", Environment.NewLine, builder.ToString() }; count = results.Errors.Count; GTA.Log("[ERROR]", message); return(false); } else { CompilerError current = (CompilerError)enumerator.Current; builder.Append(" at line "); builder.Append(current.Line); builder.Append(": "); builder.Append(current.ErrorText); builder.AppendLine(); } break; } } finally { IDisposable disposable = enumerator as IDisposable; if (disposable != null) { disposable.Dispose(); } } } }
public static ScriptDomain Load(string path) { int num; List <string> list; List <string> list2; path = Path.GetFullPath(path); AppDomainSetup info = new AppDomainSetup { ApplicationBase = path, ShadowCopyFiles = "true", ShadowCopyDirectories = path }; StrongName[] fullTrustAssemblies = new StrongName[0]; System.AppDomain domain = System.AppDomain.CreateDomain("ScriptDomain_" + (path.GetHashCode() * Environment.TickCount).ToString("X"), null, info, new PermissionSet(PermissionState.Unrestricted), fullTrustAssemblies); domain.InitializeLifetimeService(); ScriptDomain domain2 = null; try { domain2 = (ScriptDomain)domain.CreateInstanceFromAndUnwrap(typeof(ScriptDomain).Assembly.Location, typeof(ScriptDomain).FullName); } catch (Exception exception1) { string[] strArray2 = new string[] { "Failed to create script domain '", domain.FriendlyName, "':", Environment.NewLine, exception1.ToString() }; GTA.Log("[ERROR]", strArray2); System.AppDomain.Unload(domain); return(null); } string[] message = new string[] { "Loading scripts from '", path, "' into script domain '", domain.FriendlyName, "' ..." }; GTA.Log("[INFO]", message); if (!Directory.Exists(path)) { string[] strArray7 = new string[] { "Failed to reload scripts because the directory is missing." }; GTA.Log("[ERROR]", strArray7); return(domain2); } else { list2 = new List <string>(); list = new List <string>(); try { list2.AddRange(Directory.GetFiles(path, "*.vb", SearchOption.AllDirectories)); list2.AddRange(Directory.GetFiles(path, "*.cs", SearchOption.AllDirectories)); list.AddRange(Directory.GetFiles(path, "*.dll", SearchOption.AllDirectories)); } catch (Exception exception5) { string[] strArray6 = new string[] { "Failed to reload scripts:", Environment.NewLine, exception5.ToString() }; GTA.Log("[ERROR]", strArray6); System.AppDomain.Unload(domain); return(null); } num = 0; } while (true) { if (num >= list.Count) { List <string> .Enumerator enumerator2 = list2.GetEnumerator(); if (enumerator2.MoveNext()) { do { string current = enumerator2.Current; domain2.LoadScript(current); }while (enumerator2.MoveNext()); } List <string> .Enumerator enumerator = list.GetEnumerator(); if (enumerator.MoveNext()) { do { string current = enumerator.Current; domain2.LoadAssembly(current); }while (enumerator.MoveNext()); } break; } try { string assemblyFile = list[num]; if (AssemblyName.GetAssemblyName(assemblyFile).Name == "ScriptHookVDotNet") { string[] strArray5 = new string[] { "Removing assembly file '", Path.GetFileName(assemblyFile), "'." }; GTA.Log("[WARNING]", strArray5); num += -1; list.RemoveAt(num); try { File.Delete(assemblyFile); } catch (Exception exception6) { string[] strArray4 = new string[] { "Failed to delete assembly file:", Environment.NewLine, exception6.ToString() }; GTA.Log("[ERROR]", strArray4); } } } catch (BadImageFormatException) { } catch (Exception exception7) { string[] strArray3 = new string[] { "Failed to load assembly ", list[num], Environment.NewLine, exception7.ToString() }; GTA.Log("[ERROR]", strArray3); } num++; } return(domain2); }
public Vehicle(GTA gta, long addy) { Gta = gta; VehicleAddy = addy; VehicleHandlingAddy = Gta.ReadInt64(VehicleAddy + 0x918); }