Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //In this script, I will show you a template for a mod menu! Feel free to use how you want!
- namespace MenuExample
- {
- using GTA;
- using GTA.Native;
- using System;
- using System.Drawing;
- using System.Windows.Forms;
- public class Main : Script
- {
- private bool isMenuOn;
- private Keys menuDownKey;
- private int menuSelection;
- private Keys menuUpKey;
- private Keys selectionKey;
- private float spacing = (((float) Game.Resolution.Height) / 5f);
- private Keys toggleMenuKey;
- private float x = (Game.Resolution.Width * 0.1f);
- private float y = (Game.Resolution.Height * 0.1f);
- public Main()
- {
- this.toggleMenuKey = base.Settings.GetValueKey("TOGGLE_MENU_KEY", Keys.F1);
- this.selectionKey = base.Settings.GetValueKey("SELECTION_KEY", Keys.Enter);
- this.menuUpKey = base.Settings.GetValueKey("MENU_UP__KEY", Keys.PageUp);
- this.menuDownKey = base.Settings.GetValueKey("MENU_DOWN_KEY", Keys.Next);
- base.BindKey(this.toggleMenuKey, false, false, false, new KeyPressDelegate(this.ToggleMenu));
- }
- private void Crush()
- {
- Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "Oh My Heart!", 0xbb8, 1 });
- base.Player.Character.Task.HandsUp(0xbb8);
- base.Wait(0xbb8);
- base.Player.Character.Die();
- }
- private void Destroy()
- {
- Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "no rocket for you but there is a helicopter", 0xbb8, 1 });
- World.CreateVehicle("MAVERICK", base.Player.Character.Position.Around(10f));
- }
- private void Kill()
- {
- Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "What i've Eaten?", 0xbb8, 1 });
- base.Player.Character.MakeProofTo(false, false, true, true, false);
- World.AddExplosion(base.Player.Character.Position, ExplosionType.Default, 9999f);
- if (base.Player.Character.HeightAboveGround == 0f)
- {
- base.Player.Character.MakeProofTo(false, false, false, false, false);
- }
- }
- private void Menu_KeyDown(object sender, GTA.KeyEventArgs e)
- {
- if (e.Key == this.menuUpKey)
- {
- this.menuSelection--;
- this.menuSelection = (this.menuSelection < 0) ? 2 : this.menuSelection;
- }
- if (e.Key == this.menuDownKey)
- {
- this.menuSelection++;
- this.menuSelection = (this.menuSelection > 2) ? 0 : this.menuSelection;
- }
- if (e.Key == this.selectionKey)
- {
- switch (this.menuSelection)
- {
- case 0:
- this.Crush();
- break;
- case 1:
- this.Kill();
- break;
- case 2:
- this.Destroy();
- break;
- case 3:
- this.Spawn_Turismo();
- break;
- }
- }
- }
- private void Menu_PerFrameDrawing(object sender, GraphicsEventArgs e)
- {
- e.Graphics.DrawText("Critic Arrest", this.x, this.y, (this.menuSelection == 0) ? Color.Red : Color.White);
- e.Graphics.DrawText("Mega Fart", this.x, (float) (this.y + this.spacing), (this.menuSelection == 1) ? Color.Red : Color.White);
- e.Graphics.DrawText("Rocket", this.x, (float) (this.y + (this.spacing * 2f)), (this.menuSelection == 2) ? Color.Red : Color.White);
- e.Graphics.DrawText("Turismo", this.x, (float) (this.y + (this.spacing * 3f)), (this.menuSelection == 3) ? Color.Red : Color.White);
- }
- private void Spawn_Turismo()
- {
- Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", new Parameter[] { "STRING", "My Boy,here it is", 0xbb8, 1 });
- World.CreateVehicle("TURISMO", base.Player.Character.Position.Around(10f));
- }
- private void ToggleMenu()
- {
- this.isMenuOn = !this.isMenuOn;
- if (this.isMenuOn)
- {
- base.PerFrameDrawing += new GraphicsEventHandler(this.Menu_PerFrameDrawing);
- base.KeyDown += new GTA.KeyEventHandler(this.Menu_KeyDown);
- }
- else
- {
- base.PerFrameDrawing -= new GraphicsEventHandler(this.Menu_PerFrameDrawing);
- base.KeyDown -= new GTA.KeyEventHandler(this.Menu_KeyDown);
- }
- }
- }
- }
- //See my profile for more!
Advertisement
Add Comment
Please, Sign In to add comment